From 79a8201e6e67cb865a04da7415be8b03698d16fd Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 9 Feb 2023 07:32:05 +0100 Subject: * build/toplevel.mk (do_dist): Fix typo. --- builds/toplevel.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builds/toplevel.mk b/builds/toplevel.mk index a0e0c8787..5a3ff2abd 100644 --- a/builds/toplevel.mk +++ b/builds/toplevel.mk @@ -317,6 +317,6 @@ do-dist: distclean refdoc rm -f $(TOP_DIR)/docs/mkdocs.yml @# Remove more stuff related to git. - rm -rf (TOP_DIR)/subprojects/dlg + rm -rf $(TOP_DIR)/subprojects/dlg # EOF -- cgit v1.2.3 From 23e60caeef4027fdc9d1d40efbb47318a0a7d6f3 Mon Sep 17 00:00:00 2001 From: "Jan Alexander Steffens (heftig)" Date: Thu, 9 Feb 2023 19:22:47 +0000 Subject: * builds/meson/parse_modules_cfg.py: Handle `gxvalid` and `otvalid`. These need a name mapping similar to what was done for other modules, or linking will fail. --- builds/meson/parse_modules_cfg.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/builds/meson/parse_modules_cfg.py b/builds/meson/parse_modules_cfg.py index 6030bb209..d48129fe7 100644 --- a/builds/meson/parse_modules_cfg.py +++ b/builds/meson/parse_modules_cfg.py @@ -97,8 +97,12 @@ def generate_ftmodule(lists): for module in lists["AUX_MODULES"]: if module in ("psaux", "psnames", "otvalid", "gxvalid"): + name = { + "gxvalid": "gxv", + "otvalid": "otv", + }.get(module, module) result += ( - "FT_USE_MODULE( FT_Module_Class, %s_module_class )\n" % module + "FT_USE_MODULE( FT_Module_Class, %s_module_class )\n" % name ) result += "/* EOF */\n" -- cgit v1.2.3 From dacbb55433079fb3539163862958a6b9466a0661 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Fri, 10 Feb 2023 08:24:33 -0500 Subject: [type1/MM] Round design coordinates. The design coordinates for MM fonts were not rounded. For example, `FT_Get_Var_Design_Coordinates` returned values with fractional part. * src/type1/t1load.c (mm_axis_unmap): Refactor with rounding. * include/freetype/ftmm.h (FT_Var_Axis, FT_Set_Var_Design_Coordinates, FT_Get_Var_Design_Coordinates): Reword documentation. --- include/freetype/ftmm.h | 10 +++++----- src/type1/t1load.c | 11 ++++++----- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/include/freetype/ftmm.h b/include/freetype/ftmm.h index e381ef3d3..3eabdd5f2 100644 --- a/include/freetype/ftmm.h +++ b/include/freetype/ftmm.h @@ -153,7 +153,7 @@ FT_BEGIN_HEADER * @note: * The fields `minimum`, `def`, and `maximum` are 16.16 fractional values * for TrueType GX and OpenType variation fonts. For Adobe MM fonts, the - * values are integers. + * values are whole numbers (i.e., the fractional part is zero). */ typedef struct FT_Var_Axis_ { @@ -399,8 +399,8 @@ FT_BEGIN_HEADER * * @note: * The design coordinates are 16.16 fractional values for TrueType GX and - * OpenType variation fonts. For Adobe MM fonts, the values are - * integers. + * OpenType variation fonts. For Adobe MM fonts, the values are supposed + * to be whole numbers (i.e., the fractional part is zero). * * [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`. @@ -446,8 +446,8 @@ FT_BEGIN_HEADER * * @note: * The design coordinates are 16.16 fractional values for TrueType GX and - * OpenType variation fonts. For Adobe MM fonts, the values are - * integers. + * OpenType variation fonts. For Adobe MM fonts, the values are whole + * numbers (i.e., the fractional part is zero). * * @since: * 2.7.1 diff --git a/src/type1/t1load.c b/src/type1/t1load.c index 5a1afd8d9..3ec9ffa16 100644 --- a/src/type1/t1load.c +++ b/src/type1/t1load.c @@ -225,11 +225,12 @@ for ( j = 1; j < axismap->num_points; j++ ) { if ( ncv <= axismap->blend_points[j] ) - return INT_TO_FIXED( axismap->design_points[j - 1] ) + - ( axismap->design_points[j] - axismap->design_points[j - 1] ) * - FT_DivFix( ncv - axismap->blend_points[j - 1], - axismap->blend_points[j] - - axismap->blend_points[j - 1] ); + return INT_TO_FIXED( axismap->design_points[j - 1] + + FT_MulDiv( ncv - axismap->blend_points[j - 1], + axismap->design_points[j] - + axismap->design_points[j - 1], + axismap->blend_points[j] - + axismap->blend_points[j - 1] ) ); } return INT_TO_FIXED( axismap->design_points[axismap->num_points - 1] ); -- cgit v1.2.3 From 0eca6ead82b4e6f739b57e49a3029d0b31fd1652 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 16 Feb 2023 06:35:33 +0100 Subject: Documentation improvement for `FT_Bitmap`. Fixes #1205. --- include/freetype/ftimage.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/freetype/ftimage.h b/include/freetype/ftimage.h index 2e8e6734c..738b515ed 100644 --- a/include/freetype/ftimage.h +++ b/include/freetype/ftimage.h @@ -19,7 +19,7 @@ /************************************************************************** * * Note: A 'raster' is simply a scan-line converter, used to render - * FT_Outlines into FT_Bitmaps. + * `FT_Outline`s into `FT_Bitmap`s. * */ @@ -256,6 +256,12 @@ FT_BEGIN_HEADER * palette :: * A typeless pointer to the bitmap palette; this field is intended for * paletted pixel modes. Not used currently. + * + * @note: + * `width` and `rows` refer to the *physical* size of the bitmap, not the + * *logical* one. For example, if @FT_Pixel_Mode is set to + * `FT_PIXEL_MODE_LCD`, the logical width is a just a third of the + * physical one. */ typedef struct FT_Bitmap_ { -- cgit v1.2.3 From 74ea5454cc2dee5cbd9c42e63cde8cb26f94beb9 Mon Sep 17 00:00:00 2001 From: Alex Ringlein Date: Thu, 16 Feb 2023 22:38:35 -0500 Subject: * src/base/ftoutln.c (FT_Outline_Reverse): Anchor first contour points. A cubic contour has to always start from an on-point. Therefore, we should not swap the first with the last point, which might be off, and obtain an invalid contour. This does not matter for conic contours. If anything, it also saves one swap there. Fixes #1207. --- src/base/ftoutln.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/base/ftoutln.c b/src/base/ftoutln.c index 30ff21ff3..e7ae82e21 100644 --- a/src/base/ftoutln.c +++ b/src/base/ftoutln.c @@ -556,6 +556,10 @@ { last = outline->contours[n]; + /* keep the first contour point as is and swap points around it */ + /* to guarantee that the cubic arches stay valid after reverse */ + first++; + /* reverse point table */ { FT_Vector* p = outline->points + first; -- cgit v1.2.3 From bbfcd79eacb4985d4b68783565f4b494aa64516b Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Fri, 17 Feb 2023 04:22:24 +0000 Subject: [truetype] Hide Infinality. Remove Infinality as an option before its complete extraction. * include/freetype/ftoption.h: Remove the Infinality option. * devel/ftoption.h: Ditto. * include/freetype/ftdriver.h (TT_INTERPRETER_VERSION_38): Is 40 now. --- devel/ftoption.h | 47 ++++++-------------------------------- include/freetype/config/ftoption.h | 47 ++++++-------------------------------- include/freetype/ftdriver.h | 9 +++----- 3 files changed, 17 insertions(+), 86 deletions(-) diff --git a/devel/ftoption.h b/devel/ftoption.h index 1ae9b1aed..da56abc5a 100644 --- a/devel/ftoption.h +++ b/devel/ftoption.h @@ -661,36 +661,12 @@ FT_BEGIN_HEADER * not) instructions in a certain way so that all TrueType fonts look like * they do in a Windows ClearType (DirectWrite) environment. See [1] for a * technical overview on what this means. See `ttinterp.h` for more - * details on the LEAN option. + * details on this option. * - * There are three possible values. - * - * Value 1: - * This value is associated with the 'Infinality' moniker, contributed by - * an individual nicknamed Infinality with the goal of making TrueType - * fonts render better than on Windows. A high amount of configurability - * and flexibility, down to rules for single glyphs in fonts, but also - * very slow. Its experimental and slow nature and the original - * developer losing interest meant that this option was never enabled in - * default builds. - * - * The corresponding interpreter version is v38. - * - * Value 2: - * The new default mode for the TrueType driver. The Infinality code - * base was stripped to the bare minimum and all configurability removed - * in the name of speed and simplicity. The configurability was mainly - * aimed at legacy fonts like 'Arial', 'Times New Roman', or 'Courier'. - * Legacy fonts are fonts that modify vertical stems to achieve clean - * black-and-white bitmaps. The new mode focuses on applying a minimal - * set of rules to all fonts indiscriminately so that modern and web - * fonts render well while legacy fonts render okay. - * - * The corresponding interpreter version is v40. - * - * Value 3: - * Compile both, making both v38 and v40 available (the latter is the - * default). + * The new default mode focuses on applying a minimal set of rules to all + * fonts indiscriminately so that modern and web fonts render well while + * legacy fonts render okay. The corresponding interpreter version is v40. + * The so-called Infinality mode (v38) is no longer available in FreeType. * * By undefining these, you get rendering behavior like on Windows without * ClearType, i.e., Windows XP without ClearType enabled and Win9x @@ -705,9 +681,7 @@ FT_BEGIN_HEADER * [1] * https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx */ -/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 1 */ -/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 2 */ -#define TT_CONFIG_OPTION_SUBPIXEL_HINTING ( 1 | 2 ) +#define TT_CONFIG_OPTION_SUBPIXEL_HINTING /************************************************************************** @@ -977,21 +951,14 @@ FT_BEGIN_HEADER /* - * The next three macros are defined if native TrueType hinting is + * The next two macros are defined if native TrueType hinting is * requested by the definitions above. Don't change this. */ #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 - -#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 9e03e1783..1976b33af 100644 --- a/include/freetype/config/ftoption.h +++ b/include/freetype/config/ftoption.h @@ -661,36 +661,12 @@ FT_BEGIN_HEADER * not) instructions in a certain way so that all TrueType fonts look like * they do in a Windows ClearType (DirectWrite) environment. See [1] for a * technical overview on what this means. See `ttinterp.h` for more - * details on the LEAN option. + * details on this option. * - * There are three possible values. - * - * Value 1: - * This value is associated with the 'Infinality' moniker, contributed by - * an individual nicknamed Infinality with the goal of making TrueType - * fonts render better than on Windows. A high amount of configurability - * and flexibility, down to rules for single glyphs in fonts, but also - * very slow. Its experimental and slow nature and the original - * developer losing interest meant that this option was never enabled in - * default builds. - * - * The corresponding interpreter version is v38. - * - * Value 2: - * The new default mode for the TrueType driver. The Infinality code - * base was stripped to the bare minimum and all configurability removed - * in the name of speed and simplicity. The configurability was mainly - * aimed at legacy fonts like 'Arial', 'Times New Roman', or 'Courier'. - * Legacy fonts are fonts that modify vertical stems to achieve clean - * black-and-white bitmaps. The new mode focuses on applying a minimal - * set of rules to all fonts indiscriminately so that modern and web - * fonts render well while legacy fonts render okay. - * - * The corresponding interpreter version is v40. - * - * Value 3: - * Compile both, making both v38 and v40 available (the latter is the - * default). + * The new default mode focuses on applying a minimal set of rules to all + * fonts indiscriminately so that modern and web fonts render well while + * legacy fonts render okay. The corresponding interpreter version is v40. + * The so-called Infinality mode (v38) is no longer available in FreeType. * * By undefining these, you get rendering behavior like on Windows without * ClearType, i.e., Windows XP without ClearType enabled and Win9x @@ -705,9 +681,7 @@ FT_BEGIN_HEADER * [1] * https://www.microsoft.com/typography/cleartype/truetypecleartype.aspx */ -/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING 1 */ -#define TT_CONFIG_OPTION_SUBPIXEL_HINTING 2 -/* #define TT_CONFIG_OPTION_SUBPIXEL_HINTING ( 1 | 2 ) */ +#define TT_CONFIG_OPTION_SUBPIXEL_HINTING /************************************************************************** @@ -977,21 +951,14 @@ FT_BEGIN_HEADER /* - * The next three macros are defined if native TrueType hinting is + * The next two macros are defined if native TrueType hinting is * requested by the definitions above. Don't change this. */ #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 - -#if TT_CONFIG_OPTION_SUBPIXEL_HINTING & 2 #define TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL #endif -#endif #endif diff --git a/include/freetype/ftdriver.h b/include/freetype/ftdriver.h index f90946fd1..4ed8b59d7 100644 --- a/include/freetype/ftdriver.h +++ b/include/freetype/ftdriver.h @@ -651,11 +651,8 @@ FT_BEGIN_HEADER * 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. + * Version~38 is the same Version~40. The original 'Infinality' code is + * no longer available. * * TT_INTERPRETER_VERSION_40 :: * Version~40 corresponds to MS rasterizer v.2.1; it is roughly @@ -760,7 +757,7 @@ FT_BEGIN_HEADER * */ #define TT_INTERPRETER_VERSION_35 35 -#define TT_INTERPRETER_VERSION_38 38 +#define TT_INTERPRETER_VERSION_38 40 #define TT_INTERPRETER_VERSION_40 40 -- cgit v1.2.3 From 713580f41dcc2054d7fa56265f03eeb9c67e0937 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Mon, 20 Feb 2023 15:58:04 +0000 Subject: * src/base/ftoutln.c (FT_Outline_Check): Update error code, clean up. --- src/base/ftoutln.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/base/ftoutln.c b/src/base/ftoutln.c index e7ae82e21..c1f8ed7e4 100644 --- a/src/base/ftoutln.c +++ b/src/base/ftoutln.c @@ -368,7 +368,7 @@ if ( n_points <= 0 || n_contours <= 0 ) goto Bad; - end0 = end = -1; + end0 = -1; for ( n = 0; n < n_contours; n++ ) { end = outline->contours[n]; @@ -388,7 +388,7 @@ } Bad: - return FT_THROW( Invalid_Argument ); + return FT_THROW( Invalid_Outline ); } -- cgit v1.2.3 From 34ed28d0fbf0552e0c0106007585e27fd163bf36 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Mon, 20 Feb 2023 16:33:45 +0000 Subject: [base] Clean up contour indexing. * src/base/ftoutln.c (FT_Outline_Reverse, FT_Outline_EmboldenXY, FT_Outline_Get_Orientation): Set the first and last indexes together. (FT_Outline_Decompose): Ditto and check them more stringently. * src/smooth/ftgrays.c (FT_Outline_Decompose)[STANDALONE_]: Ditto. --- src/base/ftoutln.c | 48 ++++++++++++++++++++---------------------------- src/smooth/ftgrays.c | 17 ++++++++--------- 2 files changed, 28 insertions(+), 37 deletions(-) diff --git a/src/base/ftoutln.c b/src/base/ftoutln.c index c1f8ed7e4..60ee8a6f3 100644 --- a/src/base/ftoutln.c +++ b/src/base/ftoutln.c @@ -58,7 +58,9 @@ FT_Error error; FT_Int n; /* index of contour in outline */ - FT_UInt first; /* index of first point in contour */ + FT_Int first; /* index of first point in contour */ + FT_Int last; /* index of last point in contour */ + FT_Int tag; /* current point's state */ FT_Int shift; @@ -73,18 +75,17 @@ shift = func_interface->shift; delta = func_interface->delta; - first = 0; + last = -1; for ( n = 0; n < outline->n_contours; n++ ) { - FT_Int last; /* index of last point in contour */ - - - FT_TRACE5(( "FT_Outline_Decompose: Outline %d\n", n )); + FT_TRACE5(( "FT_Outline_Decompose: Contour %d\n", n )); - last = outline->contours[n]; - if ( last < 0 ) + first = last + 1; + last = outline->contours[n]; + if ( last < first ) goto Invalid_Outline; + limit = outline->points + last; v_start = outline->points[first]; @@ -282,8 +283,6 @@ Close: if ( error ) goto Exit; - - first = (FT_UInt)last + 1; } FT_TRACE5(( "FT_Outline_Decompose: Done\n" )); @@ -550,15 +549,13 @@ if ( !outline ) return; - first = 0; - + last = -1; for ( n = 0; n < outline->n_contours; n++ ) { - last = outline->contours[n]; - /* keep the first contour point as is and swap points around it */ /* to guarantee that the cubic arches stay valid after reverse */ - first++; + first = last + 2; + last = outline->contours[n]; /* reverse point table */ { @@ -595,8 +592,6 @@ q--; } } - - first = last + 1; } outline->flags ^= FT_OUTLINE_REVERSE_FILL; @@ -945,7 +940,7 @@ points = outline->points; - first = 0; + last = -1; for ( c = 0; c < outline->n_contours; c++ ) { FT_Vector in, out, anchor, shift; @@ -953,8 +948,9 @@ FT_Int i, j, k; - l_in = 0; - last = outline->contours[c]; + first = last + 1; + last = outline->contours[c]; + l_in = 0; /* pacify compiler */ in.x = in.y = anchor.x = anchor.y = 0; @@ -1041,8 +1037,6 @@ in = out; l_in = l_out; } - - first = last + 1; } return FT_Err_Ok; @@ -1058,7 +1052,7 @@ FT_Int xshift, yshift; FT_Vector* points; FT_Vector v_prev, v_cur; - FT_Int c, n, first; + FT_Int c, n, first, last; FT_Pos area = 0; @@ -1090,11 +1084,11 @@ points = outline->points; - first = 0; + last = -1; for ( c = 0; c < outline->n_contours; c++ ) { - FT_Int last = outline->contours[c]; - + first = last + 1; + last = outline->contours[c]; v_prev.x = points[last].x >> xshift; v_prev.y = points[last].y >> yshift; @@ -1110,8 +1104,6 @@ v_prev = v_cur; } - - first = last + 1; } if ( area > 0 ) diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c index d9f20eef1..05478f41c 100644 --- a/src/smooth/ftgrays.c +++ b/src/smooth/ftgrays.c @@ -1666,6 +1666,8 @@ typedef ptrdiff_t FT_PtrDist; int n; /* index of contour in outline */ int first; /* index of first point in contour */ + int last; /* index of last point in contour */ + char tag; /* current point's state */ int shift; @@ -1680,18 +1682,17 @@ typedef ptrdiff_t FT_PtrDist; shift = func_interface->shift; delta = func_interface->delta; - first = 0; + last = -1; for ( n = 0; n < outline->n_contours; n++ ) { - int last; /* index of last point in contour */ - - - FT_TRACE5(( "FT_Outline_Decompose: Outline %d\n", n )); + FT_TRACE5(( "FT_Outline_Decompose: Contour %d\n", n )); + first = last + 1; last = outline->contours[n]; - if ( last < 0 ) + if ( last < first ) goto Invalid_Outline; + limit = outline->points + last; v_start = outline->points[first]; @@ -1874,11 +1875,9 @@ typedef ptrdiff_t FT_PtrDist; v_start.x / 64.0, v_start.y / 64.0 )); error = func_interface->line_to( &v_start, user ); - Close: + Close: if ( error ) goto Exit; - - first = last + 1; } FT_TRACE5(( "FT_Outline_Decompose: Done\n", n )); -- cgit v1.2.3 From fecd19b449c5b8a5a3a935466df1e5a9c5bcc0bd Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Mon, 20 Feb 2023 17:13:40 +0000 Subject: * src/base/ftstroke.c (FT_Stroker_ParseOutline): Clean up contour indexing. --- src/base/ftstroke.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/base/ftstroke.c b/src/base/ftstroke.c index db358e772..92f1e4308 100644 --- a/src/base/ftstroke.c +++ b/src/base/ftstroke.c @@ -2055,7 +2055,9 @@ FT_Error error; FT_Int n; /* index of contour in outline */ - FT_UInt first; /* index of first point in contour */ + FT_Int first; /* index of first point in contour */ + FT_Int last; /* index of last point in contour */ + FT_Int tag; /* current point's state */ @@ -2067,22 +2069,17 @@ FT_Stroker_Rewind( stroker ); - first = 0; - + last = -1; for ( n = 0; n < outline->n_contours; n++ ) { - FT_UInt last; /* index of last point in contour */ - - - last = (FT_UInt)outline->contours[n]; - limit = outline->points + last; + first = last + 1; + last = outline->contours[n]; /* skip empty points; we don't stroke these */ if ( last <= first ) - { - first = last + 1; continue; - } + + limit = outline->points + last; v_start = outline->points[first]; v_last = outline->points[last]; @@ -2231,8 +2228,6 @@ if ( error ) goto Exit; } - - first = last + 1; } return FT_Err_Ok; -- cgit v1.2.3 From f5f969a8fe230a5355b62ebea45c91acf83e7645 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Mon, 20 Feb 2023 22:29:18 -0500 Subject: * src/sdf/ftsdf.c (get_min_distance_cubic): Fix C4701, typos. --- src/sdf/ftsdf.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/sdf/ftsdf.c b/src/sdf/ftsdf.c index 26a6d00e4..d8479af10 100644 --- a/src/sdf/ftsdf.c +++ b/src/sdf/ftsdf.c @@ -2375,7 +2375,7 @@ * 90~degrees with the curve. We solve this with the Newton-Raphson * method. * - * (7) We first assume an arbitary value of factor `t`, which we then + * (7) We first assume an arbitrary value of factor `t`, which we then * improve. * * ``` @@ -2688,7 +2688,7 @@ * 90~degree with curve. We solve this with the Newton-Raphson * method. * - * (7) We first assume an arbitary value of factor `t`, which we then + * (7) We first assume an arbitrary value of factor `t`, which we then * improve. * * ``` @@ -2718,8 +2718,9 @@ FT_Error error = FT_Err_Ok; - FT_26D6_Vec aA, bB, cC, dD; /* A, B, C in the above comment */ - FT_16D16_Vec nearest_point; /* point on curve nearest to `point` */ + FT_26D6_Vec aA, bB, cC, dD; /* A, B, C, D in the above comment */ + FT_16D16_Vec nearest_point = { 0, 0 }; + /* point on curve nearest to `point` */ FT_16D16_Vec direction; /* direction of curve at `nearest_point` */ FT_26D6_Vec p0, p1, p2, p3; /* control points of a cubic curve */ -- cgit v1.2.3 From 78464d1b0ce056bb35ff6f987657030a09c3d6ee Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Mon, 20 Feb 2023 22:31:21 -0500 Subject: * src/base/ftoutln.c (FT_Outline_Check): Fix C4701 warning. --- src/base/ftoutln.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base/ftoutln.c b/src/base/ftoutln.c index 60ee8a6f3..134f39d2b 100644 --- a/src/base/ftoutln.c +++ b/src/base/ftoutln.c @@ -379,7 +379,7 @@ end0 = end; } - if ( end != n_points - 1 ) + if ( end0 != n_points - 1 ) goto Bad; /* XXX: check the tags array */ -- cgit v1.2.3 From 7f9499044e3baa901de99251a007aa66e750b26c Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Mon, 20 Feb 2023 23:29:58 -0500 Subject: [autofit] Clean up contour indexing. * src/autofit/aflatin.c (af_latin_metrics_init_blues): Refactor. * src/autofit/afcjk.c (af_cjk_metrics_init_blues): Ditto. --- src/autofit/afcjk.c | 12 +++++------- src/autofit/aflatin.c | 19 ++++++++----------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c index 5daefff35..7734d4e77 100644 --- a/src/autofit/afcjk.c +++ b/src/autofit/afcjk.c @@ -417,16 +417,14 @@ { FT_Int nn; - FT_Int first = 0; - FT_Int last = -1; + FT_Int pp, first, last; - for ( nn = 0; nn < outline.n_contours; first = last + 1, nn++ ) + last = -1; + for ( nn = 0; nn < outline.n_contours; nn++ ) { - FT_Int pp; - - - last = outline.contours[nn]; + first = last + 1; + last = outline.contours[nn]; /* Avoid single-point contours since they are never rasterized. */ /* In some fonts, they correspond to mark attachment points */ diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c index 4b3c59b3c..1082fee9a 100644 --- a/src/autofit/aflatin.c +++ b/src/autofit/aflatin.c @@ -496,23 +496,20 @@ /* now compute min or max point indices and coordinates */ points = outline.points; best_point = -1; + best_contour_first = -1; + best_contour_last = -1; best_y = 0; /* make compiler happy */ - best_contour_first = 0; /* ditto */ - best_contour_last = 0; /* ditto */ { FT_Int nn; - FT_Int first = 0; - FT_Int last = -1; + FT_Int pp, first, last; - for ( nn = 0; nn < outline.n_contours; first = last + 1, nn++ ) + last = -1; + for ( nn = 0; nn < outline.n_contours; nn++ ) { - FT_Int old_best_point = best_point; - FT_Int pp; - - - last = outline.contours[nn]; + first = last + 1; + last = outline.contours[nn]; /* Avoid single-point contours since they are never */ /* rasterized. In some fonts, they correspond to mark */ @@ -551,7 +548,7 @@ } } - if ( best_point != old_best_point ) + if ( best_point > best_contour_last ) { best_contour_first = first; best_contour_last = last; -- cgit v1.2.3 From 3f01161ff22c84c371b6dc3b5e0351e0d6e8e771 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Tue, 21 Feb 2023 16:17:07 +0000 Subject: [raster] Clean up contour indexing. * src/raster/ftraster.c (Decompose_Curve, Convert_Glyph): Use consistent index types (Int) and compact iterations. --- src/raster/ftraster.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/raster/ftraster.c b/src/raster/ftraster.c index 67cbfd5d9..59b27a408 100644 --- a/src/raster/ftraster.c +++ b/src/raster/ftraster.c @@ -1742,9 +1742,9 @@ * SUCCESS on success, FAILURE on error. */ static Bool - Decompose_Curve( RAS_ARGS UShort first, - UShort last, - Int flipped ) + Decompose_Curve( RAS_ARGS Int first, + Int last, + Int flipped ) { FT_Vector v_last; FT_Vector v_control; @@ -1969,8 +1969,8 @@ static Bool Convert_Glyph( RAS_ARGS Int flipped ) { - Int i; - UInt start; + Int i; + Int first, last; ras.fProfile = NULL; @@ -1985,8 +1985,7 @@ ras.cProfile->offset = ras.top; ras.num_Profs = 0; - start = 0; - + last = -1; for ( i = 0; i < ras.outline.n_contours; i++ ) { PProfile lastProfile; @@ -1996,12 +1995,11 @@ ras.state = Unknown_State; ras.gProfile = NULL; - if ( Decompose_Curve( RAS_VARS (UShort)start, - (UShort)ras.outline.contours[i], - flipped ) ) - return FAILURE; + first = last + 1; + last = ras.outline.contours[i]; - start = (UShort)ras.outline.contours[i] + 1; + if ( Decompose_Curve( RAS_VARS first, last, flipped ) ) + return FAILURE; /* we must now check whether the extreme arcs join or not */ if ( FRAC( ras.lastY ) == 0 && -- cgit v1.2.3 From 3f2ac7d890941b747794cbdbf9a08aa3ec667c3d Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Fri, 24 Feb 2023 11:48:48 -0500 Subject: * src/base/ftsystem.c (ft_ansi_stream_io): Avoid undefined behaviour. Also short-circuit on `offset` to avoid checking `count` a second time when `ft_ansi_stream_io` is used for reading. Per ISO/IEC 9899: If an argument to a function has an invalid value (such as a value outside the domain of the function, or a pointer outside the address space of the program, or a null pointer, or apointer to non-modifiable storage when the corresponding parameter is not const-qualified) or a type (after promotion) not expected by a function with variable number of arguments, the behavior is undefined. If a function argument is described as being an array, the pointer actually passed to the function shall have a value such that all address computations and accesses to objects (that would be valid if the pointer did point to the first element of such an array) are in fact valid. Per IEEE Std 1003.1: size_t fread(void *restrict ptr, size_t size, size_t nitems, FILE *restrict stream); The `fread` function shall read into the array pointed to by `ptr` up to `nitems` elements whose size is specified by `size` in bytes, from the stream pointed to by `stream`. Since the first argument to `fread` is described as being an array, its behavior is undefined when that argument is a null pointer. Per the documentation on `ft_ansi_stream_io`: If `count' is zero (this is, the function is used for seeking), a non-zero return value indicates an error. Thus the intent is clear, and the call to `fread` can be skipped, avoiding undefined behaviour. --- src/base/ftsystem.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/base/ftsystem.c b/src/base/ftsystem.c index fcd289d19..98c046b83 100644 --- a/src/base/ftsystem.c +++ b/src/base/ftsystem.c @@ -219,7 +219,7 @@ FT_FILE* file; - if ( !count && offset > stream->size ) + if ( offset > stream->size && !count ) return 1; file = STREAM_FILE( stream ); @@ -227,6 +227,11 @@ if ( stream->pos != offset ) ft_fseek( file, (long)offset, SEEK_SET ); + /* Avoid calling `fread` with `buffer=NULL` and `count=0`, */ + /* which is undefined behaviour. */ + if ( !count ) + return 0; + return (unsigned long)ft_fread( buffer, 1, count, file ); } -- cgit v1.2.3 From 74c498a383ed1162d37c18f74cceb6db38916f14 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sat, 25 Feb 2023 11:02:21 -0500 Subject: * src/type1/t1load.c (T1_Get_MM_Var): Optimize array zeroing. --- src/type1/t1load.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/type1/t1load.c b/src/type1/t1load.c index 3ec9ffa16..371edf4c1 100644 --- a/src/type1/t1load.c +++ b/src/type1/t1load.c @@ -320,9 +320,9 @@ sizeof ( FT_UShort ) ); axis_size = mmaster.num_axis * sizeof ( FT_Var_Axis ); - if ( FT_ALLOC( mmvar, mmvar_size + - axis_flags_size + - axis_size ) ) + if ( FT_QALLOC( mmvar, mmvar_size + + axis_flags_size + + axis_size ) ) goto Exit; mmvar->num_axis = mmaster.num_axis; @@ -333,8 +333,7 @@ /* to make `FT_Get_Var_Axis_Flags' work: the function expects that the */ /* values directly follow the data of `FT_MM_Var' */ axis_flags = (FT_UShort*)( (char*)mmvar + mmvar_size ); - for ( i = 0; i < mmaster.num_axis; i++ ) - axis_flags[i] = 0; + FT_ARRAY_ZERO( axis_flags, mmaster.num_axis ); mmvar->axis = (FT_Var_Axis*)( (char*)axis_flags + axis_flags_size ); mmvar->namedstyle = NULL; -- cgit v1.2.3 From 6423ddb8a077c44ddf90e6b149c308a801a7bb78 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sat, 25 Feb 2023 21:54:21 -0500 Subject: * src/cff/cffload.c (cff_encoding_load): Optimize array zeroing. This is unnecessary for predefined standard and expert encodings. Even for custom encodings the arrays might be already zeroed when CFF_FontRec is created but we keep it just in case. --- src/cff/cffload.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/cff/cffload.c b/src/cff/cffload.c index 4b8c6e16c..be5fce21b 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -1650,13 +1650,6 @@ goto Exit; } - /* Zero out the code to gid/sid mappings. */ - for ( j = 0; j < 256; j++ ) - { - encoding->sids [j] = 0; - encoding->codes[j] = 0; - } - /* Note: The encoding table in a CFF font is indexed by glyph index; */ /* the first encoded glyph index is 1. Hence, we read the character */ /* code (`glyph_code') at index j and make the assignment: */ @@ -1671,6 +1664,10 @@ if ( offset > 1 ) { + /* Zero out the code to gid/sid mappings. */ + FT_ARRAY_ZERO( encoding->sids, 256 ); + FT_ARRAY_ZERO( encoding->codes, 256 ); + encoding->offset = base_offset + offset; /* we need to parse the table to determine its size */ -- cgit v1.2.3 From f19ab673273b33078904f53c29d1a1d837793213 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 26 Feb 2023 07:27:31 +0100 Subject: * configure: Don't hardcode `grep -E`. TeXLive still supports Solaris 5.10, where the system's `grep` doesn't accept the `-E` option. We thus introduce an `EGREP` variable that is set to either `grep -E` or `-egrep`. --- configure | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 75f8b7bb0..b30e5d475 100755 --- a/configure +++ b/configure @@ -15,10 +15,19 @@ rm -f config.mk builds/unix/unix-def.mk builds/unix/unix-cc.mk +if test -z "$EGREP"; then + if echo a | grep -E '(a|b)' >/dev/null 2>&1; then + EGREP="grep -E" + else + # if grep -E doesn't work, assume egrep does. + EGREP=egrep + fi +fi + # 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 | grep -E 'GNU|makepp'`" = x; then + if test "x`make -v 2>/dev/null | $EGREP 'GNU|makepp'`" = x; then MAKE=gmake else MAKE=make @@ -28,7 +37,7 @@ else MAKE=$GNUMAKE fi -if test "x`$MAKE -v 2>/dev/null | grep -E 'GNU|makepp'`" = x; then +if test "x`$MAKE -v 2>/dev/null | $EGREP 'GNU|makepp'`" = x; then echo "GNU make (>= 3.81) or makepp (>= 2.0) is required to build FreeType2." >&2 echo "Please try" >&2 echo >&2 -- cgit v1.2.3 From d399657f1ba6b4c6898317cd35c6934fe487ca62 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 26 Feb 2023 20:18:54 +0100 Subject: * src/*: Replace leading underscores with trailing ones in dummy variables. This is to avoid clang warnings. --- src/autofit/ft-hb.c | 2 +- src/base/ftdbgmem.c | 2 +- src/base/ftmac.c | 2 +- src/dlg/dlgwrap.c | 2 +- src/psaux/afmparse.c | 2 +- src/sfnt/pngshim.c | 2 +- src/sfnt/sfwoff.c | 2 +- src/sfnt/sfwoff2.c | 2 +- src/sfnt/ttbdf.c | 2 +- src/sfnt/ttcolr.c | 2 +- src/sfnt/ttcpal.c | 2 +- src/sfnt/ttpost.c | 2 +- src/sfnt/ttsbit.c | 2 +- src/sfnt/ttsvg.c | 2 +- src/sfnt/woff2tags.c | 2 +- src/truetype/ttgxvar.c | 2 +- src/truetype/ttinterp.c | 2 +- src/truetype/ttsubpix.c | 2 +- src/type1/t1afm.c | 2 +- 19 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/autofit/ft-hb.c b/src/autofit/ft-hb.c index 09a8401c4..71aee0455 100644 --- a/src/autofit/ft-hb.c +++ b/src/autofit/ft-hb.c @@ -108,7 +108,7 @@ hb_ft_font_create_ (FT_Face ft_face, #else /* !FT_CONFIG_OPTION_USE_HARFBUZZ */ /* ANSI C doesn't like empty source files */ -typedef int _ft_hb_dummy; +typedef int ft_hb_dummy_; #endif /* !FT_CONFIG_OPTION_USE_HARFBUZZ */ diff --git a/src/base/ftdbgmem.c b/src/base/ftdbgmem.c index 6730c4c8d..8fab50dd0 100644 --- a/src/base/ftdbgmem.c +++ b/src/base/ftdbgmem.c @@ -963,7 +963,7 @@ #else /* !FT_DEBUG_MEMORY */ /* ANSI C doesn't like empty source files */ - typedef int _debug_mem_dummy; + typedef int debug_mem_dummy_; #endif /* !FT_DEBUG_MEMORY */ diff --git a/src/base/ftmac.c b/src/base/ftmac.c index de34e834f..492d05538 100644 --- a/src/base/ftmac.c +++ b/src/base/ftmac.c @@ -1082,7 +1082,7 @@ #else /* !FT_MACINTOSH */ /* ANSI C doesn't like empty source files */ - typedef int _ft_mac_dummy; + typedef int ft_mac_dummy_; #endif /* !FT_MACINTOSH */ diff --git a/src/dlg/dlgwrap.c b/src/dlg/dlgwrap.c index 271241f0a..e9dc3410a 100644 --- a/src/dlg/dlgwrap.c +++ b/src/dlg/dlgwrap.c @@ -25,7 +25,7 @@ #include "dlg.c" #else /* ANSI C doesn't like empty source files */ - typedef int _dlg_dummy; + typedef int dlg_dummy_; #endif diff --git a/src/psaux/afmparse.c b/src/psaux/afmparse.c index 68f95698e..db08941de 100644 --- a/src/psaux/afmparse.c +++ b/src/psaux/afmparse.c @@ -1086,7 +1086,7 @@ #else /* T1_CONFIG_OPTION_NO_AFM */ /* ANSI C doesn't like empty source files */ - typedef int _afm_parse_dummy; + typedef int afm_parse_dummy_; #endif /* T1_CONFIG_OPTION_NO_AFM */ diff --git a/src/sfnt/pngshim.c b/src/sfnt/pngshim.c index 423b07b02..c7f8a290d 100644 --- a/src/sfnt/pngshim.c +++ b/src/sfnt/pngshim.c @@ -457,7 +457,7 @@ #else /* !(TT_CONFIG_OPTION_EMBEDDED_BITMAPS && FT_CONFIG_OPTION_USE_PNG) */ /* ANSI C doesn't like empty source files */ - typedef int _pngshim_dummy; + typedef int pngshim_dummy_; #endif /* !(TT_CONFIG_OPTION_EMBEDDED_BITMAPS && FT_CONFIG_OPTION_USE_PNG) */ diff --git a/src/sfnt/sfwoff.c b/src/sfnt/sfwoff.c index 9559bf342..7c0ce2205 100644 --- a/src/sfnt/sfwoff.c +++ b/src/sfnt/sfwoff.c @@ -426,7 +426,7 @@ #else /* !FT_CONFIG_OPTION_USE_ZLIB */ /* ANSI C doesn't like empty source files */ - typedef int _sfwoff_dummy; + typedef int sfwoff_dummy_; #endif /* !FT_CONFIG_OPTION_USE_ZLIB */ diff --git a/src/sfnt/sfwoff2.c b/src/sfnt/sfwoff2.c index 7a01977f8..49ad5cc81 100644 --- a/src/sfnt/sfwoff2.c +++ b/src/sfnt/sfwoff2.c @@ -2378,7 +2378,7 @@ #else /* !FT_CONFIG_OPTION_USE_BROTLI */ /* ANSI C doesn't like empty source files */ - typedef int _sfwoff2_dummy; + typedef int sfwoff2_dummy_; #endif /* !FT_CONFIG_OPTION_USE_BROTLI */ diff --git a/src/sfnt/ttbdf.c b/src/sfnt/ttbdf.c index 118f475e7..c4d0035ea 100644 --- a/src/sfnt/ttbdf.c +++ b/src/sfnt/ttbdf.c @@ -248,7 +248,7 @@ #else /* !TT_CONFIG_OPTION_BDF */ /* ANSI C doesn't like empty source files */ - typedef int _tt_bdf_dummy; + typedef int tt_bdf_dummy_; #endif /* !TT_CONFIG_OPTION_BDF */ diff --git a/src/sfnt/ttcolr.c b/src/sfnt/ttcolr.c index 5d98dcab8..057f9bd65 100644 --- a/src/sfnt/ttcolr.c +++ b/src/sfnt/ttcolr.c @@ -1914,7 +1914,7 @@ #else /* !TT_CONFIG_OPTION_COLOR_LAYERS */ /* ANSI C doesn't like empty source files */ - typedef int _tt_colr_dummy; + typedef int tt_colr_dummy_; #endif /* !TT_CONFIG_OPTION_COLOR_LAYERS */ diff --git a/src/sfnt/ttcpal.c b/src/sfnt/ttcpal.c index 4279bc0bd..46ae08596 100644 --- a/src/sfnt/ttcpal.c +++ b/src/sfnt/ttcpal.c @@ -303,7 +303,7 @@ #else /* !TT_CONFIG_OPTION_COLOR_LAYERS */ /* ANSI C doesn't like empty source files */ - typedef int _tt_cpal_dummy; + typedef int tt_cpal_dummy_; #endif /* !TT_CONFIG_OPTION_COLOR_LAYERS */ diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c index 0e17c6f34..d3ec757ee 100644 --- a/src/sfnt/ttpost.c +++ b/src/sfnt/ttpost.c @@ -558,7 +558,7 @@ #else /* !TT_CONFIG_OPTION_POSTSCRIPT_NAMES */ /* ANSI C doesn't like empty source files */ - typedef int _tt_post_dummy; + typedef int tt_post_dummy_; #endif /* !TT_CONFIG_OPTION_POSTSCRIPT_NAMES */ diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c index 3c0695513..03f90a628 100644 --- a/src/sfnt/ttsbit.c +++ b/src/sfnt/ttsbit.c @@ -1677,7 +1677,7 @@ #else /* !TT_CONFIG_OPTION_EMBEDDED_BITMAPS */ /* ANSI C doesn't like empty source files */ - typedef int _tt_sbit_dummy; + typedef int tt_sbit_dummy_; #endif /* !TT_CONFIG_OPTION_EMBEDDED_BITMAPS */ diff --git a/src/sfnt/ttsvg.c b/src/sfnt/ttsvg.c index c1bbb66b8..4461d483b 100644 --- a/src/sfnt/ttsvg.c +++ b/src/sfnt/ttsvg.c @@ -405,7 +405,7 @@ #else /* !FT_CONFIG_OPTION_SVG */ /* ANSI C doesn't like empty source files */ - typedef int _tt_svg_dummy; + typedef int tt_svg_dummy_; #endif /* !FT_CONFIG_OPTION_SVG */ diff --git a/src/sfnt/woff2tags.c b/src/sfnt/woff2tags.c index 7a0a351f0..eeedd9906 100644 --- a/src/sfnt/woff2tags.c +++ b/src/sfnt/woff2tags.c @@ -111,7 +111,7 @@ #else /* !FT_CONFIG_OPTION_USE_BROTLI */ /* ANSI C doesn't like empty source files */ - typedef int _woff2tags_dummy; + typedef int woff2tags_dummy_; #endif /* !FT_CONFIG_OPTION_USE_BROTLI */ diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 60a0095b6..20d27ee42 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -4565,7 +4565,7 @@ #else /* !TT_CONFIG_OPTION_GX_VAR_SUPPORT */ /* ANSI C doesn't like empty source files */ - typedef int _tt_gxvar_dummy; + typedef int tt_gxvar_dummy_; #endif /* !TT_CONFIG_OPTION_GX_VAR_SUPPORT */ diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index 4fcfaa3e4..69d01001f 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -8604,7 +8604,7 @@ #else /* !TT_USE_BYTECODE_INTERPRETER */ /* ANSI C doesn't like empty source files */ - typedef int _tt_interp_dummy; + typedef int tt_interp_dummy_; #endif /* !TT_USE_BYTECODE_INTERPRETER */ diff --git a/src/truetype/ttsubpix.c b/src/truetype/ttsubpix.c index d811beef0..aed4a1a27 100644 --- a/src/truetype/ttsubpix.c +++ b/src/truetype/ttsubpix.c @@ -1004,7 +1004,7 @@ /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY) */ /* ANSI C doesn't like empty source files */ - typedef int _tt_subpix_dummy; + typedef int tt_subpix_dummy_; #endif /* !(TT_USE_BYTECODE_INTERPRETER && */ /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY) */ diff --git a/src/type1/t1afm.c b/src/type1/t1afm.c index 787aa92c9..24ade045e 100644 --- a/src/type1/t1afm.c +++ b/src/type1/t1afm.c @@ -405,7 +405,7 @@ #else /* T1_CONFIG_OPTION_NO_AFM */ /* ANSI C doesn't like empty source files */ - typedef int _t1_afm_dummy; + typedef int t1_afm_dummy_; #endif /* T1_CONFIG_OPTION_NO_AFM */ -- cgit v1.2.3 From 2257f9abf6e12daf7c3e1bfe28fa88de85e45785 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 26 Feb 2023 20:23:43 +0100 Subject: * include/freetype/internal/compiler-macros.h (FALL_THROUGH): Update. This follows https://lists.gnu.org/archive/html/bug-gnulib/2023-02/msg00159.html --- include/freetype/internal/compiler-macros.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/freetype/internal/compiler-macros.h b/include/freetype/internal/compiler-macros.h index 7883317fe..9d69086f0 100644 --- a/include/freetype/internal/compiler-macros.h +++ b/include/freetype/internal/compiler-macros.h @@ -41,8 +41,11 @@ FT_BEGIN_HEADER # if ( defined( __STDC_VERSION__ ) && __STDC_VERSION__ > 201710L ) || \ ( defined( __cplusplus ) && __cplusplus > 201402L ) # define FALL_THROUGH [[__fallthrough__]] -# elif ( defined( __GNUC__ ) && __GNUC__ >= 7 ) || \ - ( defined( __clang__ ) && __clang_major__ >= 10 ) +# elif ( defined( __GNUC__ ) && __GNUC__ >= 7 ) || \ + ( defined( __clang__ ) && \ + ( defined( __apple_build_version__ ) \ + ? __apple_build_version__ >= 14000000 \ + : __clang_major__ >= 10 ) ) # define FALL_THROUGH __attribute__(( __fallthrough__ )) # else # define FALL_THROUGH ( (void)0 ) -- cgit v1.2.3 From 638df2fe32b847d565419fb9becd9f1dccf3429a Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Mon, 27 Feb 2023 21:54:23 -0500 Subject: [truetype] Treat 38 as 40 without Infinality. * include/freetype/ftdriver.h (TT_INTERPRETER_VERSION_38): Reinstate. * src/truetype/ttdriver.c (tt_property_set): Fallback from 38 to 40. --- include/freetype/ftdriver.h | 2 +- src/truetype/ttdriver.c | 22 ++++++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/include/freetype/ftdriver.h b/include/freetype/ftdriver.h index 4ed8b59d7..59804ab1a 100644 --- a/include/freetype/ftdriver.h +++ b/include/freetype/ftdriver.h @@ -757,7 +757,7 @@ FT_BEGIN_HEADER * */ #define TT_INTERPRETER_VERSION_35 35 -#define TT_INTERPRETER_VERSION_38 40 +#define TT_INTERPRETER_VERSION_38 38 #define TT_INTERPRETER_VERSION_40 40 diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c index 4bea63ef8..4e689e99a 100644 --- a/src/truetype/ttdriver.c +++ b/src/truetype/ttdriver.c @@ -93,17 +93,27 @@ interpreter_version = *iv; } - if ( interpreter_version == TT_INTERPRETER_VERSION_35 + switch ( interpreter_version ) + { + case TT_INTERPRETER_VERSION_35: + driver->interpreter_version = TT_INTERPRETER_VERSION_35; + break; + + case TT_INTERPRETER_VERSION_38: #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY - || interpreter_version == TT_INTERPRETER_VERSION_38 + driver->interpreter_version = TT_INTERPRETER_VERSION_38; + break; #endif + + case TT_INTERPRETER_VERSION_40: #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL - || interpreter_version == TT_INTERPRETER_VERSION_40 + driver->interpreter_version = TT_INTERPRETER_VERSION_40; + break; #endif - ) - driver->interpreter_version = interpreter_version; - else + + default: error = FT_ERR( Unimplemented_Feature ); + } return error; } -- cgit v1.2.3 From d874ffa96ccad7dd122cdc369a284d171e221809 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 1 Mar 2023 06:36:59 +0100 Subject: * include/freetype/internal/compiler-macros.h (FALL_THROUGH): Update. This follows https://lists.gnu.org/archive/html/bug-gnulib/2023-02/msg00200.html --- include/freetype/internal/compiler-macros.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/freetype/internal/compiler-macros.h b/include/freetype/internal/compiler-macros.h index 9d69086f0..6f6765097 100644 --- a/include/freetype/internal/compiler-macros.h +++ b/include/freetype/internal/compiler-macros.h @@ -44,7 +44,7 @@ FT_BEGIN_HEADER # elif ( defined( __GNUC__ ) && __GNUC__ >= 7 ) || \ ( defined( __clang__ ) && \ ( defined( __apple_build_version__ ) \ - ? __apple_build_version__ >= 14000000 \ + ? __apple_build_version__ >= 12000000 \ : __clang_major__ >= 10 ) ) # define FALL_THROUGH __attribute__(( __fallthrough__ )) # else -- cgit v1.2.3 From 79c8bd91100af8d1b8df82269815a95ca1e91ead Mon Sep 17 00:00:00 2001 From: ubawurinna Date: Wed, 1 Mar 2023 10:16:59 +0100 Subject: [gzip] Fix static linking. Without this patch, static linking with MS Visual Studio causes linking errors. * src/gzip/ftgzip.c: Set `ZEXPORT` to nothing and `ZEXTERN` to static for all compilers. --- src/gzip/ftgzip.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/gzip/ftgzip.c b/src/gzip/ftgzip.c index 48da6ff9c..ca6a2aabe 100644 --- a/src/gzip/ftgzip.c +++ b/src/gzip/ftgzip.c @@ -70,10 +70,9 @@ /* so that configuration with `FT_CONFIG_OPTION_SYSTEM_ZLIB' might */ /* include the wrong `zconf.h' file, leading to errors. */ -#if defined( __GNUC__ ) || defined( __clang__ ) #define ZEXPORT -#define ZEXTERN static -#endif + /* prevent zlib functions from being visible outside their object files */ +#define ZEXTERN static #define HAVE_MEMCPY 1 #define Z_SOLO 1 -- cgit v1.2.3 From e8931f8c56104786479de38adbe2c8bb7f49c822 Mon Sep 17 00:00:00 2001 From: ubawurinna Date: Wed, 1 Mar 2023 18:20:46 +0000 Subject: * src/gzip/README.freetype: Update version. --- src/gzip/README.freetype | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gzip/README.freetype b/src/gzip/README.freetype index e0c8ced18..76298b06b 100644 --- a/src/gzip/README.freetype +++ b/src/gzip/README.freetype @@ -1,7 +1,7 @@ Name: zlib Short Name: zlib URL: http://zlib.net/ -Version: 1.2.12 +Version: 1.2.13 License: see `zlib.h` Description: -- cgit v1.2.3 From e95e623471282b5fe3de6f33263757b6f125f0bd Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Thu, 2 Mar 2023 17:58:03 +0000 Subject: * src/cff/cffload.c (cff_subfont_load): Synonymous update. --- src/cff/cffload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cff/cffload.c b/src/cff/cffload.c index be5fce21b..f0e1977e2 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -2009,7 +2009,7 @@ /* Top and Font DICTs are not allowed to have blend operators. */ error = cff_parser_init( &parser, code, - &subfont->font_dict, + top, font->library, stackSize, 0, -- cgit v1.2.3 From 09b326fa2b3198e462fc75f98973981f23ec7382 Mon Sep 17 00:00:00 2001 From: Ben Wagner Date: Wed, 1 Mar 2023 12:19:17 -0500 Subject: Avoid strtol on non-null-terminated data. Technically, `strtol` can only be used with C strings terminated with `\0`. CID data is not generally null-terminated and often does not contain a `\0` if it is hex-encoded. AddressSanitizer with `ASAN_OPTIONS` containing `strict_string_checks=1` verifies this by using an adversarial `strtol` that always reads to the terminating `\0`. To avoid undefined behavior from `strtol` in `cid_parser_new`, use the parser to parse the tokens instead of attempting to parse them ad-hoc. This will internally use `PS_Conv_Strtol` to parse the integer, which respects the parser's limits and directly implements the PostScript parsing rules for integers. * src/cid/cidparse.c (cid_parser_new): Use the parser to parse the tokens. Fixes: https://bugs.chromium.org/p/chromium/issues/detail?id=1420329 --- src/cid/cidparse.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/cid/cidparse.c b/src/cid/cidparse.c index 16889db9b..171a88621 100644 --- a/src/cid/cidparse.c +++ b/src/cid/cidparse.c @@ -214,18 +214,24 @@ cur <= limit - STARTDATA_LEN && ft_strncmp( (char*)cur, STARTDATA, STARTDATA_LEN ) == 0 ) { - if ( ft_strncmp( (char*)arg1, "(Hex)", 5 ) == 0 ) - { - FT_Long tmp = ft_strtol( (const char *)arg2, NULL, 10 ); + T1_TokenRec type_token; + FT_Long binary_length; - if ( tmp < 0 ) + parser->root.cursor = arg1; + cid_parser_to_token( parser, &type_token ); + if ( type_token.limit - type_token.start == 5 && + ft_memcmp( (char*)type_token.start, "(Hex)", 5 ) == 0 ) + { + parser->root.cursor = arg2; + binary_length = cid_parser_to_int( parser ); + if ( binary_length < 0 ) { FT_ERROR(( "cid_parser_new: invalid length of hex data\n" )); error = FT_THROW( Invalid_File_Format ); } else - parser->binary_length = (FT_ULong)tmp; + parser->binary_length = (FT_ULong)binary_length; } goto Exit; -- cgit v1.2.3 From 5c37b6406258ec0d7ab64b8619c5ea2c19e3c69a Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Thu, 2 Mar 2023 20:53:21 +0000 Subject: * configure: Use `sed` instead of `grep`. This is more portable and consistent with `autogen.sh`. --- configure | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/configure b/configure index b30e5d475..d4315bd97 100755 --- a/configure +++ b/configure @@ -15,19 +15,10 @@ rm -f config.mk builds/unix/unix-def.mk builds/unix/unix-cc.mk -if test -z "$EGREP"; then - if echo a | grep -E '(a|b)' >/dev/null 2>&1; then - EGREP="grep -E" - else - # if grep -E doesn't work, assume egrep does. - EGREP=egrep - fi -fi - # 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 + if test "x`make -v 2>/dev/null | sed -n -e '/GNU/p' -e '/makepp/p'`" = x; then MAKE=gmake else MAKE=make @@ -37,7 +28,7 @@ else MAKE=$GNUMAKE fi -if test "x`$MAKE -v 2>/dev/null | $EGREP 'GNU|makepp'`" = x; then +if test "x`$MAKE -v 2>/dev/null | sed -n -e '/GNU/p' -e '/makepp/p'`" = x; then echo "GNU make (>= 3.81) or makepp (>= 2.0) is required to build FreeType2." >&2 echo "Please try" >&2 echo >&2 -- cgit v1.2.3 From 5ac6276af105f81252a461a92ef96ce0f3fd965d Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Fri, 3 Mar 2023 17:21:10 +0000 Subject: [cff,cid,type1] Shorten de-referencing. * src/cff/cffobjs.c (cff_clot_init): Use immediate library reference. * src/cid/cidobjs.c (cid_slot_init): Ditto. * src/type1/t1objs.c (T1_GlyphSlot_Init): Ditto. --- src/cff/cffobjs.c | 3 +-- src/cid/cidobjs.c | 3 +-- src/type1/t1objs.c | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index 40cd9bf91..edd274e14 100644 --- a/src/cff/cffobjs.c +++ b/src/cff/cffobjs.c @@ -381,8 +381,7 @@ FT_Module module; - module = FT_Get_Module( slot->face->driver->root.library, - "pshinter" ); + module = FT_Get_Module( slot->library, "pshinter" ); if ( module ) { T2_Hints_Funcs funcs; diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c index 06b2139a9..1fc121c00 100644 --- a/src/cid/cidobjs.c +++ b/src/cid/cidobjs.c @@ -69,8 +69,7 @@ FT_Module module; - module = FT_Get_Module( slot->face->driver->root.library, - "pshinter" ); + module = FT_Get_Module( slot->library, "pshinter" ); if ( module ) { T1_Hints_Funcs funcs; diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c index 1bb2f15f3..4a39da563 100644 --- a/src/type1/t1objs.c +++ b/src/type1/t1objs.c @@ -167,8 +167,7 @@ FT_Module module; - module = FT_Get_Module( slot->face->driver->root.library, - "pshinter" ); + module = FT_Get_Module( slot->library, "pshinter" ); if ( module ) { T1_Hints_Funcs funcs; -- cgit v1.2.3 From 2adef94f43a3d12be78453705e6705134370b6b8 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Fri, 3 Mar 2023 18:40:48 +0000 Subject: * src/cff/cffobjs.c (cff_size_get_globals_funcs): Shorten de-referencing. --- src/cff/cffobjs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index edd274e14..18bb0b37b 100644 --- a/src/cff/cffobjs.c +++ b/src/cff/cffobjs.c @@ -69,8 +69,8 @@ FT_Module module; - module = FT_Get_Module( size->root.face->driver->root.library, - "pshinter" ); + module = FT_Get_Module( font->library, "pshinter" ); + return ( module && pshinter && pshinter->get_globals_funcs ) ? pshinter->get_globals_funcs( module ) : 0; -- cgit v1.2.3 From 49eac0da0c2cfb99c63aff556855eaad3555170d Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Fri, 3 Mar 2023 22:10:50 -0500 Subject: [pfr] Shorten de-referencing. * src/pfr/pfrobjs.c (pfr_face_done, pfr_face_init): Use closer `memory`. * src/pfr/pfrgload.c (pfr_glyph_load_compound): Remove `loader`. --- src/pfr/pfrgload.c | 3 +-- src/pfr/pfrobjs.c | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/pfr/pfrgload.c b/src/pfr/pfrgload.c index 14f2ec377..48cf27ec8 100644 --- a/src/pfr/pfrgload.c +++ b/src/pfr/pfrgload.c @@ -560,8 +560,7 @@ FT_Byte* limit ) { FT_Error error = FT_Err_Ok; - FT_GlyphLoader loader = glyph->loader; - FT_Memory memory = loader->memory; + FT_Memory memory = glyph->loader->memory; PFR_SubGlyph subglyph; FT_UInt flags, i, count, org_count; FT_Int x_pos, y_pos; diff --git a/src/pfr/pfrobjs.c b/src/pfr/pfrobjs.c index 3db8f0a06..8ef17c663 100644 --- a/src/pfr/pfrobjs.c +++ b/src/pfr/pfrobjs.c @@ -50,14 +50,14 @@ if ( !face ) return; - memory = pfrface->driver->root.memory; + memory = pfrface->memory; /* we don't want dangling pointers */ pfrface->family_name = NULL; pfrface->style_name = NULL; /* finalize the physical font record */ - pfr_phy_font_done( &face->phy_font, FT_FACE_MEMORY( face ) ); + pfr_phy_font_done( &face->phy_font, memory ); /* no need to finalize the logical font or the header */ FT_FREE( pfrface->available_sizes ); @@ -214,7 +214,7 @@ FT_UInt n, count = phy_font->num_strikes; FT_Bitmap_Size* size; PFR_Strike strike; - FT_Memory memory = pfrface->stream->memory; + FT_Memory memory = pfrface->memory; if ( FT_QNEW_ARRAY( pfrface->available_sizes, count ) ) -- cgit v1.2.3 From 7ae20e55c98f973f75fa6205b89d975de07121e3 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Fri, 3 Mar 2023 22:41:09 -0500 Subject: * src/sfnt/sfobjs.c (sfnt_load_face): Shorten de-referencing. --- src/sfnt/sfobjs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c index e018934cc..6469da9ab 100644 --- a/src/sfnt/sfobjs.c +++ b/src/sfnt/sfobjs.c @@ -1221,7 +1221,7 @@ if ( count > 0 ) { - FT_Memory memory = face->root.stream->memory; + FT_Memory memory = face->root.memory; FT_UShort em_size = face->header.Units_Per_EM; FT_Short avgwidth = face->os2.xAvgCharWidth; FT_Size_Metrics metrics; -- cgit v1.2.3 From 29578f75c399f3922ba379eae29d85ee0a406cc0 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sat, 4 Mar 2023 13:39:27 +0000 Subject: * src/cff/cffobjs.c (cff_size_init): Synonymous change. --- src/cff/cffobjs.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index 18bb0b37b..3e94a283e 100644 --- a/src/cff/cffobjs.c +++ b/src/cff/cffobjs.c @@ -182,8 +182,7 @@ goto Exit; cff_make_private_dict( &font->top_font, &priv ); - error = funcs->create( cffsize->face->memory, &priv, - &internal->topfont ); + error = funcs->create( memory, &priv, &internal->topfont ); if ( error ) goto Exit; @@ -193,8 +192,7 @@ cff_make_private_dict( sub, &priv ); - error = funcs->create( cffsize->face->memory, &priv, - &internal->subfonts[i - 1] ); + error = funcs->create( memory, &priv, &internal->subfonts[i - 1] ); if ( error ) goto Exit; } -- cgit v1.2.3 From a2b8937d477d14729db704414be2ccbcc956e545 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sat, 4 Mar 2023 14:00:52 -0500 Subject: [cff] Clean up memory management in the old engine. * src/cff/cffparse.c (finalize_t2_strings): Fix NULL-dereferencing in the out-of-memory situation, use `FT_FREE`. (cff_parser_run): Use FreeType memory allocation macros and avoid uninitialized pointers. --- src/cff/cffparse.c | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c index e16206fd5..eaad8d50a 100644 --- a/src/cff/cffparse.c +++ b/src/cff/cffparse.c @@ -63,10 +63,7 @@ /* allocate the stack buffer */ if ( FT_QNEW_ARRAY( parser->stack, stackSize ) ) - { - FT_FREE( parser->stack ); goto Exit; - } parser->stackSize = stackSize; parser->top = parser->stack; /* empty stack */ @@ -82,13 +79,16 @@ void* data, void* user ) { - CFF_T2_String t2 = (CFF_T2_String)data; + FT_UNUSED( user ); + if ( data ) + { + CFF_T2_String t2 = (CFF_T2_String)data; - FT_UNUSED( user ); - memory->free( memory, t2->start ); - memory->free( memory, data ); + FT_FREE( t2->start ); + FT_FREE( data ); + } } #endif /* CFF_CONFIG_OPTION_OLD_ENGINE */ @@ -1309,18 +1309,13 @@ /* Now copy the stack data in the temporary decoder object, */ /* converting it back to charstring number representations */ /* (this is ugly, I know). */ - - node = (FT_ListNode)memory->alloc( memory, - sizeof ( FT_ListNodeRec ) ); - if ( !node ) - goto Out_Of_Memory_Error; + if ( FT_NEW( node ) ) + goto Exit; FT_List_Add( &parser->t2_strings, node ); - t2 = (CFF_T2_String)memory->alloc( memory, - sizeof ( CFF_T2_StringRec ) ); - if ( !t2 ) - goto Out_Of_Memory_Error; + if ( FT_NEW( t2 ) ) + goto Exit; node->data = t2; @@ -1329,9 +1324,8 @@ t2_size = 5 * ( decoder.top - decoder.stack ); - q = (FT_Byte*)memory->alloc( memory, t2_size ); - if ( !q ) - goto Out_Of_Memory_Error; + if ( FT_QALLOC( q, t2_size ) ) + goto Exit; t2->start = q; t2->limit = q + t2_size; @@ -1598,12 +1592,6 @@ Exit: return error; -#ifdef CFF_CONFIG_OPTION_OLD_ENGINE - Out_Of_Memory_Error: - error = FT_THROW( Out_Of_Memory ); - goto Exit; -#endif - Stack_Overflow: error = FT_THROW( Invalid_Argument ); goto Exit; -- cgit v1.2.3 From 51c1705477e997b03622de72cb3d2545301c51a1 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sat, 4 Mar 2023 23:32:50 -0500 Subject: * src/cff/cffparse.c (cff_parser_run): Fix variable type. --- src/cff/cffparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c index eaad8d50a..ba715c7e0 100644 --- a/src/cff/cffparse.c +++ b/src/cff/cffparse.c @@ -1267,7 +1267,7 @@ FT_Fixed* stack; FT_ListNode node; CFF_T2_String t2; - FT_Fixed t2_size; + FT_PtrDist t2_size; FT_Byte* q; -- cgit v1.2.3 From de6002203bbaa2da68b215cb6cfa076d7da167db Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sat, 4 Mar 2023 23:49:49 -0500 Subject: [cff] Clean up CharString number encoding. * src/cff/cffparser.c (cff_parser_run): Work with signed numbers. --- src/cff/cffparse.c | 67 +++++++++++++++--------------------------------------- 1 file changed, 18 insertions(+), 49 deletions(-) diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c index ba715c7e0..5a9d7489c 100644 --- a/src/cff/cffparse.c +++ b/src/cff/cffparse.c @@ -1334,8 +1334,7 @@ while ( stack < decoder.top ) { - FT_ULong num; - FT_Bool neg; + FT_Long num = *stack; if ( (FT_UInt)( parser->top - parser->stack ) >= parser->stackSize ) @@ -1343,65 +1342,35 @@ *parser->top++ = q; - if ( *stack < 0 ) - { - num = (FT_ULong)NEG_LONG( *stack ); - neg = 1; - } - else - { - num = (FT_ULong)*stack; - neg = 0; - } - if ( num & 0xFFFFU ) { - if ( neg ) - num = (FT_ULong)-num; - *q++ = 255; - *q++ = ( num & 0xFF000000U ) >> 24; - *q++ = ( num & 0x00FF0000U ) >> 16; - *q++ = ( num & 0x0000FF00U ) >> 8; - *q++ = num & 0x000000FFU; + *q++ = (FT_Byte)( ( num >> 24 ) & 0xFF ); + *q++ = (FT_Byte)( ( num >> 16 ) & 0xFF ); + *q++ = (FT_Byte)( ( num >> 8 ) & 0xFF ); + *q++ = (FT_Byte)( ( num ) & 0xFF ); } else { num >>= 16; - if ( neg ) + if ( -107 <= num && num <= 107 ) + *q++ = (FT_Byte)( num + 139 ); + else if ( 108 <= num && num <= 1131 ) { - if ( num <= 107 ) - *q++ = (FT_Byte)( 139 - num ); - else if ( num <= 1131 ) - { - *q++ = (FT_Byte)( ( ( num - 108 ) >> 8 ) + 251 ); - *q++ = (FT_Byte)( ( num - 108 ) & 0xFF ); - } - else - { - num = (FT_ULong)-num; - - *q++ = 28; - *q++ = (FT_Byte)( num >> 8 ); - *q++ = (FT_Byte)( num & 0xFF ); - } + *q++ = (FT_Byte)( ( ( num - 108 ) >> 8 ) + 247 ); + *q++ = (FT_Byte)( ( num - 108 ) & 0xFF ); + } + else if ( -1131 <= num && num <= -108 ) + { + *q++ = (FT_Byte)( ( ( 108 - num ) >> 8 ) + 251 ); + *q++ = (FT_Byte)( ( 108 - num ) & 0xFF ); } else { - if ( num <= 107 ) - *q++ = (FT_Byte)( num + 139 ); - else if ( num <= 1131 ) - { - *q++ = (FT_Byte)( ( ( num - 108 ) >> 8 ) + 247 ); - *q++ = (FT_Byte)( ( num - 108 ) & 0xFF ); - } - else - { - *q++ = 28; - *q++ = (FT_Byte)( num >> 8 ); - *q++ = (FT_Byte)( num & 0xFF ); - } + *q++ = 28; + *q++ = (FT_Byte)( num >> 8 ); + *q++ = (FT_Byte)( num & 0xFF ); } } -- cgit v1.2.3 From c4b5127b742cc9030c14f67ab545f5d1105523d2 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sun, 5 Mar 2023 00:31:58 -0500 Subject: * src/cff/cffparse.c (cff_parser_run): Thinko. --- src/cff/cffparse.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c index 5a9d7489c..7476aed8e 100644 --- a/src/cff/cffparse.c +++ b/src/cff/cffparse.c @@ -1363,8 +1363,8 @@ } else if ( -1131 <= num && num <= -108 ) { - *q++ = (FT_Byte)( ( ( 108 - num ) >> 8 ) + 251 ); - *q++ = (FT_Byte)( ( 108 - num ) & 0xFF ); + *q++ = (FT_Byte)( ( ( -num - 108 ) >> 8 ) + 251 ); + *q++ = (FT_Byte)( ( -num - 108) & 0xFF ); } else { -- cgit v1.2.3 From 70946f6dc6774fad2424bd8349a4e192cd4fd6fa Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sun, 5 Mar 2023 16:08:14 -0500 Subject: * builds/windows/vc2010/freetype.vcxproj: Suppress C4267 on _WIN64. This usually comes from `strlen` returning 64-bit `size_t`, which we often assign to 32-bit `FT_ULong` on Windows-64 (LLP64). --- builds/windows/vc2010/freetype.vcxproj | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/builds/windows/vc2010/freetype.vcxproj b/builds/windows/vc2010/freetype.vcxproj index 4c9e2b497..671d12450 100644 --- a/builds/windows/vc2010/freetype.vcxproj +++ b/builds/windows/vc2010/freetype.vcxproj @@ -168,7 +168,7 @@ Level4 ProgramDatabase Default - 4001 + 4001;4267 true $(OutDir)$(TargetName).pdb Disabled @@ -195,7 +195,7 @@ Level4 ProgramDatabase Default - 4001 + 4001;4267 true $(OutDir)$(TargetName).pdb Disabled @@ -248,7 +248,7 @@ Level4 ProgramDatabase Default - 4001 + 4001;4267 true $(OutDir)$(TargetName).pdb Disabled @@ -274,7 +274,7 @@ Level4 ProgramDatabase Default - 4001 + 4001;4267 true $(OutDir)$(TargetName).pdb Disabled @@ -328,7 +328,7 @@ true Level4 Default - 4001 + 4001;4267 true NotSet true @@ -356,7 +356,7 @@ true Level4 Default - 4001 + 4001;4267 true true @@ -409,7 +409,7 @@ true Level4 Default - 4001 + 4001;4267 true NotSet true @@ -435,7 +435,7 @@ true Level4 Default - 4001 + 4001;4267 true true -- cgit v1.2.3 From fc01e7dd6710efade138d41b832dcd3f5893e3f9 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sun, 5 Mar 2023 22:05:24 -0500 Subject: Fix a couple of MSVC warnings. * src/base/ftcalc.c (FT_MulAddFix): Add cast. * src/sfnt/ttcolr.c (tt_face_get_colorline_stops, read_paint): Ditto. --- src/base/ftcalc.c | 2 +- src/sfnt/ttcolr.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c index 13e74f335..997921883 100644 --- a/src/base/ftcalc.c +++ b/src/base/ftcalc.c @@ -1103,7 +1103,7 @@ for ( i = 0; i < count; ++i ) temp += (FT_Int64)s[i] * f[i]; - return ( temp + 0x8000 ) >> 16; + return (FT_Int32)( ( temp + 0x8000 ) >> 16 ); #else temp.hi = 0; temp.lo = 0; diff --git a/src/sfnt/ttcolr.c b/src/sfnt/ttcolr.c index 057f9bd65..69ccf0ee7 100644 --- a/src/sfnt/ttcolr.c +++ b/src/sfnt/ttcolr.c @@ -699,7 +699,7 @@ item_deltas ) ) return 0; - apaint->u.solid.color.alpha += item_deltas[0]; + apaint->u.solid.color.alpha += (FT_F2Dot14)item_deltas[0]; } #endif @@ -1646,7 +1646,7 @@ return 0; color_stop->stop_offset += F2DOT14_TO_FIXED( item_deltas[0] ); - color_stop->color.alpha += item_deltas[1]; + color_stop->color.alpha += (FT_F2Dot14)item_deltas[1]; } #else FT_UNUSED( var_index_base ); -- cgit v1.2.3 From b2a949062367f0b3c5eff2e71144547b09386298 Mon Sep 17 00:00:00 2001 From: David PROVENT Date: Mon, 6 Mar 2023 09:22:15 +0100 Subject: Added information about the zlib version update in the changelog --- docs/CHANGES | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/CHANGES b/docs/CHANGES index 3c6a8774b..85c154223 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -75,6 +75,10 @@ CHANGES BETWEEN 2.12.1 and 2.13.0 (2023-Feb-09) af_debug_hints_ ``` + - The internal zlib library was updated to version 1.2.13. Note, + however, that FreeType is *not* affected by CVE-2022-37434 since + it doesn't use the `inflateGetHeader` function. + ====================================================================== -- cgit v1.2.3 From de94e2cbfbbb65ad2242023b056a52a5427af9fc Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sun, 26 Feb 2023 08:07:08 -0500 Subject: [truetype] Simplify memory management. Instead of using `Update_Max`, switch to regular FreeType memory allocation macros, stop pre-allocating the glyph instruction arrays. * src/truetype/ttgload.c (TT_Load_Simple_Glyph, TT_Process_Composite_Glyph): Switch to regular memory allocation. * src/truetype/ttinterp.c (Update_Max): Removed. (TT_Load_Context): Reallocate stack and free old instructions. (Modify_CVT_Check, Ins_WS): Switch to regular memory allocation. * src/truetype/ttinterp.h (Update_Max): Removed. --- src/truetype/ttgload.c | 97 ++++++++++++++++++------------------------- src/truetype/ttinterp.c | 107 +++++++++++------------------------------------- src/truetype/ttinterp.h | 8 ---- 3 files changed, 64 insertions(+), 148 deletions(-) diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index d33bdad64..52f8ea8bc 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -437,7 +437,8 @@ if ( IS_HINTED( load->load_flags ) ) { - FT_ULong tmp; + TT_ExecContext exec = load->exec; + FT_Memory memory = exec->memory; /* check instructions size */ @@ -449,24 +450,19 @@ } /* we don't trust `maxSizeOfInstructions' in the `maxp' table */ - /* and thus update the bytecode array size by ourselves */ + /* and thus allocate the bytecode array size by ourselves */ + if ( n_ins ) + { + if ( FT_QNEW_ARRAY( exec->glyphIns, n_ins ) ) + return error; - tmp = load->exec->glyphSize; - error = Update_Max( load->exec->memory, - &tmp, - sizeof ( FT_Byte ), - (void*)&load->exec->glyphIns, - n_ins ); + FT_MEM_COPY( exec->glyphIns, p, (FT_Long)n_ins ); - load->exec->glyphSize = (FT_UInt)tmp; - if ( error ) - return error; - - load->glyph->control_len = n_ins; - load->glyph->control_data = load->exec->glyphIns; + exec->glyphSize = n_ins; - if ( n_ins ) - FT_MEM_COPY( load->exec->glyphIns, p, (FT_Long)n_ins ); + load->glyph->control_len = n_ins; + load->glyph->control_data = exec->glyphIns; + } } #endif /* TT_USE_BYTECODE_INTERPRETER */ @@ -1331,12 +1327,12 @@ FT_UInt start_contour ) { FT_Error error; - FT_Outline* outline; + FT_Outline* outline = &loader->gloader->base.outline; + FT_Stream stream = loader->stream; + FT_UShort n_ins; FT_UInt i; - outline = &loader->gloader->base.outline; - /* make room for phantom points */ error = FT_GLYPHLOADER_CHECK_POINTS( loader->gloader, outline->n_points + 4, @@ -1351,53 +1347,40 @@ #ifdef TT_USE_BYTECODE_INTERPRETER - { - FT_Stream stream = loader->stream; - FT_UShort n_ins, max_ins; - FT_ULong tmp; + /* TT_Load_Composite_Glyph only gives us the offset of instructions */ + /* so we read them here */ + if ( FT_STREAM_SEEK( loader->ins_pos ) || + FT_READ_USHORT( n_ins ) ) + return error; + FT_TRACE5(( " Instructions size = %hu\n", n_ins )); - /* TT_Load_Composite_Glyph only gives us the offset of instructions */ - /* so we read them here */ - if ( FT_STREAM_SEEK( loader->ins_pos ) || - FT_READ_USHORT( n_ins ) ) - return error; + if ( !n_ins ) + return FT_Err_Ok; - FT_TRACE5(( " Instructions size = %hu\n", n_ins )); - - /* check it */ - max_ins = loader->face->max_profile.maxSizeOfInstructions; - if ( n_ins > max_ins ) - { - /* don't trust `maxSizeOfInstructions'; */ - /* only do a rough safety check */ - if ( n_ins > loader->byte_len ) - { - FT_TRACE1(( "TT_Process_Composite_Glyph:" - " too many instructions (%hu) for glyph with length %u\n", - n_ins, loader->byte_len )); - return FT_THROW( Too_Many_Hints ); - } + /* don't trust `maxSizeOfInstructions'; */ + /* only do a rough safety check */ + if ( n_ins > loader->byte_len ) + { + FT_TRACE1(( "TT_Process_Composite_Glyph:" + " too many instructions (%hu) for glyph with length %u\n", + n_ins, loader->byte_len )); + return FT_THROW( Too_Many_Hints ); + } - tmp = loader->exec->glyphSize; - error = Update_Max( loader->exec->memory, - &tmp, - sizeof ( FT_Byte ), - (void*)&loader->exec->glyphIns, - n_ins ); + { + TT_ExecContext exec = loader->exec; + FT_Memory memory = exec->memory; - loader->exec->glyphSize = (FT_UShort)tmp; - if ( error ) - return error; - } - else if ( n_ins == 0 ) - return FT_Err_Ok; - if ( FT_STREAM_READ( loader->exec->glyphIns, n_ins ) ) + if ( FT_QNEW_ARRAY( exec->glyphIns, n_ins ) || + FT_STREAM_READ( exec->glyphIns, n_ins ) ) return error; - loader->glyph->control_data = loader->exec->glyphIns; + exec->glyphSize = n_ins; + loader->glyph->control_len = n_ins; + loader->glyph->control_data = exec->glyphIns; } #endif diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index 69d01001f..8cf66ebae 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -275,57 +275,6 @@ } - /************************************************************************** - * - * @Function: - * Update_Max - * - * @Description: - * Checks the size of a buffer and reallocates it if necessary. - * - * @Input: - * memory :: - * A handle to the parent memory object. - * - * multiplier :: - * The size in bytes of each element in the buffer. - * - * new_max :: - * The new capacity (size) of the buffer. - * - * @InOut: - * size :: - * The address of the buffer's current size expressed - * in elements. - * - * buff :: - * The address of the buffer base pointer. - * - * @Return: - * FreeType error code. 0 means success. - */ - FT_LOCAL_DEF( FT_Error ) - Update_Max( FT_Memory memory, - FT_ULong* size, - FT_ULong multiplier, - void* _pbuff, - FT_ULong new_max ) - { - FT_Error error; - void** pbuff = (void**)_pbuff; - - - if ( *size < new_max ) - { - if ( FT_QREALLOC( *pbuff, *size * multiplier, new_max * multiplier ) ) - return error; - *size = new_max; - } - - return FT_Err_Ok; - } - - /************************************************************************** * * @Function: @@ -359,9 +308,9 @@ TT_Size size ) { FT_Int i; - FT_ULong tmp; TT_MaxProfile* maxp; FT_Error error; + FT_Memory memory = exec->memory; exec->face = face; @@ -406,25 +355,15 @@ /* XXX: We reserve a little more elements on the stack to deal safely */ /* with broken fonts like arialbs, courbs, timesbs, etc. */ - tmp = (FT_ULong)exec->stackSize; - error = Update_Max( exec->memory, - &tmp, - sizeof ( FT_F26Dot6 ), - (void*)&exec->stack, - maxp->maxStackElements + 32 ); - exec->stackSize = (FT_Long)tmp; - if ( error ) + if ( FT_QRENEW_ARRAY( exec->stack, + exec->stackSize, + maxp->maxStackElements + 32 ) ) return error; + exec->stackSize = maxp->maxStackElements + 32; - tmp = (FT_ULong)exec->glyphSize; - error = Update_Max( exec->memory, - &tmp, - sizeof ( FT_Byte ), - (void*)&exec->glyphIns, - maxp->maxSizeOfInstructions ); - exec->glyphSize = (FT_UInt)tmp; - if ( error ) - return error; + /* free previous glyph code range */ + FT_FREE( exec->glyphIns ); + exec->glyphSize = 0; exec->pts.n_points = 0; exec->pts.n_contours = 0; @@ -1530,14 +1469,16 @@ if ( exc->iniRange == tt_coderange_glyph && exc->cvt != exc->glyfCvt ) { - exc->error = Update_Max( exc->memory, - &exc->glyfCvtSize, - sizeof ( FT_Long ), - (void*)&exc->glyfCvt, - exc->cvtSize ); - if ( exc->error ) + FT_Memory memory = exc->memory; + FT_Error error; + + + FT_MEM_QRENEW_ARRAY( exc->glyfCvt, exc->glyfCvtSize, exc->cvtSize ); + exc->error = error; + if ( error ) return; + exc->glyfCvtSize = exc->cvtSize; FT_ARRAY_COPY( exc->glyfCvt, exc->cvt, exc->glyfCvtSize ); exc->cvt = exc->glyfCvt; } @@ -3117,18 +3058,18 @@ if ( exc->iniRange == tt_coderange_glyph && exc->storage != exc->glyfStorage ) { - FT_ULong tmp = (FT_ULong)exc->glyfStoreSize; + FT_Memory memory = exc->memory; + FT_Error error; - exc->error = Update_Max( exc->memory, - &tmp, - sizeof ( FT_Long ), - (void*)&exc->glyfStorage, - exc->storeSize ); - exc->glyfStoreSize = (FT_UShort)tmp; - if ( exc->error ) + FT_MEM_QRENEW_ARRAY( exc->glyfStorage, + exc->glyfStoreSize, + exc->storeSize ); + exc->error = error; + if ( error ) return; + exc->glyfStoreSize = exc->storeSize; FT_ARRAY_COPY( exc->glyfStorage, exc->storage, exc->glyfStoreSize ); exc->storage = exc->glyfStorage; } diff --git a/src/truetype/ttinterp.h b/src/truetype/ttinterp.h index c54c053b2..891e2123c 100644 --- a/src/truetype/ttinterp.h +++ b/src/truetype/ttinterp.h @@ -460,14 +460,6 @@ FT_BEGIN_HEADER FT_LOCAL( void ) TT_Clear_CodeRange( TT_ExecContext exec, FT_Int range ); - - - FT_LOCAL( FT_Error ) - Update_Max( FT_Memory memory, - FT_ULong* size, - FT_ULong multiplier, - void* _pbuff, - FT_ULong new_max ); #endif /* TT_USE_BYTECODE_INTERPRETER */ -- cgit v1.2.3 From b36193d025b970a338f41b8ab15f010a428c345e Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Mon, 6 Mar 2023 22:41:17 -0500 Subject: * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Triage memory leak. This leak has been introduced in the previous commit and immediately detected: https://chromium-review.googlesource.com/c/chromium/src/+/4313202 --- src/truetype/ttgload.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index 52f8ea8bc..cca81b41c 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -453,6 +453,8 @@ /* and thus allocate the bytecode array size by ourselves */ if ( n_ins ) { + if ( exec->glyphSize ) + FT_FREE( exec->glyphIns ); if ( FT_QNEW_ARRAY( exec->glyphIns, n_ins ) ) return error; -- cgit v1.2.3 From b3250f367ade969357e3037deb3166a4e93a8179 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Mon, 6 Mar 2023 23:53:42 -0500 Subject: * src/truetype/ttgload.c (TT_Process_Composite_Glyph): Fix leak too. --- src/truetype/ttgload.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index cca81b41c..3998172cf 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -1375,6 +1375,8 @@ FT_Memory memory = exec->memory; + if ( exec->glyphSize ) + FT_FREE( exec->glyphIns ); if ( FT_QNEW_ARRAY( exec->glyphIns, n_ins ) || FT_STREAM_READ( exec->glyphIns, n_ins ) ) return error; -- cgit v1.2.3 From 72a8d652187b8bb82d7cee3abc63c9ac66909ffe Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 7 Mar 2023 07:14:36 +0100 Subject: * src/tools/apinames.c (panic): Accept variable number of arguments. --- src/tools/apinames.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/tools/apinames.c b/src/tools/apinames.c index 8a8b0822b..e1b085172 100644 --- a/src/tools/apinames.c +++ b/src/tools/apinames.c @@ -18,6 +18,7 @@ #include #include +#include #include #include @@ -41,9 +42,20 @@ typedef enum OutputFormat_ static void -panic( const char* message ) +panic( const char* fmt, + ... ) { - fprintf( stderr, "PANIC: %s\n", message ); + va_list ap; + + + fprintf( stderr, "PANIC: " ); + + va_start( ap, fmt ); + vfprintf( stderr, fmt, ap ); + va_end( ap ); + + fprintf( stderr, "\n" ); + exit(2); } -- cgit v1.2.3 From 092f9d9874756380240f91716aef5e67c66f437d Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 7 Mar 2023 07:28:32 +0100 Subject: [apinames] Fix VMS handling of overly long function names. Based on ideas from Jouk Jansen . * src/tools/vms_shorten_symbol.c: New file, taken from https://sourceforge.net/p/vms-ports/vmsshortsym/ci/default/tree/vms_shorten_symbol.c with some minor edits to allow compilation with C++ and being included in another source code file. * src/tools/apinames.c: Include `vms_shorten_symbol.c`. (PROGRAM_VERSION): Set to '0.5'. (names_dump) [OUTPUT_VMS_OPT]: Call `vms_shorten_symbol` to get unique function identifiers not longer than 31 characters. --- src/tools/apinames.c | 27 +++-- src/tools/vms_shorten_symbol.c | 250 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 270 insertions(+), 7 deletions(-) create mode 100644 src/tools/vms_shorten_symbol.c diff --git a/src/tools/apinames.c b/src/tools/apinames.c index e1b085172..8c395aea3 100644 --- a/src/tools/apinames.c +++ b/src/tools/apinames.c @@ -22,8 +22,10 @@ #include #include +#include "vms_shorten_symbol.c" + #define PROGRAM_NAME "apinames" -#define PROGRAM_VERSION "0.4" +#define PROGRAM_VERSION "0.5" #define LINEBUFF_SIZE 1024 @@ -214,12 +216,23 @@ names_dump( FILE* out, break; case OUTPUT_VMS_OPT: - fprintf( out, "GSMATCH=LEQUAL,2,0\n" - "CASE_SENSITIVE=YES\n" - "SYMBOL_VECTOR=(-\n" ); - for ( nn = 0; nn < num_names - 1; nn++ ) - fprintf( out, " %s=PROCEDURE,-\n", the_names[nn].name ); - fprintf( out, " %s=PROCEDURE)\n", the_names[num_names - 1].name ); + fprintf( out, "case_sensitive=YES\n" ); + + for ( nn = 0; nn < num_names; nn++ ) + { + char short_symbol[32]; + + + if ( vms_shorten_symbol( the_names[nn].name, short_symbol, 1 ) == -1 ) + panic( "could not shorten name '%s'", the_names[nn].name ); + fprintf( out, "symbol_vector = ( %s = PROCEDURE)\n", short_symbol ); + + strcat( the_names[nn].name , "64__" ); + + if ( vms_shorten_symbol( the_names[nn].name, short_symbol, 1 ) == -1 ) + panic( "could not shorten name '%s'", the_names[nn].name ); + fprintf( out, "symbol_vector = ( %s = PROCEDURE)\n", short_symbol ); + } break; diff --git a/src/tools/vms_shorten_symbol.c b/src/tools/vms_shorten_symbol.c new file mode 100644 index 000000000..81f2a7187 --- /dev/null +++ b/src/tools/vms_shorten_symbol.c @@ -0,0 +1,250 @@ +/* + * Copyright (c) 2010, 2017 Craig A. Berry + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +/* vms_shorten_symbol + * + * This program provides shortening of long symbols (> 31 characters) using the + * same mechanism as the OpenVMS C compiler. The basic procedure is to compute + * an AUTODIN II checksum of the entire symbol, encode the checksum in base32, + * and glue together a shortened symbol from the first 23 characters of the + * original symbol plus the encoded checksum appended. The output format is + * the same used in the name mangler database, stored by default in + * [.CXX_REPOSITORY]CXX$DEMANGLER_DB. + * + * To obtain the same result as CC/NAMES=SHORTENED, run like so: + * + * $ mcr []vms_shorten_symbol "Please_forgive_this_absurdly_long_symbol_name" + * PLEASE_FORGIVE_THIS_ABS1ARO4QU$Please_forgive_this_absurdly_long_symbol_name + * + * To obtain the same result as CC/NAMES=(SHORTENED,AS_IS), pass a non-zero + * value as the second argument, like so: + * + * $ mcr []vms_shorten_symbol "Please_forgive_this_absurdly_long_symbol_name" 1 + * Please_forgive_this_abs3rv8rnn$Please_forgive_this_absurdly_long_symbol_name + */ + +#include +#include +#include +#include + +#ifdef __VMS +#define UINT32 unsigned int +#else +#include +#define UINT32 uint32_t +#endif + +extern UINT32 crc32(const char *input_string); +extern int u32_to_base32(UINT32 input, char *output); +extern int vms_shorten_symbol(const char *symbol, char *shortened, char as_is_flag); + +/* + * This routine implements the AUTODIN II polynomial. + */ + +UINT32 +crc32(const char *input_string) +{ + +/* + * CRC code and data based partly on FreeBSD implementation, which + * notes: + * + * The crc32 functions and data was originally written by Spencer + * Garrett and was cleaned from the PostgreSQL source + * tree via the files contrib/ltree/crc32.[ch]. No license was + * included, therefore it is assumed that this code is public + * domain. Attribution still noted. + * + * (I think they mean "gleaned" not "cleaned".) + */ + + static const UINT32 autodin_ii_table[256] = { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, + 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, + 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, + 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, + 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, + 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, + 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, + 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, + 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, + 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, + 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, + 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, + 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, + 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, + 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, + 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, + 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, + 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, + 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, + 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, + 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, + 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, + 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, + 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, + 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, + 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, + 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, + 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, + 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, + 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, + 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, + 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, + 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, + 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, + 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, + 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, + 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, + 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, + 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, + 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, + 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d, + }; + + UINT32 crc = ~0U; + char *c; + for (c = (char *)input_string; *c; ++c) + crc = (crc >> 8) ^ autodin_ii_table[(crc ^ *c) & 0xff]; + return ~crc; +} + +/* + * This is the RFC2938 variant of base32, not RFC3548, Crockford's, or + * other newer variant. It produces an 8-byte encoded character string + * (plus trailing null) from a 32-bit integer input. + */ + +int +u32_to_base32(UINT32 input, char *output) +{ + static const char base32hex_table[32] = { + '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', + 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', + 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', + 'u', 'v' + }; + int i; + + /* + * Grab lowest 5 bits and look up conversion in table. Lather, rinse, + * repeat for a total of 7, 5-bit chunks to accommodate 32 bits of input. + */ + for (i = 0; i < 7; i++) { + output[6 - i] = base32hex_table[input & 0x1f]; + input >>= 5; /* position to look at next 5 */ + } + output[7] = '$'; /* It's DEC, so use '$' not '=' to pad. */ + output[8] = '\0'; + return 0; +} + +/* + * Take an input symbol name of arbitrary length and produce a symbol shortened + * to 31 characters. The shortened symbol consists of the first 23 characters + * of the original symbol plus the 8 characters of the encoded checksum. The + * third argument is a boolean indicating whether to emulate the compiler's + * /NAMES=AS_IS option. When false (the compiler's default), the shortened + * symbol will be upper cased. When the original symbol is 31 characters or + * fewer in length, no checksum will be appended and the original symbol is + * returned verbatim (though upper cased if the as_is_flag is false). + */ + +int +vms_shorten_symbol(const char *input_symbol, char *shortened, char as_is_flag) +{ + char b32str[9]; + UINT32 crc; + char *c, *symbol; + int symlen; + + symlen = strlen(input_symbol); + symbol = (char *)malloc(symlen + 1); + if (symbol == NULL) + return -1; + + strncpy(symbol, input_symbol, symlen); + symbol[symlen] = '\0'; + + if (!as_is_flag) { + for (c = symbol; *c; c++) + *c = toupper(*c); + } + + if (symlen <= 31) { + strncpy(shortened, symbol, symlen); + shortened[symlen] = '\0'; + free(symbol); + return 0; + } + + /* + * Compute the checksum on the whole symbol. + */ + + crc = crc32(symbol); + + /* The compiler does not use the inverted checksum, so we invert it + * back before encoding in base32. + */ + + if (u32_to_base32(~crc, (char *)&b32str) == -1) { + free(symbol); + return -1; + } + + if (!as_is_flag) { + for (c = (char *)&b32str; *c; c++) + *c = toupper(*c); + } + + sprintf(shortened, "%.23s%.8s", symbol, b32str); + shortened[31] = '\0'; + free(symbol); + return 0; +} + +#ifdef TEST_MAIN +int +main(int argc, char **argv) +{ + char short_symbol[32]; + char as_is_flag = 0; + + if (argc < 2) { + fprintf(stderr, "Usage: %s []\n", argv[0]); + exit(EXIT_FAILURE); + } + if (argc > 2) + as_is_flag = 1; + + if (vms_shorten_symbol(argv[1], (char *)&short_symbol, as_is_flag) == -1) { + fprintf(stderr, "Symbol shortening failed\n"); + exit(EXIT_FAILURE); + } + + printf("%s%s\n", (char *)&short_symbol, argv[1]); +} +#endif -- cgit v1.2.3 From d5c6b948acbce11f0c4bd1989d2e6261586279e3 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 7 Mar 2023 08:55:58 +0100 Subject: [gzip] File `infback.c` is not needed. * src/gzip/infback.c: Remove. * src/gzip/rules.mk (GZIP_DRV_SRCS): Updated. --- src/gzip/infback.c | 644 ----------------------------------------------------- src/gzip/rules.mk | 1 - 2 files changed, 645 deletions(-) delete mode 100644 src/gzip/infback.c diff --git a/src/gzip/infback.c b/src/gzip/infback.c deleted file mode 100644 index 264c14e0d..000000000 --- a/src/gzip/infback.c +++ /dev/null @@ -1,644 +0,0 @@ -/* infback.c -- inflate using a call-back interface - * Copyright (C) 1995-2022 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - This code is largely copied from inflate.c. Normally either infback.o or - inflate.o would be linked into an application--not both. The interface - with inffast.c is retained so that optimized assembler-coded versions of - inflate_fast() can be used with either inflate.c or infback.c. - */ - -#include "zutil.h" -#include "inftrees.h" -#include "inflate.h" -#include "inffast.h" - -/* function prototypes */ -local void fixedtables OF((struct inflate_state FAR *state)); - -/* - strm provides memory allocation functions in zalloc and zfree, or - Z_NULL to use the library memory allocation functions. - - windowBits is in the range 8..15, and window is a user-supplied - window and output buffer that is 2**windowBits bytes. - */ -int ZEXPORT inflateBackInit_( - z_streamp strm, - int windowBits, - unsigned char FAR *window, - const char *version, - int stream_size) -{ - struct inflate_state FAR *state; - - if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || - stream_size != (int)(sizeof(z_stream))) - return Z_VERSION_ERROR; - if (strm == Z_NULL || window == Z_NULL || - windowBits < 8 || windowBits > 15) - return Z_STREAM_ERROR; - strm->msg = Z_NULL; /* in case we return an error */ - if (strm->zalloc == (alloc_func)0) { -#ifdef Z_SOLO - return Z_STREAM_ERROR; -#else - strm->zalloc = zcalloc; - strm->opaque = (voidpf)0; -#endif - } - if (strm->zfree == (free_func)0) -#ifdef Z_SOLO - return Z_STREAM_ERROR; -#else - strm->zfree = zcfree; -#endif - state = (struct inflate_state FAR *)ZALLOC(strm, 1, - sizeof(struct inflate_state)); - if (state == Z_NULL) return Z_MEM_ERROR; - Tracev((stderr, "inflate: allocated\n")); - strm->state = (struct internal_state FAR *)state; - state->dmax = 32768U; - state->wbits = (uInt)windowBits; - state->wsize = 1U << windowBits; - state->window = window; - state->wnext = 0; - state->whave = 0; - state->sane = 1; - return Z_OK; -} - -/* - Return state with length and distance decoding tables and index sizes set to - fixed code decoding. Normally this returns fixed tables from inffixed.h. - If BUILDFIXED is defined, then instead this routine builds the tables the - first time it's called, and returns those tables the first time and - thereafter. This reduces the size of the code by about 2K bytes, in - exchange for a little execution time. However, BUILDFIXED should not be - used for threaded applications, since the rewriting of the tables and virgin - may not be thread-safe. - */ -local void fixedtables( - struct inflate_state FAR *state) -{ -#ifdef BUILDFIXED - static int virgin = 1; - static code *lenfix, *distfix; - static code fixed[544]; - - /* build fixed huffman tables if first call (may not be thread safe) */ - if (virgin) { - unsigned sym, bits; - static code *next; - - /* literal/length table */ - sym = 0; - while (sym < 144) state->lens[sym++] = 8; - while (sym < 256) state->lens[sym++] = 9; - while (sym < 280) state->lens[sym++] = 7; - while (sym < 288) state->lens[sym++] = 8; - next = fixed; - lenfix = next; - bits = 9; - inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); - - /* distance table */ - sym = 0; - while (sym < 32) state->lens[sym++] = 5; - distfix = next; - bits = 5; - inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); - - /* do this just once */ - virgin = 0; - } -#else /* !BUILDFIXED */ -# include "inffixed.h" -#endif /* BUILDFIXED */ - state->lencode = lenfix; - state->lenbits = 9; - state->distcode = distfix; - state->distbits = 5; -} - -/* Macros for inflateBack(): */ - -/* Load returned state from inflate_fast() */ -#define LOAD() \ - do { \ - put = strm->next_out; \ - left = strm->avail_out; \ - next = strm->next_in; \ - have = strm->avail_in; \ - hold = state->hold; \ - bits = state->bits; \ - } while (0) - -/* Set state from registers for inflate_fast() */ -#define RESTORE() \ - do { \ - strm->next_out = put; \ - strm->avail_out = left; \ - strm->next_in = next; \ - strm->avail_in = have; \ - state->hold = hold; \ - state->bits = bits; \ - } while (0) - -/* Clear the input bit accumulator */ -#define INITBITS() \ - do { \ - hold = 0; \ - bits = 0; \ - } while (0) - -/* Assure that some input is available. If input is requested, but denied, - then return a Z_BUF_ERROR from inflateBack(). */ -#define PULL() \ - do { \ - if (have == 0) { \ - have = in(in_desc, &next); \ - if (have == 0) { \ - next = Z_NULL; \ - ret = Z_BUF_ERROR; \ - goto inf_leave; \ - } \ - } \ - } while (0) - -/* Get a byte of input into the bit accumulator, or return from inflateBack() - with an error if there is no input available. */ -#define PULLBYTE() \ - do { \ - PULL(); \ - have--; \ - hold += (unsigned long)(*next++) << bits; \ - bits += 8; \ - } while (0) - -/* Assure that there are at least n bits in the bit accumulator. If there is - not enough available input to do that, then return from inflateBack() with - an error. */ -#define NEEDBITS(n) \ - do { \ - while (bits < (unsigned)(n)) \ - PULLBYTE(); \ - } while (0) - -/* Return the low n bits of the bit accumulator (n < 16) */ -#define BITS(n) \ - ((unsigned)hold & ((1U << (n)) - 1)) - -/* Remove n bits from the bit accumulator */ -#define DROPBITS(n) \ - do { \ - hold >>= (n); \ - bits -= (unsigned)(n); \ - } while (0) - -/* Remove zero to seven bits as needed to go to a byte boundary */ -#define BYTEBITS() \ - do { \ - hold >>= bits & 7; \ - bits -= bits & 7; \ - } while (0) - -/* Assure that some output space is available, by writing out the window - if it's full. If the write fails, return from inflateBack() with a - Z_BUF_ERROR. */ -#define ROOM() \ - do { \ - if (left == 0) { \ - put = state->window; \ - left = state->wsize; \ - state->whave = left; \ - if (out(out_desc, put, left)) { \ - ret = Z_BUF_ERROR; \ - goto inf_leave; \ - } \ - } \ - } while (0) - -/* - strm provides the memory allocation functions and window buffer on input, - and provides information on the unused input on return. For Z_DATA_ERROR - returns, strm will also provide an error message. - - in() and out() are the call-back input and output functions. When - inflateBack() needs more input, it calls in(). When inflateBack() has - filled the window with output, or when it completes with data in the - window, it calls out() to write out the data. The application must not - change the provided input until in() is called again or inflateBack() - returns. The application must not change the window/output buffer until - inflateBack() returns. - - in() and out() are called with a descriptor parameter provided in the - inflateBack() call. This parameter can be a structure that provides the - information required to do the read or write, as well as accumulated - information on the input and output such as totals and check values. - - in() should return zero on failure. out() should return non-zero on - failure. If either in() or out() fails, than inflateBack() returns a - Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it - was in() or out() that caused in the error. Otherwise, inflateBack() - returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format - error, or Z_MEM_ERROR if it could not allocate memory for the state. - inflateBack() can also return Z_STREAM_ERROR if the input parameters - are not correct, i.e. strm is Z_NULL or the state was not initialized. - */ -int ZEXPORT inflateBack( - z_streamp strm, - in_func in, - void FAR *in_desc, - out_func out, - void FAR *out_desc) -{ - struct inflate_state FAR *state; - z_const unsigned char FAR *next; /* next input */ - unsigned char FAR *put; /* next output */ - unsigned have, left; /* available input and output */ - unsigned long hold; /* bit buffer */ - unsigned bits; /* bits in bit buffer */ - unsigned copy; /* number of stored or match bytes to copy */ - unsigned char FAR *from; /* where to copy match bytes from */ - code here; /* current decoding table entry */ - code last; /* parent table entry */ - unsigned len; /* length to copy for repeats, bits to drop */ - int ret; /* return code */ - static const unsigned short order[19] = /* permutation of code lengths */ - {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; - - /* Check that the strm exists and that the state was initialized */ - if (strm == Z_NULL || strm->state == Z_NULL) - return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - - /* Reset the state */ - strm->msg = Z_NULL; - state->mode = TYPE; - state->last = 0; - state->whave = 0; - next = strm->next_in; - have = next != Z_NULL ? strm->avail_in : 0; - hold = 0; - bits = 0; - put = state->window; - left = state->wsize; - - /* Inflate until end of block marked as last */ - for (;;) - switch (state->mode) { - case TYPE: - /* determine and dispatch block type */ - if (state->last) { - BYTEBITS(); - state->mode = DONE; - break; - } - NEEDBITS(3); - state->last = BITS(1); - DROPBITS(1); - switch (BITS(2)) { - case 0: /* stored block */ - Tracev((stderr, "inflate: stored block%s\n", - state->last ? " (last)" : "")); - state->mode = STORED; - break; - case 1: /* fixed block */ - fixedtables(state); - Tracev((stderr, "inflate: fixed codes block%s\n", - state->last ? " (last)" : "")); - state->mode = LEN; /* decode codes */ - break; - case 2: /* dynamic block */ - Tracev((stderr, "inflate: dynamic codes block%s\n", - state->last ? " (last)" : "")); - state->mode = TABLE; - break; - case 3: - strm->msg = (char *)"invalid block type"; - state->mode = BAD; - } - DROPBITS(2); - break; - - case STORED: - /* get and verify stored block length */ - BYTEBITS(); /* go to byte boundary */ - NEEDBITS(32); - if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { - strm->msg = (char *)"invalid stored block lengths"; - state->mode = BAD; - break; - } - state->length = (unsigned)hold & 0xffff; - Tracev((stderr, "inflate: stored length %u\n", - state->length)); - INITBITS(); - - /* copy stored block from input to output */ - while (state->length != 0) { - copy = state->length; - PULL(); - ROOM(); - if (copy > have) copy = have; - if (copy > left) copy = left; - zmemcpy(put, next, copy); - have -= copy; - next += copy; - left -= copy; - put += copy; - state->length -= copy; - } - Tracev((stderr, "inflate: stored end\n")); - state->mode = TYPE; - break; - - case TABLE: - /* get dynamic table entries descriptor */ - NEEDBITS(14); - state->nlen = BITS(5) + 257; - DROPBITS(5); - state->ndist = BITS(5) + 1; - DROPBITS(5); - state->ncode = BITS(4) + 4; - DROPBITS(4); -#ifndef PKZIP_BUG_WORKAROUND - if (state->nlen > 286 || state->ndist > 30) { - strm->msg = (char *)"too many length or distance symbols"; - state->mode = BAD; - break; - } -#endif - Tracev((stderr, "inflate: table sizes ok\n")); - - /* get code length code lengths (not a typo) */ - state->have = 0; - while (state->have < state->ncode) { - NEEDBITS(3); - state->lens[order[state->have++]] = (unsigned short)BITS(3); - DROPBITS(3); - } - while (state->have < 19) - state->lens[order[state->have++]] = 0; - state->next = state->codes; - state->lencode = (code const FAR *)(state->next); - state->lenbits = 7; - ret = inflate_table(CODES, state->lens, 19, &(state->next), - &(state->lenbits), state->work); - if (ret) { - strm->msg = (char *)"invalid code lengths set"; - state->mode = BAD; - break; - } - Tracev((stderr, "inflate: code lengths ok\n")); - - /* get length and distance code code lengths */ - state->have = 0; - while (state->have < state->nlen + state->ndist) { - for (;;) { - here = state->lencode[BITS(state->lenbits)]; - if ((unsigned)(here.bits) <= bits) break; - PULLBYTE(); - } - if (here.val < 16) { - DROPBITS(here.bits); - state->lens[state->have++] = here.val; - } - else { - if (here.val == 16) { - NEEDBITS(here.bits + 2); - DROPBITS(here.bits); - if (state->have == 0) { - strm->msg = (char *)"invalid bit length repeat"; - state->mode = BAD; - break; - } - len = (unsigned)(state->lens[state->have - 1]); - copy = 3 + BITS(2); - DROPBITS(2); - } - else if (here.val == 17) { - NEEDBITS(here.bits + 3); - DROPBITS(here.bits); - len = 0; - copy = 3 + BITS(3); - DROPBITS(3); - } - else { - NEEDBITS(here.bits + 7); - DROPBITS(here.bits); - len = 0; - copy = 11 + BITS(7); - DROPBITS(7); - } - if (state->have + copy > state->nlen + state->ndist) { - strm->msg = (char *)"invalid bit length repeat"; - state->mode = BAD; - break; - } - while (copy--) - state->lens[state->have++] = (unsigned short)len; - } - } - - /* handle error breaks in while */ - if (state->mode == BAD) break; - - /* check for end-of-block code (better have one) */ - if (state->lens[256] == 0) { - strm->msg = (char *)"invalid code -- missing end-of-block"; - state->mode = BAD; - break; - } - - /* build code tables -- note: do not change the lenbits or distbits - values here (9 and 6) without reading the comments in inftrees.h - concerning the ENOUGH constants, which depend on those values */ - state->next = state->codes; - state->lencode = (code const FAR *)(state->next); - state->lenbits = 9; - ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), - &(state->lenbits), state->work); - if (ret) { - strm->msg = (char *)"invalid literal/lengths set"; - state->mode = BAD; - break; - } - state->distcode = (code const FAR *)(state->next); - state->distbits = 6; - ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, - &(state->next), &(state->distbits), state->work); - if (ret) { - strm->msg = (char *)"invalid distances set"; - state->mode = BAD; - break; - } - Tracev((stderr, "inflate: codes ok\n")); - state->mode = LEN; - /* fallthrough */ - - case LEN: - /* use inflate_fast() if we have enough input and output */ - if (have >= 6 && left >= 258) { - RESTORE(); - if (state->whave < state->wsize) - state->whave = state->wsize - left; - inflate_fast(strm, state->wsize); - LOAD(); - break; - } - - /* get a literal, length, or end-of-block code */ - for (;;) { - here = state->lencode[BITS(state->lenbits)]; - if ((unsigned)(here.bits) <= bits) break; - PULLBYTE(); - } - if (here.op && (here.op & 0xf0) == 0) { - last = here; - for (;;) { - here = state->lencode[last.val + - (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)(last.bits + here.bits) <= bits) break; - PULLBYTE(); - } - DROPBITS(last.bits); - } - DROPBITS(here.bits); - state->length = (unsigned)here.val; - - /* process literal */ - if (here.op == 0) { - Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? - "inflate: literal '%c'\n" : - "inflate: literal 0x%02x\n", here.val)); - ROOM(); - *put++ = (unsigned char)(state->length); - left--; - state->mode = LEN; - break; - } - - /* process end of block */ - if (here.op & 32) { - Tracevv((stderr, "inflate: end of block\n")); - state->mode = TYPE; - break; - } - - /* invalid code */ - if (here.op & 64) { - strm->msg = (char *)"invalid literal/length code"; - state->mode = BAD; - break; - } - - /* length code -- get extra bits, if any */ - state->extra = (unsigned)(here.op) & 15; - if (state->extra != 0) { - NEEDBITS(state->extra); - state->length += BITS(state->extra); - DROPBITS(state->extra); - } - Tracevv((stderr, "inflate: length %u\n", state->length)); - - /* get distance code */ - for (;;) { - here = state->distcode[BITS(state->distbits)]; - if ((unsigned)(here.bits) <= bits) break; - PULLBYTE(); - } - if ((here.op & 0xf0) == 0) { - last = here; - for (;;) { - here = state->distcode[last.val + - (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)(last.bits + here.bits) <= bits) break; - PULLBYTE(); - } - DROPBITS(last.bits); - } - DROPBITS(here.bits); - if (here.op & 64) { - strm->msg = (char *)"invalid distance code"; - state->mode = BAD; - break; - } - state->offset = (unsigned)here.val; - - /* get distance extra bits, if any */ - state->extra = (unsigned)(here.op) & 15; - if (state->extra != 0) { - NEEDBITS(state->extra); - state->offset += BITS(state->extra); - DROPBITS(state->extra); - } - if (state->offset > state->wsize - (state->whave < state->wsize ? - left : 0)) { - strm->msg = (char *)"invalid distance too far back"; - state->mode = BAD; - break; - } - Tracevv((stderr, "inflate: distance %u\n", state->offset)); - - /* copy match from window to output */ - do { - ROOM(); - copy = state->wsize - state->offset; - if (copy < left) { - from = put + copy; - copy = left - copy; - } - else { - from = put - state->offset; - copy = left; - } - if (copy > state->length) copy = state->length; - state->length -= copy; - left -= copy; - do { - *put++ = *from++; - } while (--copy); - } while (state->length != 0); - break; - - case DONE: - /* inflate stream terminated properly */ - ret = Z_STREAM_END; - goto inf_leave; - - case BAD: - ret = Z_DATA_ERROR; - goto inf_leave; - - default: - /* can't happen, but makes compilers happy */ - ret = Z_STREAM_ERROR; - goto inf_leave; - } - - /* Write leftover output and return unused input */ - inf_leave: - if (left < state->wsize) { - if (out(out_desc, state->window, state->wsize - left) && - ret == Z_STREAM_END) - ret = Z_BUF_ERROR; - } - strm->next_in = next; - strm->avail_in = have; - return ret; -} - -int ZEXPORT inflateBackEnd( - z_streamp strm) -{ - if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) - return Z_STREAM_ERROR; - ZFREE(strm, strm->state); - strm->state = Z_NULL; - Tracev((stderr, "inflate: end\n")); - return Z_OK; -} diff --git a/src/gzip/rules.mk b/src/gzip/rules.mk index 6feb6f51c..050e14705 100644 --- a/src/gzip/rules.mk +++ b/src/gzip/rules.mk @@ -43,7 +43,6 @@ GZIP_DRV_SRCS := $(GZIP_DIR)/adler32.c \ $(GZIP_DIR)/crc32.c \ $(GZIP_DIR)/crc32.h \ $(GZIP_DIR)/ftzconf.h \ - $(GZIP_DIR)/infback.c \ $(GZIP_DIR)/inffast.c \ $(GZIP_DIR)/inffast.h \ $(GZIP_DIR)/inffixed.h \ -- cgit v1.2.3 From bd6208b7126888826b1246bbe06c166afd177516 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 8 Mar 2023 10:49:42 +0100 Subject: apinames.c: Add comment. --- src/tools/apinames.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tools/apinames.c b/src/tools/apinames.c index 8c395aea3..dfa258fd7 100644 --- a/src/tools/apinames.c +++ b/src/tools/apinames.c @@ -227,8 +227,9 @@ names_dump( FILE* out, panic( "could not shorten name '%s'", the_names[nn].name ); fprintf( out, "symbol_vector = ( %s = PROCEDURE)\n", short_symbol ); + /* Also emit a 64-bit symbol, as created by the `vms_auto64` tool. */ + /* It has the string '64__' appended to its name. */ strcat( the_names[nn].name , "64__" ); - if ( vms_shorten_symbol( the_names[nn].name, short_symbol, 1 ) == -1 ) panic( "could not shorten name '%s'", the_names[nn].name ); fprintf( out, "symbol_vector = ( %s = PROCEDURE)\n", short_symbol ); -- cgit v1.2.3 From 49c74ac021f8139e83bbd65df75217d0de284eea Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Thu, 9 Mar 2023 22:37:03 -0500 Subject: * src/truetype/ttgload.c (TT_Hint_Glyph): Mostly cosmetic update. The number of instructions is now taken from the executed context. Technically, this means that `control_len` and `control_data` values are no longer _used_ internally but only expose them. --- src/truetype/ttgload.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index 3998172cf..5419fa028 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -834,15 +834,14 @@ TT_GlyphZone zone = &loader->zone; #ifdef TT_USE_BYTECODE_INTERPRETER - FT_Long n_ins; + TT_ExecContext exec = loader->exec; + FT_Long n_ins = exec->glyphSize; #else FT_UNUSED( is_composite ); #endif #ifdef TT_USE_BYTECODE_INTERPRETER - n_ins = loader->glyph->control_len; - /* save original point positions in `org' array */ if ( n_ins > 0 ) FT_ARRAY_COPY( zone->org, zone->cur, zone->n_points ); @@ -854,15 +853,15 @@ /* completely refer to the (already) hinted subglyphs. */ if ( is_composite ) { - loader->exec->metrics.x_scale = 1 << 16; - loader->exec->metrics.y_scale = 1 << 16; + exec->metrics.x_scale = 1 << 16; + exec->metrics.y_scale = 1 << 16; FT_ARRAY_COPY( zone->orus, zone->cur, zone->n_points ); } else { - loader->exec->metrics.x_scale = loader->size->metrics->x_scale; - loader->exec->metrics.y_scale = loader->size->metrics->y_scale; + exec->metrics.x_scale = loader->size->metrics->x_scale; + exec->metrics.y_scale = loader->size->metrics->y_scale; } #endif @@ -886,19 +885,18 @@ FT_Outline current_outline = gloader->current.outline; - TT_Set_CodeRange( loader->exec, tt_coderange_glyph, - loader->exec->glyphIns, n_ins ); + TT_Set_CodeRange( exec, tt_coderange_glyph, exec->glyphIns, n_ins ); - loader->exec->is_composite = is_composite; - loader->exec->pts = *zone; + exec->is_composite = is_composite; + exec->pts = *zone; error = TT_Run_Context( loader->exec ); - if ( error && loader->exec->pedantic_hinting ) + if ( error && exec->pedantic_hinting ) return error; /* store drop-out mode in bits 5-7; set bit 2 also as a marker */ current_outline.tags[0] |= - ( loader->exec->GS.scan_type << 5 ) | FT_CURVE_TAG_HAS_SCANMODE; + ( exec->GS.scan_type << 5 ) | FT_CURVE_TAG_HAS_SCANMODE; } #endif @@ -908,7 +906,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 ) ) + exec->backward_compatibility ) ) { #endif loader->pp1 = zone->cur[zone->n_points - 4]; @@ -922,10 +920,10 @@ #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 ) { - if ( loader->exec->sph_tweak_flags & SPH_TWEAK_DEEMBOLDEN ) + if ( exec->sph_tweak_flags & SPH_TWEAK_DEEMBOLDEN ) FT_Outline_EmboldenXY( &loader->gloader->current.outline, -24, 0 ); - else if ( loader->exec->sph_tweak_flags & SPH_TWEAK_EMBOLDEN ) + else if ( exec->sph_tweak_flags & SPH_TWEAK_EMBOLDEN ) FT_Outline_EmboldenXY( &loader->gloader->current.outline, 24, 0 ); } #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ -- cgit v1.2.3 From 24d2523cdd58e9fb78827441877a3a3771fc6848 Mon Sep 17 00:00:00 2001 From: Jouk Jansen Date: Fri, 10 Mar 2023 16:50:20 +0100 Subject: Update VMS installation support. --- builds/vms/LIBS.OPT_IA64 | Bin 82 -> 0 bytes builds/vms/_LINK.OPT_IA64 | Bin 14464 -> 0 bytes builds/vms/apinames_vms.bash | Bin 0 -> 106 bytes builds/vms/vmslib.dat | 28 -- docs/INSTALL.VMS | 49 ++-- vms_make.com | 675 ++++++++++++++++++++++++++----------------- 6 files changed, 435 insertions(+), 317 deletions(-) delete mode 100644 builds/vms/LIBS.OPT_IA64 delete mode 100644 builds/vms/_LINK.OPT_IA64 create mode 100644 builds/vms/apinames_vms.bash delete mode 100644 builds/vms/vmslib.dat diff --git a/builds/vms/LIBS.OPT_IA64 b/builds/vms/LIBS.OPT_IA64 deleted file mode 100644 index 6768c7662..000000000 Binary files a/builds/vms/LIBS.OPT_IA64 and /dev/null differ diff --git a/builds/vms/_LINK.OPT_IA64 b/builds/vms/_LINK.OPT_IA64 deleted file mode 100644 index b8cbd1bc7..000000000 Binary files a/builds/vms/_LINK.OPT_IA64 and /dev/null differ diff --git a/builds/vms/apinames_vms.bash b/builds/vms/apinames_vms.bash new file mode 100644 index 000000000..953519805 Binary files /dev/null and b/builds/vms/apinames_vms.bash differ diff --git a/builds/vms/vmslib.dat b/builds/vms/vmslib.dat deleted file mode 100644 index 4c817da44..000000000 --- a/builds/vms/vmslib.dat +++ /dev/null @@ -1,28 +0,0 @@ -! -! This is a simple driver file with information used by make.com to -! check if external libraries (like t1lib and freetype) are available on -! the system. -! -! Layout of the file: -! -! - Lines starting with ! are treated as comments -! - Elements in a data line are separated by # signs -! - The elements need to be listed in the following order -! 1.) Name of the Library -! 2.) Location where the object library can be found -! 3.) Location where the include files for the library can be found -! 4.) Include file used to verify library location -! 5.) CPP define to pass to the build to indicate availability of -! the library -! -! Example: The following lines show how definitions -! might look like. They are site specific and the locations of the -! library and include files need almost certainly to be changed. -! -! Location: All of the libaries can be found at the following addresses -! -! ZLIB: http://www.decus.de:8080/www/vms/sw/zlib.htmlx -! -BZ2LIB # sys$library:libbz2.olb # decc$user_include: # bzlib.h # FT_CONFIG_OPTION_SYSTEM_ZLIB -PNGLIB # sys$library:libpng.olb # sys$library: # png.h # FT_CONFIG_OPTION_SYSTEM_ZLIB -ZLIB # sys$library:libz.olb # sys$library: # zlib.h # FT_CONFIG_OPTION_SYSTEM_ZLIB diff --git a/docs/INSTALL.VMS b/docs/INSTALL.VMS index 4ed4016a2..4f8c3ac33 100644 --- a/docs/INSTALL.VMS +++ b/docs/INSTALL.VMS @@ -1,23 +1,23 @@ -How to build the FreeType 2 library on VMS ------------------------------------------ +How to build the FreeType library on VMS +---------------------------------------- -It is actually very straightforward to install the FreeType 2 library. -Just execute vms_make.com from the toplevel directory to build the +It is actually very straightforward to install the FreeType library. +Just execute `vms_make.com from` the toplevel directory to build the library. This procedure currently accepts the following options: -DEBUG +* `DEBUG` Build the library with debug information and without optimization. -lopts= - Options to pass to the link command e.g. lopts=/traceback +* `lopts=` + Options to pass to the link command, e.g., `lopts=/traceback`. -ccopt= - Options to pass to the C compiler e.g. ccopt=/float=ieee +* `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 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 +sharing the same top level as the directory of FreeType 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 include files. @@ -28,24 +28,31 @@ The library is available in the directory [.LIB] -To compile applications using FreeType 2 you have to define the -logical FREETYPE pointing to the directory +To compile applications using FreeType you have to define the logical +`FREETYPE` pointing to the directory [.INCLUDE.FREETYPE] -i.e., if the directory in which this INSTALL.VMS file is located is -$disk:[freetype] then define the logical with +i.e., if the directory in which this `INSTALL.VMS` file is located is +`$disk:[freetype.docs]`, then define the logical with define freetype $disk:[freetype.include.freetype] -This version has been tested with Compaq C V6.2-006 on OpenVMS Alpha -V7.2-1. +See http://nchrem.tnw.tudelft.nl/openvms/software2.html#Freetype for +the packages FreeType depends on. +The latest versions were tested using + - VSI C V7.4-002 and DECWindows V1.7-F on OpenVMS Alpha V8.4-2L1 + - VSI C V7.4-001 and DECWindows V1.7-E on OpenVMS IA64 V8.4-2L3 - Any problems can be reported to - Jouk Jansen or - Martin P.J. Zinser +Any problems can be reported to + + Jouk Jansen or + +Orginal version of the build procedures was created by + + Martin P.J. Zinser ------------------------------------------------------------------------ diff --git a/vms_make.com b/vms_make.com index a1ccb654e..0a87c7178 100644 --- a/vms_make.com +++ b/vms_make.com @@ -71,18 +71,19 @@ $! Which command parameters were given $! $ gosub check_opts $! -$! Create option file -$! -$ open/write optf 'optfile' $! $! Pull in external libraries $! $ create libs.opt $ open/write libsf libs.opt -$ gosub check_create_vmslib +$ write libsf "sys$library:libpng.olb/lib" +$ write libsf "sys$library:libbz2.olb/lib" +$ write libsf "sys$library:libz.olb/lib" +$ close libsf $! $! Create objects $! +$ libdefs = "FT2_BUILD_LIBRARY,FT_CONFIG_OPTION_OLD_INTERNALS,FT_CONFIG_OPTION_USE_BZIP2=1,FT_CONFIG_OPTION_USE_PNG=1,FT_CONFIG_OPTION_SYSTEM_ZLIB=1" $ if libdefs .nes. "" $ then $ ccopt = ccopt + "/define=(" + f$extract(0,f$length(libdefs)-1,libdefs) + ")" @@ -95,48 +96,38 @@ $! $ 'Make' /macro=(comp_flags="''ccopt'") $ purge/nolog [...]descrip.mms $! -$! Add them to options -$! -$FLOOP: -$ file = f$edit(f$search("[...]*.obj"),"UPCASE") -$ if (file .nes. "") -$ then -$ if f$locate("DEMOS",file) .eqs. f$length(file) then write optf file -$ goto floop -$ endif -$! -$ close optf -$! $! -$! Alpha gets a shareable image +$! Alpha & Itanium get a shareable image $! $ If f$getsyi("HW_MODEL") .gt. 1024 $ Then $ write sys$output "Creating freetype2shr.exe" -$ If f$getsyi("HW_MODEL") .le. 2048 -$ Then -$ call anal_obj_axp 'optfile' _link.opt -$ Else -$ copy _link.opt_ia64 _link.opt -$ close libsf -$ copy libs.opt_ia64 libs.opt -$ endif -$ open/append optf 'optfile' -$ if s_case then WRITE optf "case_sensitive=YES" -$ close optf -$ LINK_/NODEB/SHARE=[.lib]freetype2shr.exe - - 'optfile'/opt,libs.opt/opt,_link.opt/opt +$ library/extract=* [.lib]freetype.olb +$ pipe link/nodeb/noshare/noexe/map=libfreetype.map/full freetype.obj | copy sys$input nl: +$ set def [.src.tools] +$ cc apinames.c +$ link apinames +$ set def [--] +$ pur [.include.freetype]ftmac.h +$ rename [.include.freetype]ftmac.h [.include.freetype]ftmac.h_tmp +$ bash builds/vms/apinames_vms.bash +$ rename [.include.freetype]ftmac.h_tmp [.include.freetype]ftmac.h +$ open/write file libfreetype.opt +$ write file "!" +$ write file "! libfreetype.opt generated by vms_make.com" +$ write file "!" +$ write file "IDENTIFICATION=""freetype2 2.0""" +$ write file "GSMATCH=LEQUAL,2,0 +$ write file "freetype.obj" +$ close file +$ link/nodeb/share=[.lib]freetype2shr.exe/map=libfreetype.map/full - + libfreetype/opt,freetype_vms/opt,libs/opt +$ delete freetype.obj;* $ endif $! $ exit $! $ -$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" -$ goto err_exit $ERR_EXIT: $ set message/facil/ident/sever/text $ close/nolog optf @@ -237,6 +228,8 @@ all : $(MMS)$(MMSQUALIFIERS) set default [-.smooth] $(MMS)$(MMSQUALIFIERS) + set default [-.svg] + $(MMS)$(MMSQUALIFIERS) set default [-.truetype] $(MMS)$(MMSQUALIFIERS) set default [-.type1] @@ -245,6 +238,8 @@ all : $(MMS)$(MMSQUALIFIERS) set default [-.winfonts] $(MMS)$(MMSQUALIFIERS) + set default [-.sdf] + $(MMS)$(MMSQUALIFIERS) set default [--] # EOF @@ -272,10 +267,21 @@ $ deck CFLAGS=$(COMP_FLAGS)$(DEBUG)/list/show=all/include=([],[--.include],[--.src.base]) +.c.obj : + cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c + pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: + mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map + cc$(CFLAGS)/point=64/obj=$(MMS$TARGET_NAME)_64.obj\ + $(MMS$TARGET_NAME)_64.c + delete $(MMS$TARGET_NAME)_64.c;* + OBJS=ftsystem.obj +OBJS64=ftsystem_64.obj + all : $(OBJS) library/create [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) ftsystem.obj : ftsystem.c ftconfig.h @@ -303,10 +309,21 @@ $ deck CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.autofit]) +.c.obj : + cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c + pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: + mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map + cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\ + /obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c + delete $(MMS$TARGET_NAME)_64.c;* + OBJS=autofit.obj +OBJS64=autofit_64.obj + all : $(OBJS) library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) # EOF $ eod @@ -333,6 +350,14 @@ $ deck CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.builds.vms],[--.include],[--.src.base]) +.c.obj : + cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c + pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: + mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map + cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\ + /obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c + delete $(MMS$TARGET_NAME)_64.c;* + OBJS=ftbase.obj,\ ftbbox.obj,\ ftbdf.obj,\ @@ -348,10 +373,33 @@ OBJS=ftbase.obj,\ ftstroke.obj,\ ftsynth.obj,\ fttype1.obj,\ - ftwinfnt.obj + ftwinfnt.obj,ftpatent.obj,ftgxval.obj,ftotval.obj + +OBJS64=ftbase_64.obj,\ + ftbbox_64.obj,\ + ftbdf_64.obj,\ + ftbitmap_64.obj,\ + ftcid_64.obj,\ + ftdebug_64.obj,\ + ftfstype_64.obj,\ + ftgasp_64.obj,\ + ftglyph_64.obj,\ + ftinit_64.obj,\ + ftmm_64.obj,\ + ftpfr_64.obj,\ + ftstroke_64.obj,\ + ftsynth_64.obj,\ + fttype1_64.obj,\ + ftwinfnt_64.obj,ftpatent_64.obj,ftgxval_64.obj,ftotval_64.obj all : $(OBJS) library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) + +ftbase.obj : ftbase.c ftadvanc.c ftcalc.c ftcolor.c ftdbgmem.c fterrors.c\ + ftfntfmt.c ftgloadr.c fthash.c ftlcdfil.c ftmac.c ftobjs.c ftoutln.c\ + ftpsprop.c ftrfork.c ftsnames.c ftstream.c fttrigon.c ftutil.c + # EOF $ eod @@ -378,10 +426,21 @@ $ deck CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.bdf]) +.c.obj : + cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c + pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: + mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map + cc$(CFLAGS)/point=64/obj=$(MMS$TARGET_NAME)_64.obj\ + $(MMS$TARGET_NAME)_64.c + delete $(MMS$TARGET_NAME)_64.c;* + OBJS=bdf.obj +OBJS64=bdf_64.obj + all : $(OBJS) library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) # EOF $ eod @@ -408,10 +467,24 @@ $ deck CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.cache])/nowarn +.c.obj : + cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c + pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: + mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map + cc$(CFLAGS)/point=64/obj=$(MMS$TARGET_NAME)_64.obj\ + $(MMS$TARGET_NAME)_64.c + delete $(MMS$TARGET_NAME)_64.c;* + OBJS=ftcache.obj +OBJS64=ftcache_64.obj + all : $(OBJS) library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) + +ftcache.obj : ftcache.c ftcbasic.c ftccache.c ftccmap.c ftcglyph.c ftcimage.c \ + ftcmanag.c ftcmru.c ftcsbits.c # EOF $ eod @@ -438,10 +511,21 @@ $ deck CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.cff]) +.c.obj : + cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c + pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: + mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map + cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\ + /obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c + delete $(MMS$TARGET_NAME)_64.c;* + OBJS=cff.obj +OBJS64=cff_64.obj + all : $(OBJS) library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) # EOF $ eod @@ -468,10 +552,21 @@ $ deck CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.cid]) +.c.obj : + cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c + pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: + mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map + cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\ + /obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c + delete $(MMS$TARGET_NAME)_64.c;* + OBJS=type1cid.obj +OBJS64=type1cid_64.obj + all : $(OBJS) library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) # EOF $ eod @@ -498,10 +593,21 @@ $ deck CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.gxvalid]) +.c.obj : + cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c + pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: + mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map + cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\ + /obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c + delete $(MMS$TARGET_NAME)_64.c;* + OBJS=gxvalid.obj +OBJS64=gxvalid_64.obj + all : $(OBJS) library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) # EOF $ eod @@ -525,17 +631,27 @@ $ deck # indicate that you have read the license and understand and accept it # fully. $EOD -$ if libincs .nes. "" then write out "LIBINCS = ", libincs - ",", "," $ write out "COMP_FLAGS = ", ccopt $ copy sys$input: out $ deck -CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=($(LIBINCS)[--.include],[--.src.gzip]) +CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.gzip]) + +.c.obj : + cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c + pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: + mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map + cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\ + /obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c + delete $(MMS$TARGET_NAME)_64.c;* OBJS=ftgzip.obj +OBJS64=ftgzip_64.obj + all : $(OBJS) library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) # EOF $ eod @@ -561,17 +677,27 @@ $ deck # indicate that you have read the license and understand and accept it # fully. $EOD -$ if libincs .nes. "" then write out "LIBINCS = ", libincs - ",", "," $ write out "COMP_FLAGS = ", ccopt $ copy sys$input: out $ deck CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.bzip2]) +.c.obj : + cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c + pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: + mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map + cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\ + /obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c + delete $(MMS$TARGET_NAME)_64.c;* + OBJS=ftbzip2.obj +OBJS64=ftbzip2_64.obj + all : $(OBJS) library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) # EOF $ eod @@ -595,17 +721,27 @@ $ deck # indicate that you have read the license and understand and accept it # fully. $EOD -$ if libincs .nes. "" then write out "LIBINCS = ", libincs - ",", "," $ write out "COMP_FLAGS = ", ccopt $ copy sys$input: out $ deck -CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=($(LIBINCS)[--.include],[--.src.lzw]) +CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.lzw]) + +.c.obj : + cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c + pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: + mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map + cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\ + /obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c + delete $(MMS$TARGET_NAME)_64.c;* OBJS=ftlzw.obj +OBJS64=ftlzw_64.obj + all : $(OBJS) library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) # EOF $ eod @@ -632,10 +768,21 @@ $ deck CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.otvalid]) +.c.obj : + cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c + pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: + mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map + cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\ + /obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c + delete $(MMS$TARGET_NAME)_64.c;* + OBJS=otvalid.obj +OBJS64=otvalid_64.obj + all : $(OBJS) library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) # EOF $ eod @@ -674,10 +821,21 @@ $ deck CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.pcf]) +.c.obj : + cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c + pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: + mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map + cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\ + /obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c + delete $(MMS$TARGET_NAME)_64.c;* + OBJS=pcf.obj +OBJS64=pcf_64.obj + all : $(OBJS) library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) # EOF $ eod @@ -704,10 +862,21 @@ $ deck CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.pfr]) +.c.obj : + cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c + pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: + mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map + cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\ + /obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c + delete $(MMS$TARGET_NAME)_64.c;* + OBJS=pfr.obj +OBJS64=pfr_64.obj + all : $(OBJS) library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) # EOF $ eod @@ -734,10 +903,21 @@ $ deck CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.psaux]) +.c.obj : + cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c + pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: + mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map + cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\ + /obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c + delete $(MMS$TARGET_NAME)_64.c;* + OBJS=psaux.obj +OBJS64=psaux_64.obj + all : $(OBJS) library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) # EOF $ eod @@ -764,10 +944,21 @@ $ deck CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.psnames]) +.c.obj : + cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c + pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: + mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map + cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\ + /obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c + delete $(MMS$TARGET_NAME)_64.c;* + OBJS=pshinter.obj +OBJS64=pshinter_64.obj + all : $(OBJS) library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) # EOF $ eod @@ -794,10 +985,21 @@ $ deck CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.psnames]) +.c.obj : + cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c + pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: + mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map + cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\ + /obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c + delete $(MMS$TARGET_NAME)_64.c;* + OBJS=psnames.obj +OBJS64=psnames_64.obj + all : $(OBJS) library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) # EOF $ eod @@ -824,10 +1026,21 @@ $ deck CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.raster]) +.c.obj : + cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c + pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: + mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map + cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\ + /obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c + delete $(MMS$TARGET_NAME)_64.c;* + OBJS=raster.obj +OBJS64=raster_64.obj + all : $(OBJS) library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) # EOF $ eod @@ -854,10 +1067,21 @@ $ deck CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.sfnt]) +.c.obj : + cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c + pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: + mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map + cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\ + /obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c + delete $(MMS$TARGET_NAME)_64.c;* + OBJS=sfnt.obj +OBJS64=sfnt_64.obj + all : $(OBJS) library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) # EOF $ eod @@ -884,10 +1108,62 @@ $ deck CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.smooth]) +.c.obj : + cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c + pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: + mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map + cc$(CFLAGS)/point=64/obj=$(MMS$TARGET_NAME)_64.obj\ + $(MMS$TARGET_NAME)_64.c + delete $(MMS$TARGET_NAME)_64.c;* + OBJS=smooth.obj +OBJS64=smooth_64.obj + +all : $(OBJS) + library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) + +# EOF +$ eod +$ close out +$ write sys$output "... [.src.svg] directory" +$ create [.src.svg]descrip.mms +$ open/append out [.src.svg]descrip.mms +$ copy sys$input: out +$ deck +# +# FreeType 2 smooth renderer module compilation rules for VMS +# + + +# Copyright 2001-2019 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. + + +CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.svg]) + +.c.obj : + cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c + pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: + mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map + cc$(CFLAGS)/point=64/obj=$(MMS$TARGET_NAME)_64.obj\ + $(MMS$TARGET_NAME)_64.c + delete $(MMS$TARGET_NAME)_64.c;* + +OBJS=svg.obj + +OBJS64=svg_64.obj + all : $(OBJS) library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) # EOF $ eod @@ -914,10 +1190,21 @@ $ deck CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.truetype]) +.c.obj : + cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c + pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: + mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map + cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\ + /obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c + delete $(MMS$TARGET_NAME)_64.c;* + OBJS=truetype.obj +OBJS64=truetype_64.obj + all : $(OBJS) library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) # EOF $ eod @@ -944,10 +1231,66 @@ $ deck CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.type1]) +.c.obj : + cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c + pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: + mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map + cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\ + /obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c + delete $(MMS$TARGET_NAME)_64.c;* + OBJS=type1.obj +OBJS64=type1_64.obj + +all : $(OBJS) + library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) + +type1.obj : type1.c t1parse.c t1load.c t1objs.c t1driver.c t1gload.c t1afm.c + +# EOF +$ eod +$ close out +$ write sys$output "... [.src.sdf] directory" +$ create [.src.sdf]descrip.mms +$ open/append out [.src.sdf]descrip.mms +$ copy sys$input: out +$ deck +# +# FreeType 2 sdf driver compilation rules for VMS +# + + +# Copyright 1996-2019 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. + + +CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.type1]) + +.c.obj : + cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c + pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: + mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map + cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\ + /obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c + delete $(MMS$TARGET_NAME)_64.c;* + +OBJS=sdf.obj + +OBJS64=sdf_64.obj + all : $(OBJS) library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) + +sdf.obj : sdf.c ftbsdf.c ftsdf.c ftsdfcommon.c ftsdfrend.c # EOF $ eod @@ -974,10 +1317,21 @@ $ deck CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.type42]) +.c.obj : + cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c + pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: + mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map + cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\ + /obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c + delete $(MMS$TARGET_NAME)_64.c;* + OBJS=type42.obj +OBJS64=type42_64.obj + all : $(OBJS) library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) # EOF $ eod @@ -1004,10 +1358,21 @@ $ deck CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.winfonts]) +.c.obj : + cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c + pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl: + mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map + cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\ + /obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c + delete $(MMS$TARGET_NAME)_64.c;* + OBJS=winfnt.obj +OBJS64=winfnt_64.obj + all : $(OBJS) library [--.lib]freetype.olb $(OBJS) + library [--.lib]freetype.olb $(OBJS64) # EOF $ eod @@ -1077,230 +1442,4 @@ $ endif $ return $!------------------------------------------------------------------------------ $! -$! Take care of driver file with information about external libraries -$! -$! Version history -$! 0.01 20040220 First version to receive a number -$! 0.02 20040229 Echo current procedure name; use general error exit handler -$! Remove xpm hack -> Replaced by more general dnsrl handling -$CHECK_CREATE_VMSLIB: -$! -$ if f$search("VMSLIB.DAT") .eqs. "" -$ 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 -! the system. -! -! Layout of the file: -! -! - Lines starting with ! are treated as comments -! - Elements in a data line are separated by # signs -! - The elements need to be listed in the following order -! 1.) Name of the Library (only used for informative messages -! from vms_make.com) -! 2.) Location where the object library can be found -! 3.) Location where the include files for the library can be found -! 4.) Include file used to verify library location -! 5.) CPP define to pass to the build to indicate availability of -! the library -! -! Example: The following lines show how definitions -! might look like. They are site specific and the locations of the -! library and include files need almost certainly to be changed. -! -! Location: All of the libraries can be found at the following addresses -! -! ZLIB: http://zinser.no-ip.info/vms/sw/zlib.htmlx -! -ZLIB # sys$library:libz.olb # sys$library: # zlib.h # FT_CONFIG_OPTION_SYSTEM_ZLIB -$ write sys$output "New driver file vmslib.dat created." -$ write sys$output "Please customize library locations for your site" -$ write sys$output "and afterwards re-execute ''myproc'" -$ goto err_exit -$ endif -$! -$! Init symbols used to hold CPP definitions and include path -$! -$ libdefs = "FT2_BUILD_LIBRARY,FT_CONFIG_OPTION_OLD_INTERNALS," -$ libincs = "" -$! -$! Open data file with location of libraries -$! -$ open/read/end=end_lib/err=err_lib libdata VMSLIB.DAT -$LIB_LOOP: -$ read/end=end_lib libdata libline -$ libline = f$edit(libline, "UNCOMMENT,COLLAPSE") -$ if libline .eqs. "" then goto LIB_LOOP ! Comment line -$ libname = f$edit(f$element(0,"#",libline),"UPCASE") -$ write sys$output "Processing ''libname' setup ..." -$ libloc = f$element(1,"#",libline) -$ libsrc = f$element(2,"#",libline) -$ testinc = f$element(3,"#",libline) -$ cppdef = f$element(4,"#",libline) -$ old_cpp = f$locate("=1",cppdef) -$ if old_cpp.lt.f$length(cppdef) then cppdef = f$extract(0,old_cpp,cppdef) -$ if f$search("''libloc'").eqs. "" -$ then -$ write sys$output "Can not find library ''libloc' - Skipping ''libname'" -$ goto LIB_LOOP -$ endif -$ libsrc_elem = 0 -$ libsrc_found = false -$LIBSRC_LOOP: -$ libsrcdir = f$element(libsrc_elem,",",libsrc) -$ if (libsrcdir .eqs. ",") then goto END_LIBSRC -$ if f$search("''libsrcdir'''testinc'") .nes. "" then libsrc_found = true -$ libsrc_elem = libsrc_elem + 1 -$ goto LIBSRC_LOOP -$END_LIBSRC: -$ if .not. libsrc_found -$ then -$ write sys$output "Can not find includes at ''libsrc' - Skipping ''libname'" -$ goto LIB_LOOP -$ endif -$ if (cppdef .nes. "") then libdefs = libdefs + cppdef + "," -$ libincs = libincs + "," + libsrc -$ lqual = "/lib" -$ libtype = f$edit(f$parse(libloc,,,"TYPE"),"UPCASE") -$ 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 -$! -$ ft2def = false -$ if ((libname .eqs. "FREETYPE") .and. - - (f$locate("FREETYPE2",cppdef) .lt. f$length(cppdef))) -$ then -$ if ((f$search("freetype:freetype.h") .nes. "") .and. - - (f$search("freetype:[internal]ftobjs.h") .nes. "")) -$ then -$ write sys$output "Will use local definition of freetype logical" -$ else -$ ft2elem = 0 -$FT2_LOOP: -$ ft2srcdir = f$element(ft2elem,",",libsrc) -$ if f$search("''ft2srcdir'''testinc'") .nes. "" -$ then -$ if f$search("''ft2srcdir'internal.dir") .nes. "" -$ then -$ ft2dev = f$parse("''ft2srcdir'",,,"device","no_conceal") -$ ft2dir = f$parse("''ft2srcdir'",,,"directory","no_conceal") -$ ft2conc = f$locate("][",ft2dir) -$ ft2len = f$length(ft2dir) -$ if ft2conc .lt. ft2len -$ then -$ ft2dir = f$extract(0,ft2conc,ft2dir) + - - f$extract(ft2conc+2,ft2len-2,ft2dir) -$ endif -$ ft2dir = ft2dir - "]" + ".]" -$ define freetype 'ft2dev''ft2dir','ft2srcdir' -$ ft2def = true -$ else -$ goto ft2_err -$ endif -$ else -$ ft2elem = ft2elem + 1 -$ goto ft2_loop -$ endif -$ endif -$ endif -$ goto LIB_LOOP -$END_LIB: -$ close libdata -$ return -$!------------------------------------------------------------------------------ -$! -$! Analyze Object files for OpenVMS AXP to extract Procedure and Data -$! information to build a symbol vector for a shareable image -$! All the "brains" of this logic was suggested by Hartmut Becker -$! (Hartmut.Becker@compaq.com). All the bugs were introduced by me -$! (zinser@zinser.no-ip.info), so if you do have problem reports please do not -$! bother Hartmut/HP, but get in touch with me -$! -$! Version history -$! 0.01 20040006 Skip over shareable images in option file -$! -$ ANAL_OBJ_AXP: Subroutine -$ V = 'F$Verify(0) -$ SAY := "WRITE_ SYS$OUTPUT" -$ -$ IF F$SEARCH("''P1'") .EQS. "" -$ THEN -$ SAY "ANAL_OBJ_AXP-E-NOSUCHFILE: Error, inputfile ''p1' not available" -$ goto exit_aa -$ ENDIF -$ IF "''P2'" .EQS. "" -$ THEN -$ SAY "ANAL_OBJ_AXP: Error, no output file provided" -$ goto exit_aa -$ ENDIF -$ -$ open/read in 'p1 -$ create a.tmp -$ open/append atmp a.tmp -$ loop: -$ read/end=end_loop in line -$ if f$locate("/SHARE",f$edit(line,"upcase")) .lt. f$length(line) -$ then -$ write sys$output "ANAL_SKP_SHR-i-skipshare, ''line'" -$ goto loop -$ endif -$ if f$locate("/LIB",f$edit(line,"upcase")) .lt. f$length(line) -$ then -$ write libsf line -$ write sys$output "ANAL_SKP_LIB-i-skiplib, ''line'" -$ goto loop -$ endif -$ f= f$search(line) -$ if f .eqs. "" -$ then -$ write sys$output "ANAL_OBJ_AXP-w-nosuchfile, ''line'" -$ goto loop -$ endif -$ def/user sys$output nl: -$ def/user sys$error nl: -$ anal/obj/gsd 'f /out=x.tmp -$ open/read xtmp x.tmp -$ XLOOP: -$ read/end=end_xloop xtmp xline -$ xline = f$edit(xline,"compress") -$ write atmp xline -$ goto xloop -$ END_XLOOP: -$ close xtmp -$ goto loop -$ end_loop: -$ close in -$ close atmp -$ if f$search("a.tmp") .eqs. "" - - then $ exit -$ ! all global definitions -$ search a.tmp "symbol:","EGSY$V_DEF 1","EGSY$V_NORM 1"/out=b.tmp -$ ! all procedures -$ search b.tmp "EGSY$V_NORM 1"/wind=(0,1) /out=c.tmp -$ search c.tmp "symbol:"/out=d.tmp -$ def/user sys$output nl: -$ edito/edt/command=sys$input d.tmp -sub/symbol: "/symbol_vector=(/whole -sub/"/=PROCEDURE)/whole -exit -$ ! all data -$ search b.tmp "EGSY$V_DEF 1"/wind=(0,1) /out=e.tmp -$ search e.tmp "symbol:"/out=f.tmp -$ def/user sys$output nl: -$ edito/edt/command=sys$input f.tmp -sub/symbol: "/symbol_vector=(/whole -sub/"/=DATA)/whole -exit -$ sort/nodupl d.tmp,f.tmp 'p2' -$ delete a.tmp;*,b.tmp;*,c.tmp;*,d.tmp;*,e.tmp;*,f.tmp;* -$ if f$search("x.tmp") .nes. "" - - then $ delete x.tmp;* -$! -$ close libsf -$ EXIT_AA: -$ if V then set verify $ endsubroutine -- cgit v1.2.3 From b9376065d68c7d8cdb908cf99b89d0fd76ddb051 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Fri, 10 Mar 2023 23:41:39 -0500 Subject: [truetype] Fix recent fallout in memory management. * src/truetype/ttgload.c (TT_Process_Composite_Glyph, TT_Load_Simple_Glyph): Clean up old instructions regardless of new ones, postpone setting `control_len` and `control_data` until... (TT_Load_Glyph): ... the exit from this function. --- src/truetype/ttgload.c | 63 ++++++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 33 deletions(-) diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index 5419fa028..56e1c95b9 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -422,10 +422,6 @@ if ( error ) goto Fail; - /* reading the bytecode instructions */ - load->glyph->control_len = 0; - load->glyph->control_data = NULL; - if ( p + 2 > limit ) goto Invalid_Outline; @@ -449,21 +445,20 @@ goto Fail; } + if ( exec->glyphSize ) + FT_FREE( exec->glyphIns ); + exec->glyphSize = 0; + /* we don't trust `maxSizeOfInstructions' in the `maxp' table */ /* and thus allocate the bytecode array size by ourselves */ if ( n_ins ) { - if ( exec->glyphSize ) - FT_FREE( exec->glyphIns ); if ( FT_QNEW_ARRAY( exec->glyphIns, n_ins ) ) return error; FT_MEM_COPY( exec->glyphIns, p, (FT_Long)n_ins ); exec->glyphSize = n_ins; - - load->glyph->control_len = n_ins; - load->glyph->control_data = exec->glyphIns; } } @@ -1347,27 +1342,6 @@ #ifdef TT_USE_BYTECODE_INTERPRETER - /* TT_Load_Composite_Glyph only gives us the offset of instructions */ - /* so we read them here */ - if ( FT_STREAM_SEEK( loader->ins_pos ) || - FT_READ_USHORT( n_ins ) ) - return error; - - FT_TRACE5(( " Instructions size = %hu\n", n_ins )); - - if ( !n_ins ) - return FT_Err_Ok; - - /* don't trust `maxSizeOfInstructions'; */ - /* only do a rough safety check */ - if ( n_ins > loader->byte_len ) - { - FT_TRACE1(( "TT_Process_Composite_Glyph:" - " too many instructions (%hu) for glyph with length %u\n", - n_ins, loader->byte_len )); - return FT_THROW( Too_Many_Hints ); - } - { TT_ExecContext exec = loader->exec; FT_Memory memory = exec->memory; @@ -1375,14 +1349,34 @@ if ( exec->glyphSize ) FT_FREE( exec->glyphIns ); + exec->glyphSize = 0; + + /* TT_Load_Composite_Glyph only gives us the offset of instructions */ + /* so we read them here */ + if ( FT_STREAM_SEEK( loader->ins_pos ) || + FT_READ_USHORT( n_ins ) ) + return error; + + FT_TRACE5(( " Instructions size = %hu\n", n_ins )); + + if ( !n_ins ) + return FT_Err_Ok; + + /* don't trust `maxSizeOfInstructions'; */ + /* only do a rough safety check */ + if ( n_ins > loader->byte_len ) + { + FT_TRACE1(( "TT_Process_Composite_Glyph:" + " too many instructions (%hu) for glyph with length %u\n", + n_ins, loader->byte_len )); + return FT_THROW( Too_Many_Hints ); + } + if ( FT_QNEW_ARRAY( exec->glyphIns, n_ins ) || FT_STREAM_READ( exec->glyphIns, n_ins ) ) return error; exec->glyphSize = n_ins; - - loader->glyph->control_len = n_ins; - loader->glyph->control_data = exec->glyphIns; } #endif @@ -2940,6 +2934,9 @@ if ( IS_HINTED( load_flags ) ) { + glyph->control_data = loader.exec->glyphIns; + glyph->control_len = loader.exec->glyphSize; + if ( loader.exec->GS.scan_control ) { /* convert scan conversion mode to FT_OUTLINE_XXX flags */ -- cgit v1.2.3 From d857bd535b6c7e877f262a9b61ed21ee11b35dab Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 13 Mar 2023 11:47:38 +0100 Subject: builds/vms/apinames_vms.bash: Fix `unzip` artifact The problem occured when unpacking a zip file created on OpenVMS on Linux. While OpenVMS knows many different file formats, Unix only knows stream-LF and binary. In principle `zip` on Linux should have translated the file to stream-LF but failed to do so. That caused the file to incorrectly contain only one line with control-characters. --- builds/vms/apinames_vms.bash | Bin 106 -> 102 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/builds/vms/apinames_vms.bash b/builds/vms/apinames_vms.bash index 953519805..e9b1b727b 100644 Binary files a/builds/vms/apinames_vms.bash and b/builds/vms/apinames_vms.bash differ -- cgit v1.2.3 From e71647621cb72e9c263ec42238df632bded97333 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Wed, 15 Mar 2023 18:48:27 +0000 Subject: * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Clean up. --- src/truetype/ttgload.c | 54 +++++++++++++++++--------------------------------- 1 file changed, 18 insertions(+), 36 deletions(-) diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index 56e1c95b9..92fe8219a 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -362,16 +362,16 @@ FT_Byte* p = load->cursor; FT_Byte* limit = load->limit; FT_GlyphLoader gloader = load->gloader; + FT_Outline* outline = &gloader->current.outline; FT_Int n_contours = load->n_contours; - FT_Outline* outline; - FT_UShort n_ins; FT_Int n_points; + FT_UShort n_ins; FT_Byte *flag, *flag_limit; FT_Byte c, count; FT_Vector *vec, *vec_limit; FT_Pos x, y; - FT_Short *cont, *cont_limit, prev_cont; + FT_Short *cont, *cont_limit, last; FT_Int xy_size = 0; @@ -380,40 +380,26 @@ if ( error ) goto Fail; - /* reading the contours' endpoints & number of points */ - cont = gloader->current.outline.contours; - cont_limit = cont + n_contours; - /* check space for contours array + instructions count */ - if ( n_contours >= 0xFFF || p + ( n_contours + 1 ) * 2 > limit ) + if ( n_contours >= 0xFFF || p + 2 * n_contours + 2 > limit ) goto Invalid_Outline; - prev_cont = FT_NEXT_SHORT( p ); - - if ( n_contours > 0 ) - cont[0] = prev_cont; - - if ( prev_cont < 0 ) - goto Invalid_Outline; + /* reading the contours' endpoints & number of points */ + cont = outline->contours; + cont_limit = cont + n_contours; - for ( cont++; cont < cont_limit; cont++ ) + last = -1; + do { - cont[0] = FT_NEXT_SHORT( p ); - if ( cont[0] <= prev_cont ) - { - /* unordered contours: this is invalid */ - goto Invalid_Outline; - } - prev_cont = cont[0]; - } + *cont = FT_NEXT_SHORT( p ); - n_points = 0; - if ( n_contours > 0 ) - { - n_points = cont[-1] + 1; - if ( n_points < 0 ) + if ( *cont <= last ) goto Invalid_Outline; - } + + last = *cont; + } while ( ++cont < cont_limit ); + + n_points = last + 1; FT_TRACE5(( " # of points: %d\n", n_points )); @@ -422,9 +408,7 @@ if ( error ) goto Fail; - if ( p + 2 > limit ) - goto Invalid_Outline; - + /* stace checked above */ n_ins = FT_NEXT_USHORT( p ); FT_TRACE5(( " Instructions size: %u\n", n_ins )); @@ -466,8 +450,6 @@ p += n_ins; - outline = &gloader->current.outline; - /* reading the point tags */ flag = (FT_Byte*)outline->tags; flag_limit = flag + n_points; @@ -537,7 +519,7 @@ /* reading the Y coordinates */ - vec = gloader->current.outline.points; + vec = outline->points; vec_limit = vec + n_points; flag = (FT_Byte*)outline->tags; y = 0; -- cgit v1.2.3 From 764bc8e41c19dac021e4ffe6ec6a207ed09df69a Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Wed, 15 Mar 2023 23:18:18 -0400 Subject: [truetype] Clean up glyph loading. * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Clean space checking. (TT_Hint_Glyph): Don't copy the outline structure. (TT_Process_Simple_Glyph): Cosmetic update. --- src/truetype/ttgload.c | 39 ++++++++++++++------------------------- 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index 92fe8219a..b7710f2c6 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -372,7 +372,6 @@ FT_Vector *vec, *vec_limit; FT_Pos x, y; FT_Short *cont, *cont_limit, last; - FT_Int xy_size = 0; /* check that we can add the contours to the glyph */ @@ -408,11 +407,19 @@ if ( error ) goto Fail; - /* stace checked above */ + /* space checked above */ n_ins = FT_NEXT_USHORT( p ); FT_TRACE5(( " Instructions size: %u\n", n_ins )); + /* check instructions size */ + if ( p + n_ins > limit ) + { + FT_TRACE1(( "TT_Load_Simple_Glyph: excessive instruction count\n" )); + error = FT_THROW( Too_Many_Hints ); + goto Fail; + } + #ifdef TT_USE_BYTECODE_INTERPRETER if ( IS_HINTED( load->load_flags ) ) @@ -421,14 +428,6 @@ FT_Memory memory = exec->memory; - /* check instructions size */ - if ( ( limit - p ) < n_ins ) - { - FT_TRACE1(( "TT_Load_Simple_Glyph: instruction count mismatch\n" )); - error = FT_THROW( Too_Many_Hints ); - goto Fail; - } - if ( exec->glyphSize ) FT_FREE( exec->glyphIns ); exec->glyphSize = 0; @@ -487,9 +486,6 @@ flag = (FT_Byte*)outline->tags; x = 0; - if ( p + xy_size > limit ) - goto Invalid_Outline; - for ( ; vec < vec_limit; vec++, flag++ ) { FT_Pos delta = 0; @@ -858,9 +854,6 @@ { FT_Error error; - FT_GlyphLoader gloader = loader->gloader; - FT_Outline current_outline = gloader->current.outline; - TT_Set_CodeRange( exec, tt_coderange_glyph, exec->glyphIns, n_ins ); @@ -872,7 +865,7 @@ return error; /* store drop-out mode in bits 5-7; set bit 2 also as a marker */ - current_outline.tags[0] |= + loader->gloader->current.outline.tags[0] |= ( exec->GS.scan_type << 5 ) | FT_CURVE_TAG_HAS_SCANMODE; } @@ -922,10 +915,10 @@ static FT_Error TT_Process_Simple_Glyph( TT_Loader loader ) { - FT_GlyphLoader gloader = loader->gloader; - FT_Error error = FT_Err_Ok; - FT_Outline* outline; - FT_Int n_points; + FT_Error error = FT_Err_Ok; + FT_GlyphLoader gloader = loader->gloader; + FT_Outline* outline = &gloader->current.outline; + FT_Int n_points = outline->n_points; #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT FT_Memory memory = loader->face->root.memory; @@ -933,11 +926,7 @@ #endif - outline = &gloader->current.outline; - n_points = outline->n_points; - /* set phantom points */ - outline->points[n_points ] = loader->pp1; outline->points[n_points + 1] = loader->pp2; outline->points[n_points + 2] = loader->pp3; -- cgit v1.2.3 From dd78d4a77458fa572c633b81e1f84b567f981ecc Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Thu, 16 Mar 2023 03:28:59 +0000 Subject: * src/base/ftsynth.c (FT_GlyphSlot_AdjustWeight): New API. --- include/freetype/ftsynth.h | 12 ++++++++++++ src/base/ftsynth.c | 20 ++++++++++++++------ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/include/freetype/ftsynth.h b/include/freetype/ftsynth.h index 5d1969765..af90967dd 100644 --- a/include/freetype/ftsynth.h +++ b/include/freetype/ftsynth.h @@ -68,6 +68,18 @@ FT_BEGIN_HEADER FT_EXPORT( void ) FT_GlyphSlot_Embolden( FT_GlyphSlot slot ); + /* Precisely adjust the glyph weight either horizontally or vertically. */ + /* The `xdelta` and `ydelta` values are fractions of the face Em size */ + /* (in fixed-point format). Considering that a regular face would have */ + /* stem widths on the order of 0.1 Em, a delta of 0.05 (0x0CCC) should */ + /* be very noticeable. To increase or decrease the weight, use positive */ + /* or negative values, respectively. */ + FT_EXPORT( void ) + FT_GlyphSlot_AdjustWeight( FT_GlyphSlot slot, + FT_Fixed xdelta, + FT_Fixed ydelta ); + + /* Slant an outline glyph to the right by about 12 degrees. */ FT_EXPORT( void ) FT_GlyphSlot_Oblique( FT_GlyphSlot slot ); diff --git a/src/base/ftsynth.c b/src/base/ftsynth.c index 6ec25e13e..f32edd338 100644 --- a/src/base/ftsynth.c +++ b/src/base/ftsynth.c @@ -97,9 +97,18 @@ FT_EXPORT_DEF( void ) FT_GlyphSlot_Embolden( FT_GlyphSlot slot ) + { + FT_GlyphSlot_AdjustWeight( slot, 0x0AAA, 0x0AAA ); + } + + + FT_EXPORT_DEF( void ) + FT_GlyphSlot_AdjustWeight( FT_GlyphSlot slot, + FT_Fixed xdelta, + FT_Fixed ydelta ) { FT_Library library; - FT_Face face; + FT_Size size; FT_Error error; FT_Pos xstr, ystr; @@ -108,16 +117,15 @@ return; library = slot->library; - face = slot->face; + size = slot->face->size; if ( slot->format != FT_GLYPH_FORMAT_OUTLINE && slot->format != FT_GLYPH_FORMAT_BITMAP ) return; - /* some reasonable strength */ - xstr = FT_MulFix( face->units_per_EM, - face->size->metrics.y_scale ) / 24; - ystr = xstr; + /* express deltas in pixels in 26.6 format */ + xstr = (FT_Pos)size->metrics.x_ppem * xdelta / 1024; + ystr = (FT_Pos)size->metrics.y_ppem * ydelta / 1024; if ( slot->format == FT_GLYPH_FORMAT_OUTLINE ) FT_Outline_EmboldenXY( &slot->outline, xstr, ystr ); -- cgit v1.2.3 From 7be364c6a22c5a4a0087d1ac2c40b695b16e1907 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 16 Mar 2023 05:25:36 +0100 Subject: * include/freetype/ftsystem.h (FT_Stream_IoFunc): Improve documentation. Fixes #1208. --- include/freetype/ftsystem.h | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/include/freetype/ftsystem.h b/include/freetype/ftsystem.h index a995b078d..3a08f4912 100644 --- a/include/freetype/ftsystem.h +++ b/include/freetype/ftsystem.h @@ -229,8 +229,7 @@ FT_BEGIN_HEADER * A handle to the source stream. * * offset :: - * The offset from the start of the stream to seek to if this is a seek - * operation (see note). + * The offset from the start of the stream to seek to. * * buffer :: * The address of the read buffer. @@ -239,16 +238,9 @@ FT_BEGIN_HEADER * The number of bytes to read from the stream. * * @return: - * The number of bytes effectively read by the stream. - * - * @note: - * This function performs a seek *or* a read operation depending on the - * argument values. If `count` is zero, the operation is a seek to - * `offset` bytes. If `count` is >~0, the operation is a read of `count` - * bytes from the current position in the stream, and the `offset` value - * should be ignored. - * - * For seek operations, a non-zero return value indicates an error. + * If count >~0, return the number of bytes effectively read by the + * stream (after seeking to `offset`). If count ==~0, return the status + * of the seek operation (non-zero indicates an error). * */ typedef unsigned long -- cgit v1.2.3 From ef636696524b081f1b8819eb0c6a0b932d35757d Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Fri, 17 Mar 2023 23:25:45 -0400 Subject: [truetype] Clean up zeroing and local variables. * src/truetype/ttgload.c (TT_Process_Simple_Glyph): Avoid zeroing. (load_truetype_glyph): Avoid zeroing and clean local variables. --- src/truetype/ttgload.c | 47 ++++++++++++++++++----------------------------- 1 file changed, 18 insertions(+), 29 deletions(-) diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index b7710f2c6..4defa8792 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -938,7 +938,7 @@ if ( !IS_DEFAULT_INSTANCE( FT_FACE( loader->face ) ) ) { - if ( FT_NEW_ARRAY( unrounded, n_points ) ) + if ( FT_QNEW_ARRAY( unrounded, n_points ) ) goto Exit; /* Deltas apply to the unscaled data. */ @@ -1839,10 +1839,7 @@ short i, limit; FT_SubGlyph subglyph; - FT_Outline outline; - FT_Vector* points = NULL; - char* tags = NULL; - short* contours = NULL; + FT_Outline outline = { 0, 0, NULL, NULL, NULL, 0 }; FT_Vector* unrounded = NULL; @@ -1850,18 +1847,14 @@ /* construct an outline structure for */ /* communication with `TT_Vary_Apply_Glyph_Deltas' */ - outline.n_contours = outline.n_points = limit; - - outline.points = NULL; - outline.tags = NULL; - outline.contours = NULL; - - if ( FT_NEW_ARRAY( points, limit + 4 ) || - FT_NEW_ARRAY( tags, limit + 4 ) || - FT_NEW_ARRAY( contours, limit + 4 ) || - FT_NEW_ARRAY( unrounded, limit + 4 ) ) + if ( FT_QNEW_ARRAY( outline.points, limit + 4 ) || + FT_QNEW_ARRAY( outline.tags, limit ) || + FT_QNEW_ARRAY( outline.contours, limit ) || + FT_QNEW_ARRAY( unrounded, limit + 4 ) ) goto Exit1; + outline.n_contours = outline.n_points = limit; + subglyph = gloader->current.subglyphs; for ( i = 0; i < limit; i++, subglyph++ ) @@ -1869,20 +1862,16 @@ /* applying deltas for anchor points doesn't make sense, */ /* but we don't have to specially check this since */ /* unused delta values are zero anyways */ - points[i].x = subglyph->arg1; - points[i].y = subglyph->arg2; - tags[i] = 1; - contours[i] = i; + outline.points[i].x = subglyph->arg1; + outline.points[i].y = subglyph->arg2; + outline.tags[i] = ON_CURVE_POINT; + outline.contours[i] = i; } - points[i++] = loader->pp1; - points[i++] = loader->pp2; - points[i++] = loader->pp3; - points[i ] = loader->pp4; - - outline.points = points; - outline.tags = tags; - outline.contours = contours; + outline.points[i++] = loader->pp1; + outline.points[i++] = loader->pp2; + outline.points[i++] = loader->pp3; + outline.points[i ] = loader->pp4; /* this call provides additional offsets */ /* for each component's translation */ @@ -1897,8 +1886,8 @@ { if ( subglyph->flags & ARGS_ARE_XY_VALUES ) { - subglyph->arg1 = (FT_Int16)points[i].x; - subglyph->arg2 = (FT_Int16)points[i].y; + subglyph->arg1 = (FT_Int16)outline.points[i].x; + subglyph->arg2 = (FT_Int16)outline.points[i].y; } } -- cgit v1.2.3 From 8fc6df1028ba7173fbcc467a4402bb7ef8a84f8f Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Fri, 17 Mar 2023 23:35:10 -0400 Subject: * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Use for-loop. Even though we never call `TT_Load_Simple_Glyph` with zero contours, out of abundance of precaution, let's handle this case properly. --- src/truetype/ttgload.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index 4defa8792..534026a7c 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -388,7 +388,7 @@ cont_limit = cont + n_contours; last = -1; - do + for ( ; cont < cont_limit; cont++ ) { *cont = FT_NEXT_SHORT( p ); @@ -396,7 +396,7 @@ goto Invalid_Outline; last = *cont; - } while ( ++cont < cont_limit ); + } n_points = last + 1; -- cgit v1.2.3 From 4f0a55d15ed1c9af267ed8223cc2f04307a3d656 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sun, 19 Mar 2023 10:13:52 -0400 Subject: [cff] Rework the stream limit checks. The old stream limit checks, before 6986ddac1ece, were good but pointless for the crafted t2_strings. Checking limits there is not necessary as they are created to hold all data. By using two conditions, we can detect the actual crossing of the stream boundary as appropriate for the stream pointer only. The t2_strings parsing will not be triggering these checks. * src/cff/cffparse.c (cff_parser_within_limits): Removed. (cff_parse_real, cff_parse_integer): Redesign the stream limit check. (cff_parse_num, do fixed, cff_parse_fixed_dynamic): Update callers. --- src/cff/cffparse.c | 85 ++++++++++++++---------------------------------------- 1 file changed, 22 insertions(+), 63 deletions(-) diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c index 7476aed8e..35d4fead2 100644 --- a/src/cff/cffparse.c +++ b/src/cff/cffparse.c @@ -110,55 +110,14 @@ } - /* Assuming `first >= last'. */ - - static FT_Error - cff_parser_within_limits( CFF_Parser parser, - FT_Byte* first, - FT_Byte* last ) - { -#ifndef CFF_CONFIG_OPTION_OLD_ENGINE - - /* Fast path for regular FreeType builds with the "new" engine; */ - /* `first >= parser->start' can be assumed. */ - - FT_UNUSED( first ); - - return last < parser->limit ? FT_Err_Ok : FT_THROW( Invalid_Argument ); - -#else /* CFF_CONFIG_OPTION_OLD_ENGINE */ - - FT_ListNode node; - - - if ( first >= parser->start && - last < parser->limit ) - return FT_Err_Ok; - - node = parser->t2_strings.head; - - while ( node ) - { - CFF_T2_String t2 = (CFF_T2_String)node->data; - - - if ( first >= t2->start && - last < t2->limit ) - return FT_Err_Ok; - - node = node->next; - } - - return FT_THROW( Invalid_Argument ); - -#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */ - } - + /* The parser limit checks in the next two functions are supposed */ + /* to detect the immediate crossing of the stream boundary. They */ + /* shall not be triggered from the distant t2_strings buffers. */ /* read an integer */ static FT_Long - cff_parse_integer( CFF_Parser parser, - FT_Byte* start ) + cff_parse_integer( FT_Byte* start, + FT_Byte* limit ) { FT_Byte* p = start; FT_Int v = *p++; @@ -167,14 +126,14 @@ if ( v == 28 ) { - if ( cff_parser_within_limits( parser, p, p + 1 ) ) + if ( p + 2 > limit && limit >= p ) goto Bad; val = (FT_Short)( ( (FT_UShort)p[0] << 8 ) | p[1] ); } else if ( v == 29 ) { - if ( cff_parser_within_limits( parser, p, p + 3 ) ) + if ( p + 4 > limit && limit >= p ) goto Bad; val = (FT_Long)( ( (FT_ULong)p[0] << 24 ) | @@ -188,14 +147,14 @@ } else if ( v < 251 ) { - if ( cff_parser_within_limits( parser, p, p ) ) + if ( p + 1 > limit && limit >= p ) goto Bad; val = ( v - 247 ) * 256 + p[0] + 108; } else { - if ( cff_parser_within_limits( parser, p, p ) ) + if ( p + 1 > limit && limit >= p ) goto Bad; val = -( v - 251 ) * 256 - p[0] - 108; @@ -244,10 +203,10 @@ /* read a real */ static FT_Fixed - cff_parse_real( CFF_Parser parser, - FT_Byte* start, - FT_Long power_ten, - FT_Long* scaling ) + cff_parse_real( FT_Byte* start, + FT_Byte* limit, + FT_Long power_ten, + FT_Long* scaling ) { FT_Byte* p = start; FT_Int nib; @@ -282,7 +241,7 @@ p++; /* Make sure we don't read past the end. */ - if ( cff_parser_within_limits( parser, p, p ) ) + if ( p + 1 > limit && limit >= p ) goto Bad; } @@ -319,7 +278,7 @@ p++; /* Make sure we don't read past the end. */ - if ( cff_parser_within_limits( parser, p, p ) ) + if ( p + 1 > limit && limit >= p ) goto Bad; } @@ -358,7 +317,7 @@ p++; /* Make sure we don't read past the end. */ - if ( cff_parser_within_limits( parser, p, p ) ) + if ( p + 1 > limit && limit >= p ) goto Bad; } @@ -525,7 +484,7 @@ if ( **d == 30 ) { /* binary-coded decimal is truncated to integer */ - return cff_parse_real( parser, *d, 0, NULL ) >> 16; + return cff_parse_real( *d, parser->limit, 0, NULL ) >> 16; } else if ( **d == 255 ) @@ -551,7 +510,7 @@ } else - return cff_parse_integer( parser, *d ); + return cff_parse_integer( *d, parser->limit ); } @@ -562,10 +521,10 @@ FT_Long scaling ) { if ( **d == 30 ) - return cff_parse_real( parser, *d, scaling, NULL ); + return cff_parse_real( *d, parser->limit, scaling, NULL ); else { - FT_Long val = cff_parse_integer( parser, *d ); + FT_Long val = cff_parse_integer( *d, parser->limit ); if ( scaling ) @@ -630,14 +589,14 @@ FT_ASSERT( scaling ); if ( **d == 30 ) - return cff_parse_real( parser, *d, 0, scaling ); + return cff_parse_real( *d, parser->limit, 0, scaling ); else { FT_Long number; FT_Int integer_length; - number = cff_parse_integer( parser, d[0] ); + number = cff_parse_integer( *d, parser->limit ); if ( number > 0x7FFFL ) { -- cgit v1.2.3 From 4d8db130ea4342317581bab65fc96365ce806b77 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Mon, 20 Mar 2023 16:53:51 -0400 Subject: [cff] Simplify `t2_strings` management in the old engine. * src/cff/cffparse.c (cff_parser_run): Allocate the charstring buffers and the list nodes together so that they can be freed at once. (finalize_t2_strings): Removed as no longer needed. (cff_parser_done): Updated. --- src/cff/cffparse.c | 56 +++++++----------------------------------------------- src/cff/cffparse.h | 9 --------- 2 files changed, 7 insertions(+), 58 deletions(-) diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c index 35d4fead2..a31f085d9 100644 --- a/src/cff/cffparse.c +++ b/src/cff/cffparse.c @@ -73,26 +73,6 @@ } -#ifdef CFF_CONFIG_OPTION_OLD_ENGINE - static void - finalize_t2_strings( FT_Memory memory, - void* data, - void* user ) - { - FT_UNUSED( user ); - - if ( data ) - { - CFF_T2_String t2 = (CFF_T2_String)data; - - - FT_FREE( t2->start ); - FT_FREE( data ); - } - } -#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */ - - FT_LOCAL_DEF( void ) cff_parser_done( CFF_Parser parser ) { @@ -102,10 +82,7 @@ FT_FREE( parser->stack ); #ifdef CFF_CONFIG_OPTION_OLD_ENGINE - FT_List_Finalize( &parser->t2_strings, - finalize_t2_strings, - memory, - NULL ); + FT_List_Finalize( &parser->t2_strings, NULL, memory, NULL ); #endif } @@ -1224,9 +1201,6 @@ FT_ULong charstring_len; FT_Fixed* stack; - FT_ListNode node; - CFF_T2_String t2; - FT_PtrDist t2_size; FT_Byte* q; @@ -1268,30 +1242,16 @@ /* Now copy the stack data in the temporary decoder object, */ /* converting it back to charstring number representations */ /* (this is ugly, I know). */ - if ( FT_NEW( node ) ) - goto Exit; - - FT_List_Add( &parser->t2_strings, node ); - - if ( FT_NEW( t2 ) ) - goto Exit; - - node->data = t2; - - /* `5' is the conservative upper bound of required bytes per stack */ - /* element. */ - - t2_size = 5 * ( decoder.top - decoder.stack ); - - if ( FT_QALLOC( q, t2_size ) ) + /* The maximum required size is 5 bytes per stack element. */ + if ( FT_QALLOC( q, 2 * sizeof ( FT_ListNode ) + + 5 * ( decoder.top - decoder.stack ) ) ) goto Exit; - t2->start = q; - t2->limit = q + t2_size; + FT_List_Add( &parser->t2_strings, (FT_ListNode)q ); - stack = decoder.stack; + q += 2 * sizeof ( FT_ListNode ); - while ( stack < decoder.top ) + for ( stack = decoder.stack; stack < decoder.top; stack++ ) { FT_Long num = *stack; @@ -1332,8 +1292,6 @@ *q++ = (FT_Byte)( num & 0xFF ); } } - - stack++; } } #endif /* CFF_CONFIG_OPTION_OLD_ENGINE */ diff --git a/src/cff/cffparse.h b/src/cff/cffparse.h index 58d59fa4a..b6378a8e8 100644 --- a/src/cff/cffparse.h +++ b/src/cff/cffparse.h @@ -133,15 +133,6 @@ FT_BEGIN_HEADER FT_END_HEADER -#ifdef CFF_CONFIG_OPTION_OLD_ENGINE - typedef struct CFF_T2_String_ - { - FT_Byte* start; - FT_Byte* limit; - - } CFF_T2_StringRec, *CFF_T2_String; -#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */ - #endif /* CFFPARSE_H_ */ -- cgit v1.2.3 From 4679fcb666494d200097845b4bd409fafe7eba5a Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Wed, 29 Mar 2023 00:21:00 -0400 Subject: [sfnt] Streamline POST format 2.0 handing (cont'd). * src/sfnt/ttpost.c (load_format_20): Co-allocate the string data and their pointers, which makes it easier to handle and free them. (tt_face_free_ps_names): Updated. * include/freetype/internal/tttypes.h (TT_Post_20): Update type. --- include/freetype/internal/tttypes.h | 2 +- src/sfnt/ttpost.c | 36 ++++++++++++------------------------ 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h index 3b521924c..fee036bb8 100644 --- a/include/freetype/internal/tttypes.h +++ b/include/freetype/internal/tttypes.h @@ -803,7 +803,7 @@ FT_BEGIN_HEADER FT_UShort num_glyphs; FT_UShort num_names; FT_UShort* glyph_indices; - FT_Char** glyph_names; + FT_Byte** glyph_names; } TT_Post_20Rec, *TT_Post_20; diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c index d3ec757ee..81992b3fb 100644 --- a/src/sfnt/ttpost.c +++ b/src/sfnt/ttpost.c @@ -167,8 +167,7 @@ FT_UShort num_names; FT_UShort* glyph_indices = NULL; - FT_Char** name_strings = NULL; - FT_Byte* strings = NULL; + FT_Byte** name_strings = NULL; if ( FT_READ_USHORT( num_glyphs ) ) @@ -229,13 +228,17 @@ { FT_UShort n; FT_ULong p; + FT_Byte* strings; post_len -= (FT_ULong)num_glyphs * 2UL + 2; - if ( FT_QALLOC( strings, post_len + 1 ) || - FT_STREAM_READ( strings, post_len ) || - FT_QNEW_ARRAY( name_strings, num_names ) ) + if ( FT_QALLOC( name_strings, num_names * sizeof ( FT_Byte* ) + + post_len + 1 ) ) + goto Fail; + + strings = (FT_Byte*)( name_strings + num_names ); + if ( FT_STREAM_READ( strings, post_len ) ) goto Fail; /* convert from Pascal- to C-strings and set pointers */ @@ -251,7 +254,7 @@ } strings[p] = 0; - name_strings[n] = (FT_Char*)strings + p + 1; + name_strings[n] = strings + p + 1; p += len + 1; } strings[post_len] = 0; @@ -259,22 +262,11 @@ /* deal with missing or insufficient string data */ if ( n < num_names ) { - if ( post_len == 0 ) - { - /* fake empty string */ - if ( FT_QREALLOC( strings, 1, 2 ) ) - goto Fail; + FT_TRACE4(( "load_format_20: %hu PostScript names are truncated\n", + num_names - n )); - post_len = 1; - strings[post_len] = 0; - } - - FT_ERROR(( "load_format_20:" - " all entries in post table are already parsed," - " using NULL names for gid %d - %d\n", - n, num_names - 1 )); for ( ; n < num_names; n++ ) - name_strings[n] = (FT_Char*)strings + post_len; + name_strings[n] = strings + post_len; } } @@ -292,7 +284,6 @@ Fail: FT_FREE( name_strings ); - FT_FREE( strings ); FT_FREE( glyph_indices ); Exit: @@ -427,9 +418,6 @@ if ( table->num_names ) { - table->glyph_names[0]--; - FT_FREE( table->glyph_names[0] ); - FT_FREE( table->glyph_names ); table->num_names = 0; } -- cgit v1.2.3 From 0db6997026a05798eb0cbcbb3b37bf6121fb5f6a Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Thu, 30 Mar 2023 09:06:35 -0400 Subject: * src/sfnt/ttpost.c (load_format_20): Simplify comutations. --- src/sfnt/ttpost.c | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c index 81992b3fb..4ab3536b2 100644 --- a/src/sfnt/ttpost.c +++ b/src/sfnt/ttpost.c @@ -164,7 +164,7 @@ FT_Error error; FT_Int num_glyphs; - FT_UShort num_names; + FT_UShort num_names = 0; FT_UShort* glyph_indices = NULL; FT_Byte** name_strings = NULL; @@ -186,9 +186,10 @@ goto Exit; } - /* load the indices */ + /* load the indices and note their maximum */ { - FT_Int n; + FT_Int n; + FT_UShort idx; if ( FT_QNEW_ARRAY( glyph_indices, num_glyphs ) || @@ -196,32 +197,18 @@ goto Fail; for ( n = 0; n < num_glyphs; n++ ) - glyph_indices[n] = FT_GET_USHORT(); + { + glyph_indices[n] = idx = FT_GET_USHORT(); + + if ( idx > num_names ) + num_names = idx; + } FT_FRAME_EXIT(); } /* compute number of names stored in table */ - { - FT_Int n; - - - num_names = 0; - - for ( n = 0; n < num_glyphs; n++ ) - { - FT_Int idx; - - - idx = glyph_indices[n]; - if ( idx >= 258 ) - { - idx -= 257; - if ( idx > num_names ) - num_names = (FT_UShort)idx; - } - } - } + num_names = num_names > 257 ? num_names - 257 : 0; /* now load the name strings */ if ( num_names ) -- cgit v1.2.3 From 6d7b8b22c4f4ca6cde1998997ae4ea2aa6e57d26 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Fri, 31 Mar 2023 23:17:46 -0400 Subject: [sfnt] Miscellaneous POST clean-ups. * src/sfnt/ttpost.c (load_format_20): Decrease casts. (load_format_25): Check the table length and impose a theoretical glyph number limit usable with 8-bit offset. Decrease casts. (load_post_names): Pass the mapping data length without 2 bytes. --- src/sfnt/ttpost.c | 49 ++++++++++++++++++++++++------------------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c index 4ab3536b2..40435c26f 100644 --- a/src/sfnt/ttpost.c +++ b/src/sfnt/ttpost.c @@ -163,7 +163,7 @@ FT_Memory memory = stream->memory; FT_Error error; - FT_Int num_glyphs; + FT_UShort num_glyphs; FT_UShort num_names = 0; FT_UShort* glyph_indices = NULL; @@ -179,8 +179,8 @@ /* There already exist fonts which have more than 32768 glyph names */ /* in this table, so the test for this threshold has been dropped. */ - if ( num_glyphs > face->max_profile.numGlyphs || - (FT_ULong)num_glyphs * 2UL > post_len - 2 ) + if ( num_glyphs > face->max_profile.numGlyphs || + (FT_ULong)num_glyphs * 2 > post_len ) { error = FT_THROW( Invalid_File_Format ); goto Exit; @@ -188,12 +188,12 @@ /* load the indices and note their maximum */ { - FT_Int n; + FT_UShort n; FT_UShort idx; if ( FT_QNEW_ARRAY( glyph_indices, num_glyphs ) || - FT_FRAME_ENTER( num_glyphs * 2L ) ) + FT_FRAME_ENTER( num_glyphs * 2 ) ) goto Fail; for ( n = 0; n < num_glyphs; n++ ) @@ -218,7 +218,7 @@ FT_Byte* strings; - post_len -= (FT_ULong)num_glyphs * 2UL + 2; + post_len -= (FT_ULong)num_glyphs * 2; if ( FT_QALLOC( name_strings, num_names * sizeof ( FT_Byte* ) + post_len + 1 ) ) @@ -262,8 +262,8 @@ TT_Post_20 table = &face->postscript_names.names.format_20; - table->num_glyphs = (FT_UShort)num_glyphs; - table->num_names = (FT_UShort)num_names; + table->num_glyphs = num_glyphs; + table->num_names = num_names; table->glyph_indices = glyph_indices; table->glyph_names = name_strings; } @@ -286,39 +286,38 @@ FT_Memory memory = stream->memory; FT_Error error; - FT_Int num_glyphs; + FT_UShort num_glyphs; FT_Char* offset_table = NULL; - FT_UNUSED( post_len ); - if ( FT_READ_USHORT( num_glyphs ) ) goto Exit; - /* check the number of glyphs */ + /* check the number of glyphs, including the theoretical limit */ if ( num_glyphs > face->max_profile.numGlyphs || - num_glyphs > 258 || - num_glyphs < 1 ) + num_glyphs > post_len || + num_glyphs > 257 + 128 ) { error = FT_THROW( Invalid_File_Format ); goto Exit; } - if ( FT_QNEW_ARRAY( offset_table, num_glyphs ) || - FT_STREAM_READ( offset_table, num_glyphs ) ) - goto Fail; - - /* now check the offset table */ + if ( num_glyphs ) { - FT_Int n; + FT_UShort n; + + if ( FT_QNEW_ARRAY( offset_table, num_glyphs ) || + FT_STREAM_READ( offset_table, num_glyphs ) ) + goto Fail; + /* now check the offset table for out-of-range values */ for ( n = 0; n < num_glyphs; n++ ) { - FT_Long idx = (FT_Long)n + offset_table[n]; + FT_Int idx = n + offset_table[n]; - if ( idx < 0 || idx > num_glyphs ) + if ( idx < 0 || idx > 257 ) { error = FT_THROW( Invalid_File_Format ); goto Fail; @@ -331,7 +330,7 @@ TT_Post_25 table = &face->postscript_names.names.format_25; - table->num_glyphs = (FT_UShort)num_glyphs; + table->num_glyphs = num_glyphs; table->offsets = offset_table; } @@ -370,9 +369,9 @@ /* now read postscript table */ if ( format == 0x00020000L && post_len >= 34 ) - error = load_format_20( face, stream, post_len - 32 ); + error = load_format_20( face, stream, post_len - 34 ); else if ( format == 0x00025000L && post_len >= 34 ) - error = load_format_25( face, stream, post_len - 32 ); + error = load_format_25( face, stream, post_len - 34 ); else error = FT_THROW( Invalid_File_Format ); -- cgit v1.2.3 From 9597a62bac07812f12111828195e51dcb4338a84 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sat, 1 Apr 2023 22:34:30 -0400 Subject: [sfnt] Consolidate POST version 2.0 and 2.5 (pt 1). The deprecated POST version 2.5 can be handled using the data structures of version 2.0. The goal is to reduce the footprint. * include/freetype/internal/tttypes.h (TT_Post_Names): Absorb and... (TT_Post_20, TT_Post_25): ... remove these structures. src/sfnt/ttpost.c (load_post_names, tt_face_get_ps_name, tt_face_free_ps_names, load_format_20): Updated accordingly. (load_format_25): ditto and convert offsets to glyph indices. --- include/freetype/internal/tttypes.h | 67 ++++--------------------------- src/sfnt/ttpost.c | 80 +++++++++++++++---------------------- 2 files changed, 40 insertions(+), 107 deletions(-) diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h index fee036bb8..dc790f932 100644 --- a/include/freetype/internal/tttypes.h +++ b/include/freetype/internal/tttypes.h @@ -779,13 +779,15 @@ FT_BEGIN_HEADER /************************************************************************** * * @struct: - * TT_Post_20Rec + * TT_Post_NamesRec * * @description: - * Postscript names sub-table, format 2.0. Stores the PS name of each - * glyph in the font face. + * Postscript names table, either format 2.0 or 2.5. * * @fields: + * loaded :: + * A flag to indicate whether the PS names are loaded. + * * num_glyphs :: * The number of named glyphs in the table. * @@ -798,69 +800,14 @@ FT_BEGIN_HEADER * glyph_names :: * The PS names not in Mac Encoding. */ - typedef struct TT_Post_20Rec_ + typedef struct TT_Post_NamesRec_ { + FT_Bool loaded; FT_UShort num_glyphs; FT_UShort num_names; FT_UShort* glyph_indices; FT_Byte** glyph_names; - } TT_Post_20Rec, *TT_Post_20; - - - /************************************************************************** - * - * @struct: - * TT_Post_25Rec - * - * @description: - * Postscript names sub-table, format 2.5. Stores the PS name of each - * glyph in the font face. - * - * @fields: - * num_glyphs :: - * The number of glyphs in the table. - * - * offsets :: - * An array of signed offsets in a normal Mac Postscript name encoding. - */ - typedef struct TT_Post_25_ - { - FT_UShort num_glyphs; - FT_Char* offsets; - - } TT_Post_25Rec, *TT_Post_25; - - - /************************************************************************** - * - * @struct: - * TT_Post_NamesRec - * - * @description: - * Postscript names table, either format 2.0 or 2.5. - * - * @fields: - * loaded :: - * A flag to indicate whether the PS names are loaded. - * - * format_20 :: - * The sub-table used for format 2.0. - * - * format_25 :: - * The sub-table used for format 2.5. - */ - typedef struct TT_Post_NamesRec_ - { - FT_Bool loaded; - - union - { - TT_Post_20Rec format_20; - TT_Post_25Rec format_25; - - } names; - } TT_Post_NamesRec, *TT_Post_Names; diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c index 40435c26f..25643cbfd 100644 --- a/src/sfnt/ttpost.c +++ b/src/sfnt/ttpost.c @@ -259,7 +259,7 @@ /* all right, set table fields and exit successfully */ { - TT_Post_20 table = &face->postscript_names.names.format_20; + TT_Post_Names table = &face->postscript_names; table->num_glyphs = num_glyphs; @@ -286,8 +286,8 @@ FT_Memory memory = stream->memory; FT_Error error; - FT_UShort num_glyphs; - FT_Char* offset_table = NULL; + FT_UShort n, num_glyphs; + FT_UShort* glyph_indices = NULL; if ( FT_READ_USHORT( num_glyphs ) ) @@ -302,42 +302,40 @@ goto Exit; } - if ( num_glyphs ) - { - FT_UShort n; + /* load the indices and note their maximum */ + if ( FT_QNEW_ARRAY( glyph_indices, num_glyphs ) || + FT_FRAME_ENTER( num_glyphs ) ) + goto Fail; + for ( n = 0; n < num_glyphs; n++ ) + { + FT_Int idx = n + FT_GET_CHAR(); - if ( FT_QNEW_ARRAY( offset_table, num_glyphs ) || - FT_STREAM_READ( offset_table, num_glyphs ) ) - goto Fail; - /* now check the offset table for out-of-range values */ - for ( n = 0; n < num_glyphs; n++ ) + if ( idx < 0 || idx > 257 ) { - FT_Int idx = n + offset_table[n]; - - - if ( idx < 0 || idx > 257 ) - { - error = FT_THROW( Invalid_File_Format ); - goto Fail; - } + error = FT_THROW( Invalid_File_Format ); + goto Fail; } + + glyph_indices[n] = (FT_UShort)idx; } + FT_FRAME_EXIT(); + /* OK, set table fields and exit successfully */ { - TT_Post_25 table = &face->postscript_names.names.format_25; + TT_Post_Names table = &face->postscript_names; - table->num_glyphs = num_glyphs; - table->offsets = offset_table; + table->num_glyphs = num_glyphs; + table->glyph_indices = glyph_indices; } return FT_Err_Ok; Fail: - FT_FREE( offset_table ); + FT_FREE( glyph_indices ); Exit: return error; @@ -396,25 +394,19 @@ if ( format == 0x00020000L ) { - TT_Post_20 table = &names->names.format_20; - - - FT_FREE( table->glyph_indices ); - table->num_glyphs = 0; + FT_FREE( names->glyph_indices ); + names->num_glyphs = 0; - if ( table->num_names ) + if ( names->num_names ) { - FT_FREE( table->glyph_names ); - table->num_names = 0; + FT_FREE( names->glyph_names ); + names->num_names = 0; } } else if ( format == 0x00025000L ) { - TT_Post_25 table = &names->names.format_25; - - - FT_FREE( table->offsets ); - table->num_glyphs = 0; + FT_FREE( names->glyph_indices ); + names->num_glyphs = 0; } } names->loaded = 0; @@ -486,9 +478,6 @@ } else if ( format == 0x00020000L ) { - TT_Post_20 table = &names->names.format_20; - - if ( !names->loaded ) { error = load_post_names( face ); @@ -496,22 +485,19 @@ goto End; } - if ( idx < (FT_UInt)table->num_glyphs ) + if ( idx < (FT_UInt)names->num_glyphs ) { - FT_UShort name_index = table->glyph_indices[idx]; + FT_UShort name_index = names->glyph_indices[idx]; if ( name_index < 258 ) *PSname = MAC_NAME( name_index ); else - *PSname = (FT_String*)table->glyph_names[name_index - 258]; + *PSname = (FT_String*)names->glyph_names[name_index - 258]; } } else if ( format == 0x00025000L ) { - TT_Post_25 table = &names->names.format_25; - - if ( !names->loaded ) { error = load_post_names( face ); @@ -519,8 +505,8 @@ goto End; } - if ( idx < (FT_UInt)table->num_glyphs ) /* paranoid checking */ - *PSname = MAC_NAME( (FT_Int)idx + table->offsets[idx] ); + if ( idx < (FT_UInt)names->num_glyphs ) /* paranoid checking */ + *PSname = MAC_NAME( names->glyph_indices[idx] ); } /* nothing to do for format == 0x00030000L */ -- cgit v1.2.3 From 8f7b14552498bc64e859179d559635c0750eccdf Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sat, 1 Apr 2023 23:37:51 -0400 Subject: [sfnt] Consolidate POST version 2.0 and 2.5 (pt 2). * src/sfnt/ttpost.c (load_format_20, load_format_25): Update arguments and move shared calls and checks upstream to... (load_post_names): ... this function. (tt_face_free_ps_names, tt_face_get_ps_name): Updated. --- src/sfnt/ttpost.c | 168 ++++++++++++++++++++---------------------------------- 1 file changed, 61 insertions(+), 107 deletions(-) diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c index 25643cbfd..aa5127666 100644 --- a/src/sfnt/ttpost.c +++ b/src/sfnt/ttpost.c @@ -156,64 +156,51 @@ static FT_Error - load_format_20( TT_Face face, - FT_Stream stream, - FT_ULong post_len ) + load_format_20( TT_Post_Names names, + FT_Stream stream, + FT_UShort num_glyphs, + FT_ULong post_len ) { FT_Memory memory = stream->memory; FT_Error error; - FT_UShort num_glyphs; + FT_UShort n; FT_UShort num_names = 0; FT_UShort* glyph_indices = NULL; FT_Byte** name_strings = NULL; - if ( FT_READ_USHORT( num_glyphs ) ) - goto Exit; - - /* UNDOCUMENTED! The number of glyphs in this table can be smaller */ - /* than the value in the maxp table (cf. cyberbit.ttf). */ - - /* There already exist fonts which have more than 32768 glyph names */ - /* in this table, so the test for this threshold has been dropped. */ - - if ( num_glyphs > face->max_profile.numGlyphs || - (FT_ULong)num_glyphs * 2 > post_len ) + if ( (FT_ULong)num_glyphs * 2 > post_len ) { error = FT_THROW( Invalid_File_Format ); goto Exit; } /* load the indices and note their maximum */ - { - FT_UShort n; - FT_UShort idx; - + if ( FT_QNEW_ARRAY( glyph_indices, num_glyphs ) || + FT_FRAME_ENTER( num_glyphs * 2 ) ) + goto Fail; - if ( FT_QNEW_ARRAY( glyph_indices, num_glyphs ) || - FT_FRAME_ENTER( num_glyphs * 2 ) ) - goto Fail; + for ( n = 0; n < num_glyphs; n++ ) + { + FT_UShort idx = FT_GET_USHORT(); - for ( n = 0; n < num_glyphs; n++ ) - { - glyph_indices[n] = idx = FT_GET_USHORT(); - if ( idx > num_names ) - num_names = idx; - } + if ( idx > num_names ) + num_names = idx; - FT_FRAME_EXIT(); + glyph_indices[n] = idx; } + FT_FRAME_EXIT(); + /* compute number of names stored in table */ num_names = num_names > 257 ? num_names - 257 : 0; /* now load the name strings */ if ( num_names ) { - FT_UShort n; FT_ULong p; FT_Byte* strings; @@ -258,15 +245,11 @@ } /* all right, set table fields and exit successfully */ - { - TT_Post_Names table = &face->postscript_names; + names->num_glyphs = num_glyphs; + names->num_names = num_names; + names->glyph_indices = glyph_indices; + names->glyph_names = name_strings; - - table->num_glyphs = num_glyphs; - table->num_names = num_names; - table->glyph_indices = glyph_indices; - table->glyph_names = name_strings; - } return FT_Err_Ok; Fail: @@ -279,24 +262,21 @@ static FT_Error - load_format_25( TT_Face face, - FT_Stream stream, - FT_ULong post_len ) + load_format_25( TT_Post_Names names, + FT_Stream stream, + FT_UShort num_glyphs, + FT_ULong post_len ) { FT_Memory memory = stream->memory; FT_Error error; - FT_UShort n, num_glyphs; + FT_UShort n; FT_UShort* glyph_indices = NULL; - if ( FT_READ_USHORT( num_glyphs ) ) - goto Exit; - /* check the number of glyphs, including the theoretical limit */ - if ( num_glyphs > face->max_profile.numGlyphs || - num_glyphs > post_len || - num_glyphs > 257 + 128 ) + if ( num_glyphs > post_len || + num_glyphs > 258 + 128 ) { error = FT_THROW( Invalid_File_Format ); goto Exit; @@ -324,13 +304,8 @@ FT_FRAME_EXIT(); /* OK, set table fields and exit successfully */ - { - TT_Post_Names table = &face->postscript_names; - - - table->num_glyphs = num_glyphs; - table->glyph_indices = glyph_indices; - } + names->num_glyphs = num_glyphs; + names->glyph_indices = glyph_indices; return FT_Err_Ok; @@ -345,37 +320,37 @@ static FT_Error load_post_names( TT_Face face ) { - FT_Stream stream; - FT_Error error; - FT_Fixed format; + FT_Error error = FT_Err_Ok; + FT_Stream stream = face->root.stream; + FT_Fixed format = face->postscript.FormatType; FT_ULong post_len; + FT_UShort num_glyphs; - /* get a stream for the face's resource */ - stream = face->root.stream; - /* seek to the beginning of the PS names table */ error = face->goto_table( face, TTAG_post, stream, &post_len ); if ( error ) goto Exit; - format = face->postscript.FormatType; - - /* go to beginning of subtable */ - if ( FT_STREAM_SKIP( 32 ) ) + /* UNDOCUMENTED! The number of glyphs in this table can be smaller */ + /* than the value in the maxp table (cf. cyberbit.ttf). */ + if ( post_len < 34 || + FT_STREAM_SKIP( 32 ) || + FT_READ_USHORT( num_glyphs ) || + num_glyphs > face->max_profile.numGlyphs || + num_glyphs == 0 ) goto Exit; - /* now read postscript table */ - if ( format == 0x00020000L && post_len >= 34 ) - error = load_format_20( face, stream, post_len - 34 ); - else if ( format == 0x00025000L && post_len >= 34 ) - error = load_format_25( face, stream, post_len - 34 ); - else - error = FT_THROW( Invalid_File_Format ); - - face->postscript_names.loaded = 1; + /* now read postscript names data */ + if ( format == 0x00020000L ) + error = load_format_20( &face->postscript_names, stream, + num_glyphs, post_len - 34 ); + else if ( format == 0x00025000L ) + error = load_format_25( &face->postscript_names, stream, + num_glyphs, post_len - 34 ); Exit: + face->postscript_names.loaded = 1; /* even if failed */ return error; } @@ -385,30 +360,20 @@ { FT_Memory memory = face->root.memory; TT_Post_Names names = &face->postscript_names; - FT_Fixed format; - if ( names->loaded ) + if ( names->num_glyphs ) { - format = face->postscript.FormatType; - - if ( format == 0x00020000L ) - { - FT_FREE( names->glyph_indices ); - names->num_glyphs = 0; + FT_FREE( names->glyph_indices ); + names->num_glyphs = 0; + } - if ( names->num_names ) - { - FT_FREE( names->glyph_names ); - names->num_names = 0; - } - } - else if ( format == 0x00025000L ) - { - FT_FREE( names->glyph_indices ); - names->num_glyphs = 0; - } + if ( names->num_names ) + { + FT_FREE( names->glyph_names ); + names->num_names = 0; } + names->loaded = 0; } @@ -476,7 +441,8 @@ if ( idx < 258 ) /* paranoid checking */ *PSname = MAC_NAME( idx ); } - else if ( format == 0x00020000L ) + else if ( format == 0x00020000L || + format == 0x00025000L ) { if ( !names->loaded ) { @@ -492,22 +458,10 @@ if ( name_index < 258 ) *PSname = MAC_NAME( name_index ); - else + else /* only for version 2.0 */ *PSname = (FT_String*)names->glyph_names[name_index - 258]; } } - else if ( format == 0x00025000L ) - { - if ( !names->loaded ) - { - error = load_post_names( face ); - if ( error ) - goto End; - } - - if ( idx < (FT_UInt)names->num_glyphs ) /* paranoid checking */ - *PSname = MAC_NAME( names->glyph_indices[idx] ); - } /* nothing to do for format == 0x00030000L */ -- cgit v1.2.3 From 311b78fa1240863fc206c2162cba54597a93f598 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sun, 2 Apr 2023 09:24:16 -0400 Subject: * src/sfnt/ttpost.c: Formatting and comments. --- src/sfnt/ttpost.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c index aa5127666..f4e8fe508 100644 --- a/src/sfnt/ttpost.c +++ b/src/sfnt/ttpost.c @@ -195,7 +195,7 @@ FT_FRAME_EXIT(); - /* compute number of names stored in table */ + /* compute number of names stored in the table */ num_names = num_names > 257 ? num_names - 257 : 0; /* now load the name strings */ @@ -282,7 +282,7 @@ goto Exit; } - /* load the indices and note their maximum */ + /* load the indices and check their Mac range */ if ( FT_QNEW_ARRAY( glyph_indices, num_glyphs ) || FT_FRAME_ENTER( num_glyphs ) ) goto Fail; @@ -409,7 +409,6 @@ FT_String** PSname ) { FT_Error error; - TT_Post_Names names; FT_Fixed format; #ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES @@ -429,8 +428,6 @@ return FT_THROW( Unimplemented_Feature ); #endif - names = &face->postscript_names; - /* `.notdef' by default */ *PSname = MAC_NAME( 0 ); @@ -444,6 +441,9 @@ else if ( format == 0x00020000L || format == 0x00025000L ) { + TT_Post_Names names = &face->postscript_names; + + if ( !names->loaded ) { error = load_post_names( face ); @@ -466,6 +466,7 @@ /* nothing to do for format == 0x00030000L */ End: + /* post format errors ignored */ return FT_Err_Ok; } -- cgit v1.2.3 From 340767bf85b054595c42dd1c089318cb19d45899 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sun, 2 Apr 2023 22:00:59 -0400 Subject: * src/sfnt/ttpost.c (load_format_*): Streamline frame reading. --- src/sfnt/ttpost.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c index f4e8fe508..ac9de6e24 100644 --- a/src/sfnt/ttpost.c +++ b/src/sfnt/ttpost.c @@ -169,6 +169,7 @@ FT_UShort* glyph_indices = NULL; FT_Byte** name_strings = NULL; + FT_Byte* q; if ( (FT_ULong)num_glyphs * 2 > post_len ) @@ -182,9 +183,11 @@ FT_FRAME_ENTER( num_glyphs * 2 ) ) goto Fail; + q = (FT_Byte*)stream->cursor; + for ( n = 0; n < num_glyphs; n++ ) { - FT_UShort idx = FT_GET_USHORT(); + FT_UShort idx = FT_NEXT_USHORT( q ); if ( idx > num_names ) @@ -272,6 +275,7 @@ FT_UShort n; FT_UShort* glyph_indices = NULL; + FT_Byte* q; /* check the number of glyphs, including the theoretical limit */ @@ -287,9 +291,11 @@ FT_FRAME_ENTER( num_glyphs ) ) goto Fail; + q = (FT_Byte*)stream->cursor; + for ( n = 0; n < num_glyphs; n++ ) { - FT_Int idx = n + FT_GET_CHAR(); + FT_Int idx = n + FT_NEXT_CHAR( q ); if ( idx < 0 || idx > 257 ) -- cgit v1.2.3 From b0a4f99278aa7e14bd1d0d9e40ad28dce543fde6 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sun, 2 Apr 2023 22:45:48 -0400 Subject: * src/sfnt/ttpost.c (load_format_25): Do not abort frame reading. --- src/sfnt/ttpost.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c index ac9de6e24..1dfad4298 100644 --- a/src/sfnt/ttpost.c +++ b/src/sfnt/ttpost.c @@ -299,10 +299,7 @@ if ( idx < 0 || idx > 257 ) - { - error = FT_THROW( Invalid_File_Format ); - goto Fail; - } + idx = 0; glyph_indices[n] = (FT_UShort)idx; } -- cgit v1.2.3 From d25444333c07951bf16788862420e311799c0ad0 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Sat, 8 Apr 2023 23:15:41 -0400 Subject: [sfnt] Clean up CMAP{4,12,13} handling. This moves the charcode overflow checks upstream and turns some while-loops into the do-while ones to avoid the uninitialized warnings. This should slightly reduce the number of checks and jumps. * src/sfnt/ttcmap.c (tt_cmap{4,12,13}_next, tt_cmap{4.12.13}_char_map_linear): Remove the charcode overflow check. (tt_cmap{4,12,13}_char_map_binary): Ditto and use do-while. (tt_cmap{12,13}_char_next): Add the overflow check. --- src/sfnt/ttcmap.c | 106 ++++++++++++++---------------------------------------- 1 file changed, 27 insertions(+), 79 deletions(-) diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c index 820cd08e6..809d4b51f 100644 --- a/src/sfnt/ttcmap.c +++ b/src/sfnt/ttcmap.c @@ -794,9 +794,6 @@ FT_UInt charcode; - if ( cmap->cur_charcode >= 0xFFFFUL ) - goto Fail; - charcode = (FT_UInt)cmap->cur_charcode + 1; if ( charcode < cmap->cur_start ) @@ -882,7 +879,6 @@ charcode = cmap->cur_start; } - Fail: cmap->cur_charcode = (FT_UInt32)0xFFFFFFFFUL; cmap->cur_gindex = 0; } @@ -1104,25 +1100,19 @@ FT_UInt num_segs2, start, end, offset; FT_Int delta; FT_UInt i, num_segs; - FT_UInt32 charcode = *pcharcode; + FT_UInt32 charcode = *pcharcode + next; FT_UInt gindex = 0; FT_Byte* p; FT_Byte* q; p = cmap->data + 6; - num_segs2 = FT_PAD_FLOOR( TT_PEEK_USHORT( p ), 2 ); - - num_segs = num_segs2 >> 1; + num_segs = TT_PEEK_USHORT( p ) >> 1; if ( !num_segs ) return 0; - if ( next ) - charcode++; - - if ( charcode > 0xFFFFU ) - return 0; + num_segs2 = num_segs << 1; /* linear search */ p = cmap->data + 14; /* ends table */ @@ -1238,31 +1228,24 @@ FT_UInt num_segs2, start, end, offset; FT_Int delta; FT_UInt max, min, mid, num_segs; - FT_UInt charcode = (FT_UInt)*pcharcode; + FT_UInt charcode = (FT_UInt)*pcharcode + next; FT_UInt gindex = 0; FT_Byte* p; p = cmap->data + 6; - num_segs2 = FT_PAD_FLOOR( TT_PEEK_USHORT( p ), 2 ); + num_segs = TT_PEEK_USHORT( p ) >> 1; - if ( !num_segs2 ) + if ( !num_segs ) return 0; - num_segs = num_segs2 >> 1; - - /* make compiler happy */ - mid = num_segs; - end = 0xFFFFU; - - if ( next ) - charcode++; + num_segs2 = num_segs << 1; min = 0; max = num_segs; /* binary search */ - while ( min < max ) + do { mid = ( min + max ) >> 1; p = cmap->data + 14 + mid * 2; @@ -1445,6 +1428,7 @@ break; } } + while ( min < max ); if ( next ) { @@ -1454,12 +1438,8 @@ /* if `charcode' is not in any segment, then `mid' is */ /* the segment nearest to `charcode' */ - if ( charcode > end ) - { - mid++; - if ( mid == num_segs ) - return 0; - } + if ( charcode > end && ++mid == num_segs ) + return 0; if ( tt_cmap4_set_range( cmap4, mid ) ) { @@ -1474,7 +1454,6 @@ cmap4->cur_gindex = gindex; else { - cmap4->cur_charcode = charcode; tt_cmap4_next( cmap4 ); gindex = cmap4->cur_gindex; } @@ -2340,9 +2319,6 @@ FT_UInt gindex; - if ( cmap->cur_charcode >= 0xFFFFFFFFUL ) - goto Fail; - char_code = cmap->cur_charcode + 1; for ( n = cmap->cur_group; n < cmap->num_groups; n++ ) @@ -2400,7 +2376,7 @@ FT_UInt gindex = 0; FT_Byte* p = cmap->data + 12; FT_UInt32 num_groups = TT_PEEK_ULONG( p ); - FT_UInt32 char_code = *pchar_code; + FT_UInt32 char_code = *pchar_code + next; FT_UInt32 start, end, start_id; FT_UInt32 max, min, mid; @@ -2408,23 +2384,11 @@ if ( !num_groups ) return 0; - /* make compiler happy */ - mid = num_groups; - end = 0xFFFFFFFFUL; - - if ( next ) - { - if ( char_code >= 0xFFFFFFFFUL ) - return 0; - - char_code++; - } - min = 0; max = num_groups; /* binary search */ - while ( min < max ) + do { mid = ( min + max ) >> 1; p = cmap->data + 16 + 12 * mid; @@ -2448,6 +2412,7 @@ break; } } + while ( min < max ); if ( next ) { @@ -2458,12 +2423,8 @@ /* if `char_code' is not in any group, then `mid' is */ /* the group nearest to `char_code' */ - if ( char_code > end ) - { - mid++; - if ( mid == num_groups ) - return 0; - } + if ( char_code > end && ++mid == num_groups ) + return 0; cmap12->valid = 1; cmap12->cur_charcode = char_code; @@ -2505,6 +2466,9 @@ FT_UInt gindex; + if ( *pchar_code >= 0xFFFFFFFFUL ) + return 0; + /* no need to search */ if ( cmap12->valid && cmap12->cur_charcode == *pchar_code ) { @@ -2688,9 +2652,6 @@ FT_UInt gindex; - if ( cmap->cur_charcode >= 0xFFFFFFFFUL ) - goto Fail; - char_code = cmap->cur_charcode + 1; for ( n = cmap->cur_group; n < cmap->num_groups; n++ ) @@ -2718,7 +2679,6 @@ } } - Fail: cmap->valid = 0; } @@ -2731,7 +2691,7 @@ FT_UInt gindex = 0; FT_Byte* p = cmap->data + 12; FT_UInt32 num_groups = TT_PEEK_ULONG( p ); - FT_UInt32 char_code = *pchar_code; + FT_UInt32 char_code = *pchar_code + next; FT_UInt32 start, end; FT_UInt32 max, min, mid; @@ -2739,23 +2699,11 @@ if ( !num_groups ) return 0; - /* make compiler happy */ - mid = num_groups; - end = 0xFFFFFFFFUL; - - if ( next ) - { - if ( char_code >= 0xFFFFFFFFUL ) - return 0; - - char_code++; - } - min = 0; max = num_groups; /* binary search */ - while ( min < max ) + do { mid = ( min + max ) >> 1; p = cmap->data + 16 + 12 * mid; @@ -2774,6 +2722,7 @@ break; } } + while ( min < max ); if ( next ) { @@ -2784,12 +2733,8 @@ /* if `char_code' is not in any group, then `mid' is */ /* the group nearest to `char_code' */ - if ( char_code > end ) - { - mid++; - if ( mid == num_groups ) - return 0; - } + if ( char_code > end && ++mid == num_groups ) + return 0; cmap13->valid = 1; cmap13->cur_charcode = char_code; @@ -2831,6 +2776,9 @@ FT_UInt gindex; + if ( *pchar_code >= 0xFFFFFFFFUL ) + return 0; + /* no need to search */ if ( cmap13->valid && cmap13->cur_charcode == *pchar_code ) { -- cgit v1.2.3 From 1a4c18f7cb70a2ae4fa209bb75a6c6c5b6ace0f2 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Mon, 10 Apr 2023 15:30:43 +0000 Subject: Align `char_next` return types. This is mostly cosmetic because FT_UInt and FT_UInt32 are likely identical. * src/sfnt/ttcmap.c, src/cff/cffcmap.c, src/psaux/t1cmap.c, src/psnames/psmodule.c, include/freetype/internal/service/svpcsmap.h, src/pfr/pfrcmap.c, src/winfonts/winfnt.c (*_char_next): return FT_UInt. --- include/freetype/internal/services/svpscmap.h | 2 +- src/cff/cffcmap.c | 4 ++-- src/pfr/pfrcmap.c | 2 +- src/psaux/t1cmap.c | 6 +++--- src/psnames/psmodule.c | 2 +- src/sfnt/ttcmap.c | 20 ++++++++++---------- src/winfonts/winfnt.c | 2 +- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/include/freetype/internal/services/svpscmap.h b/include/freetype/internal/services/svpscmap.h index fd99d857e..6e599f3aa 100644 --- a/include/freetype/internal/services/svpscmap.h +++ b/include/freetype/internal/services/svpscmap.h @@ -97,7 +97,7 @@ FT_BEGIN_HEADER (*PS_Unicodes_CharIndexFunc)( PS_Unicodes unicodes, FT_UInt32 unicode ); - typedef FT_UInt32 + typedef FT_UInt (*PS_Unicodes_CharNextFunc)( PS_Unicodes unicodes, FT_UInt32 *unicode ); diff --git a/src/cff/cffcmap.c b/src/cff/cffcmap.c index 6ed314322..4988d7955 100644 --- a/src/cff/cffcmap.c +++ b/src/cff/cffcmap.c @@ -69,7 +69,7 @@ } - FT_CALLBACK_DEF( FT_UInt32 ) + FT_CALLBACK_DEF( FT_UInt ) cff_cmap_encoding_char_next( CFF_CMapStd cmap, FT_UInt32 *pchar_code ) { @@ -197,7 +197,7 @@ } - FT_CALLBACK_DEF( FT_UInt32 ) + FT_CALLBACK_DEF( FT_UInt ) cff_cmap_unicode_char_next( PS_Unicodes unicodes, FT_UInt32 *pchar_code ) { diff --git a/src/pfr/pfrcmap.c b/src/pfr/pfrcmap.c index 312a9ffe1..b49873694 100644 --- a/src/pfr/pfrcmap.c +++ b/src/pfr/pfrcmap.c @@ -96,7 +96,7 @@ } - FT_CALLBACK_DEF( FT_UInt32 ) + FT_CALLBACK_DEF( FT_UInt ) pfr_cmap_char_next( PFR_CMap cmap, FT_UInt32 *pchar_code ) { diff --git a/src/psaux/t1cmap.c b/src/psaux/t1cmap.c index bf0a393b4..f94b544f2 100644 --- a/src/psaux/t1cmap.c +++ b/src/psaux/t1cmap.c @@ -95,7 +95,7 @@ } - FT_CALLBACK_DEF( FT_UInt32 ) + FT_CALLBACK_DEF( FT_UInt ) t1_cmap_std_char_next( T1_CMapStd cmap, FT_UInt32 *pchar_code ) { @@ -232,7 +232,7 @@ } - FT_CALLBACK_DEF( FT_UInt32 ) + FT_CALLBACK_DEF( FT_UInt ) t1_cmap_custom_char_next( T1_CMapCustom cmap, FT_UInt32 *pchar_code ) { @@ -341,7 +341,7 @@ } - FT_CALLBACK_DEF( FT_UInt32 ) + FT_CALLBACK_DEF( FT_UInt ) t1_cmap_unicode_char_next( PS_Unicodes unicodes, FT_UInt32 *pchar_code ) { diff --git a/src/psnames/psmodule.c b/src/psnames/psmodule.c index db454e558..d8a2cc764 100644 --- a/src/psnames/psmodule.c +++ b/src/psnames/psmodule.c @@ -453,7 +453,7 @@ } - static FT_UInt32 + static FT_UInt ps_unicodes_char_next( PS_Unicodes table, FT_UInt32 *unicode ) { diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c index 809d4b51f..e5ea6f1e8 100644 --- a/src/sfnt/ttcmap.c +++ b/src/sfnt/ttcmap.c @@ -138,7 +138,7 @@ } - FT_CALLBACK_DEF( FT_UInt32 ) + FT_CALLBACK_DEF( FT_UInt ) tt_cmap0_char_next( TT_CMap cmap, FT_UInt32 *pchar_code ) { @@ -491,7 +491,7 @@ } - FT_CALLBACK_DEF( FT_UInt32 ) + FT_CALLBACK_DEF( FT_UInt ) tt_cmap2_char_next( TT_CMap cmap, FT_UInt32 *pcharcode ) { @@ -1481,7 +1481,7 @@ } - FT_CALLBACK_DEF( FT_UInt32 ) + FT_CALLBACK_DEF( FT_UInt ) tt_cmap4_char_next( TT_CMap cmap, FT_UInt32 *pchar_code ) { @@ -1640,7 +1640,7 @@ } - FT_CALLBACK_DEF( FT_UInt32 ) + FT_CALLBACK_DEF( FT_UInt ) tt_cmap6_char_next( TT_CMap cmap, FT_UInt32 *pchar_code ) { @@ -1911,7 +1911,7 @@ } - FT_CALLBACK_DEF( FT_UInt32 ) + FT_CALLBACK_DEF( FT_UInt ) tt_cmap8_char_next( TT_CMap cmap, FT_UInt32 *pchar_code ) { @@ -2109,7 +2109,7 @@ } - FT_CALLBACK_DEF( FT_UInt32 ) + FT_CALLBACK_DEF( FT_UInt ) tt_cmap10_char_next( TT_CMap cmap, FT_UInt32 *pchar_code ) { @@ -2458,7 +2458,7 @@ } - FT_CALLBACK_DEF( FT_UInt32 ) + FT_CALLBACK_DEF( FT_UInt ) tt_cmap12_char_next( TT_CMap cmap, FT_UInt32 *pchar_code ) { @@ -2768,7 +2768,7 @@ } - FT_CALLBACK_DEF( FT_UInt32 ) + FT_CALLBACK_DEF( FT_UInt ) tt_cmap13_char_next( TT_CMap cmap, FT_UInt32 *pchar_code ) { @@ -3101,7 +3101,7 @@ } - FT_CALLBACK_DEF( FT_UInt32 ) + FT_CALLBACK_DEF( FT_UInt ) tt_cmap14_char_next( TT_CMap cmap, FT_UInt32 *pchar_code ) { @@ -3671,7 +3671,7 @@ } - FT_CALLBACK_DEF( FT_UInt32 ) + FT_CALLBACK_DEF( FT_UInt ) tt_cmap_unicode_char_next( PS_Unicodes unicodes, FT_UInt32 *pchar_code ) { diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c index fa73ae4a9..261540f25 100644 --- a/src/winfonts/winfnt.c +++ b/src/winfonts/winfnt.c @@ -656,7 +656,7 @@ } - static FT_UInt32 + static FT_UInt fnt_cmap_char_next( FNT_CMap cmap, FT_UInt32 *pchar_code ) { -- cgit v1.2.3 From e77d8ba87cf24c4bd07c5c4f23b17e5e4d4f433b Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Mon, 10 Apr 2023 15:17:17 -0400 Subject: * src/cff/cffcmap.c (cff_cmap_encoding_char_next): Abbreviate. --- src/cff/cffcmap.c | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/src/cff/cffcmap.c b/src/cff/cffcmap.c index 4988d7955..94077c596 100644 --- a/src/cff/cffcmap.c +++ b/src/cff/cffcmap.c @@ -77,28 +77,16 @@ FT_UInt32 char_code = *pchar_code; - *pchar_code = 0; - - if ( char_code < 255 ) + while ( char_code < 255 ) { - FT_UInt code = (FT_UInt)( char_code + 1 ); - - - for (;;) + result = cmap->gids[++char_code]; + if ( result ) { - if ( code >= 256 ) - break; - - result = cmap->gids[code]; - if ( result != 0 ) - { - *pchar_code = code; - break; - } - - code++; + *pchar_code = char_code; + break; } } + return result; } -- cgit v1.2.3 From e78e2d29a95baf6053e30cc9422aa20319259803 Mon Sep 17 00:00:00 2001 From: Ben Wagner Date: Thu, 6 Apr 2023 11:16:29 -0400 Subject: [sfnt, truetype] Add `size_reset` to `MetricsVariations`. This is a generalization of commit ``` commit e6699596af5c5d6f0ae0ea06e19df87dce088df8 Author: Werner Lemberg Date: Thu Feb 2 11:38:04 2017 +0100 [truetype] Fix MVAR post-action handling. ``` It is also possible for plain `CFF ` style fonts to contain an `fvar` and `MVAR` table and use `cff_metrics_adjust`. `tt_size_reset` should only be called with `TT_Size` and never with `CFF_Size`. Allow the "metrics-variations" service to specify the correct function (if any) to reset `FT_Size`s after adjusting metrics. * src/truetype/ttobjs.c (tt_size_reset): Split off some functionality into... (tt_size_reset_height): ... this new function. * src/truetype/ttdriver.c (tt_service_metrics_variations): Add `size_reset`. (tt_size_select, tt_size_request): Updated. * src/truetype/ttobjs.h: Updated. * include/freetype/internal/services/svmetric.h (MetricsVariations): Add `size_reset`. (FT_DEFINE_SERVICE_METRICSVARIATIONSREC): Updated. * include/freetype/internal/tttypes.h (TT_FaceRec_): Rename `var` to `tt_var` and add `face_var`. * src/cff/cffdrivr.c (cff_service_metrics_variations): Add `size_reset`. (cff_hadvance_adjust, cff_metrics_adjust): Updated. * src/cff/cffobjs.c (cff_face_init): Use `face_var`. * src/sfnt/sfobjs.c (sfnt_init_face): Initialize `face_var`. * src/sfnt/ttmtx.c (tt_face_get_metrics): Use `tt_var`. * src/truetype/ttgxvar.c (tt_size_reset_iterator): Renamed to... (ft_size_reset_iterator): ... this new function. Call `size_reset`. (tt_apply_mvar): Pass `size_reset` to `ft_size_reset_iterator`. Fixes #1211 --- include/freetype/internal/services/svmetric.h | 10 ++++- include/freetype/internal/tttypes.h | 10 ++++- src/cff/cffdrivr.c | 9 ++-- src/cff/cffobjs.c | 6 ++- src/sfnt/sfobjs.c | 14 ++++-- src/sfnt/ttmtx.c | 2 +- src/truetype/ttdriver.c | 7 +-- src/truetype/ttgxvar.c | 23 +++++----- src/truetype/ttobjs.c | 62 +++++++++++++++------------ src/truetype/ttobjs.h | 6 ++- 10 files changed, 93 insertions(+), 56 deletions(-) diff --git a/include/freetype/internal/services/svmetric.h b/include/freetype/internal/services/svmetric.h index e588ea487..d067dc977 100644 --- a/include/freetype/internal/services/svmetric.h +++ b/include/freetype/internal/services/svmetric.h @@ -77,6 +77,9 @@ FT_BEGIN_HEADER typedef void (*FT_Metrics_Adjust_Func)( FT_Face face ); + typedef void + (*FT_Size_Reset_Func)( FT_Size size ); + FT_DEFINE_SERVICE( MetricsVariations ) { @@ -90,6 +93,7 @@ FT_BEGIN_HEADER FT_VOrg_Adjust_Func vorg_adjust; FT_Metrics_Adjust_Func metrics_adjust; + FT_Size_Reset_Func size_reset; }; @@ -101,7 +105,8 @@ FT_BEGIN_HEADER tsb_adjust_, \ bsb_adjust_, \ vorg_adjust_, \ - metrics_adjust_ ) \ + metrics_adjust_, \ + size_reset_ ) \ static const FT_Service_MetricsVariationsRec class_ = \ { \ hadvance_adjust_, \ @@ -111,7 +116,8 @@ FT_BEGIN_HEADER tsb_adjust_, \ bsb_adjust_, \ vorg_adjust_, \ - metrics_adjust_ \ + metrics_adjust_, \ + size_reset_ \ }; /* */ diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h index dc790f932..d257d05bd 100644 --- a/include/freetype/internal/tttypes.h +++ b/include/freetype/internal/tttypes.h @@ -1455,8 +1455,14 @@ FT_BEGIN_HEADER void* mm; /* a typeless pointer to the FT_Service_MetricsVariationsRec table */ - /* used to handle the HVAR, VVAR, and MVAR OpenType tables */ - void* var; + /* used to handle the HVAR, VVAR, and MVAR OpenType tables by the */ + /* "truetype" driver */ + void* tt_var; + + /* a typeless pointer to the FT_Service_MetricsVariationsRec table */ + /* used to handle the HVAR, VVAR, and MVAR OpenType tables by this */ + /* TT_Face's driver */ + void* face_var; #endif /* a typeless pointer to the PostScript Aux service */ diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index 4e2e0e00d..688c4c0b3 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -1046,7 +1046,8 @@ FT_UInt gindex, FT_Int *avalue ) { - FT_Service_MetricsVariations var = (FT_Service_MetricsVariations)face->var; + FT_Service_MetricsVariations + var = (FT_Service_MetricsVariations)face->tt_var; return var->hadvance_adjust( FT_FACE( face ), gindex, avalue ); @@ -1056,7 +1057,8 @@ static void cff_metrics_adjust( CFF_Face face ) { - FT_Service_MetricsVariations var = (FT_Service_MetricsVariations)face->var; + FT_Service_MetricsVariations + var = (FT_Service_MetricsVariations)face->tt_var; var->metrics_adjust( FT_FACE( face ) ); @@ -1075,7 +1077,8 @@ (FT_BSB_Adjust_Func) NULL, /* bsb_adjust */ (FT_VOrg_Adjust_Func) NULL, /* vorg_adjust */ - (FT_Metrics_Adjust_Func) cff_metrics_adjust /* metrics_adjust */ + (FT_Metrics_Adjust_Func) cff_metrics_adjust, /* metrics_adjust */ + (FT_Size_Reset_Func) NULL /* size_reset */ ) #endif diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index 3e94a283e..9608a4178 100644 --- a/src/cff/cffobjs.c +++ b/src/cff/cffobjs.c @@ -719,8 +719,10 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT { - FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; - FT_Service_MetricsVariations var = (FT_Service_MetricsVariations)face->var; + FT_Service_MultiMasters + mm = (FT_Service_MultiMasters)face->mm; + FT_Service_MetricsVariations + var = (FT_Service_MetricsVariations)face->face_var; FT_UInt instance_index = (FT_UInt)face_index >> 16; diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c index 6469da9ab..13f2f45f4 100644 --- a/src/sfnt/sfobjs.c +++ b/src/sfnt/sfobjs.c @@ -534,17 +534,23 @@ 0 ); } - if ( !face->var ) + if ( !face->tt_var ) { /* we want the metrics variations interface */ /* from the `truetype' module only */ FT_Module tt_module = FT_Get_Module( library, "truetype" ); - face->var = ft_module_get_service( tt_module, - FT_SERVICE_ID_METRICS_VARIATIONS, - 0 ); + face->tt_var = ft_module_get_service( tt_module, + FT_SERVICE_ID_METRICS_VARIATIONS, + 0 ); } + + if ( !face->face_var ) + face->face_var = ft_module_get_service( + &face->root.driver->root, + FT_SERVICE_ID_METRICS_VARIATIONS, + 0 ); #endif FT_TRACE2(( "SFNT driver\n" )); diff --git a/src/sfnt/ttmtx.c b/src/sfnt/ttmtx.c index 5e53e6dd4..38ee9ae72 100644 --- a/src/sfnt/ttmtx.c +++ b/src/sfnt/ttmtx.c @@ -239,7 +239,7 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT FT_Service_MetricsVariations var = - (FT_Service_MetricsVariations)face->var; + (FT_Service_MetricsVariations)face->tt_var; #endif diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c index 4e689e99a..c2e041cd3 100644 --- a/src/truetype/ttdriver.c +++ b/src/truetype/ttdriver.c @@ -316,7 +316,7 @@ /* use the scaled metrics, even when tt_size_reset fails */ FT_Select_Metrics( size->face, strike_index ); - tt_size_reset( ttsize, 0 ); /* ignore return value */ + tt_size_reset( ttsize ); /* ignore return value */ } else { @@ -377,7 +377,7 @@ if ( FT_IS_SCALABLE( size->face ) ) { - error = tt_size_reset( ttsize, 0 ); + error = tt_size_reset( ttsize ); #ifdef TT_USE_BYTECODE_INTERPRETER /* for the `MPS' bytecode instruction we need the point size */ @@ -559,7 +559,8 @@ (FT_BSB_Adjust_Func) NULL, /* bsb_adjust */ (FT_VOrg_Adjust_Func) NULL, /* vorg_adjust */ - (FT_Metrics_Adjust_Func) tt_apply_mvar /* metrics_adjust */ + (FT_Metrics_Adjust_Func) tt_apply_mvar, /* metrics_adjust */ + (FT_Size_Reset_Func) tt_size_reset_height /* size_reset */ ) #endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 20d27ee42..3af028aac 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -1462,15 +1462,14 @@ static FT_Error - tt_size_reset_iterator( FT_ListNode node, + ft_size_reset_iterator( FT_ListNode node, void* user ) { - TT_Size size = (TT_Size)node->data; - - FT_UNUSED( user ); + FT_Size size = (FT_Size)node->data; + FT_Service_MetricsVariations var = (FT_Service_MetricsVariations)user; - tt_size_reset( size, 1 ); + var->size_reset( size ); return FT_Err_Ok; } @@ -1543,6 +1542,9 @@ /* adjust all derived values */ { + FT_Service_MetricsVariations var = + (FT_Service_MetricsVariations)face->face_var; + FT_Face root = &face->root; /* @@ -1584,11 +1586,12 @@ face->postscript.underlineThickness / 2; root->underline_thickness = face->postscript.underlineThickness; - /* iterate over all FT_Size objects and call `tt_size_reset' */ - /* to propagate the metrics changes */ - FT_List_Iterate( &root->sizes_list, - tt_size_reset_iterator, - NULL ); + /* iterate over all FT_Size objects and call `var->size_reset' */ + /* to propagate the metrics changes */ + if ( var && var->size_reset ) + FT_List_Iterate( &root->sizes_list, + ft_size_reset_iterator, + (void*)var ); } } diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c index 4a8873fd8..ee4f3de1b 100644 --- a/src/truetype/ttobjs.c +++ b/src/truetype/ttobjs.c @@ -1338,39 +1338,25 @@ /************************************************************************** * * @Function: - * tt_size_reset + * tt_size_reset_height * * @Description: - * Reset a TrueType size when resolutions and character dimensions - * have been changed. + * Recompute a TrueType size's ascender, descender, and height + * when resolutions and character dimensions have been changed. + * Used for variation fonts as an iterator function. * * @Input: * size :: * A handle to the target size object. - * - * 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, - FT_Bool only_height ) + tt_size_reset_height( TT_Size size ) { - TT_Face face; - FT_Size_Metrics* size_metrics; - - - face = (TT_Face)size->root.face; - - /* nothing to do for CFF2 */ - if ( face->is_cff2 ) - return FT_Err_Ok; + TT_Face face = (TT_Face)size->root.face; + FT_Size_Metrics* size_metrics = &size->hinted_metrics; size->ttmetrics.valid = FALSE; - size_metrics = &size->hinted_metrics; - /* copy the result from base layer */ *size_metrics = size->root.metrics; @@ -1397,12 +1383,34 @@ 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; - } + return FT_Err_Ok; + } + + + /************************************************************************** + * + * @Function: + * tt_size_reset + * + * @Description: + * Reset a TrueType size when resolutions and character dimensions + * have been changed. + * + * @Input: + * size :: + * A handle to the target size object. + */ + FT_LOCAL_DEF( FT_Error ) + tt_size_reset( TT_Size size ) + { + FT_Error error; + TT_Face face = (TT_Face)size->root.face; + FT_Size_Metrics* size_metrics = &size->hinted_metrics; + + + error = tt_size_reset_height( size ); + if ( error ) + return error; if ( face->header.Flags & 8 ) { diff --git a/src/truetype/ttobjs.h b/src/truetype/ttobjs.h index bc6fbe7f1..d74264e57 100644 --- a/src/truetype/ttobjs.h +++ b/src/truetype/ttobjs.h @@ -391,8 +391,10 @@ FT_BEGIN_HEADER #endif /* TT_USE_BYTECODE_INTERPRETER */ FT_LOCAL( FT_Error ) - tt_size_reset( TT_Size size, - FT_Bool only_height ); + tt_size_reset_height( TT_Size size ); + + FT_LOCAL( FT_Error ) + tt_size_reset( TT_Size size ); /************************************************************************** -- cgit v1.2.3 From ea9fca0add69e1613eee3290e18c1f8cb4d17a43 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 13 Apr 2023 06:34:32 +0200 Subject: * src/truetype/ttinterp.c: Remove outdated comments. --- src/truetype/ttinterp.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index 8cf66ebae..c6a6cde6b 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -7321,14 +7321,6 @@ * GETINFO[]: GET INFOrmation * Opcode range: 0x88 * Stack: uint32 --> uint32 - * - * XXX: UNDOCUMENTED: Selector bits higher than 9 are currently (May - * 2015) not documented in the OpenType specification. - * - * Selector bit 11 is incorrectly described as bit 8, while the - * real meaning of bit 8 (vertical LCD subpixels) stays - * undocumented. The same mistake can be found in Greg Hitchcock's - * whitepaper. */ static void Ins_GETINFO( TT_ExecContext exc, @@ -7387,8 +7379,6 @@ * VARIATION GLYPH * Selector Bit: 3 * Return Bit(s): 10 - * - * XXX: UNDOCUMENTED! */ if ( (args[0] & 8 ) != 0 && exc->face->blend ) K |= 1 << 10; -- cgit v1.2.3 From c4fe77c3f072fab930267f95510562e7aeb03302 Mon Sep 17 00:00:00 2001 From: Ben Wagner Date: Mon, 17 Apr 2023 11:17:16 -0400 Subject: [truetype] tt_size_reset_height to take FT_Size The `MetricsVariations` `FT_Size_Reset_Func` is defined to take an `FT_Size`. Because `tt_size_reset_height` is to be used as such a function, it must also take an `FT_Size` instead of a `TT_Size`. Even though the pointers passed will be the same at runtime, calling a function through a pointer of a different type from the original function pointer type is undefined behavior. This may be caught at runtime by Control Flow Integrity with something like clang's `cfi-icall`. Issue: https://crbug.com/1433651 * src/truetype/ttobjs.h (tt_size_reset_height): take `FT_Size` * src/truetype/ttobjs.c (tt_size_reset_height): take `FT_Size` and update documentation --- src/truetype/ttobjs.c | 12 ++++++++---- src/truetype/ttobjs.h | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c index ee4f3de1b..c351e082b 100644 --- a/src/truetype/ttobjs.c +++ b/src/truetype/ttobjs.c @@ -1346,12 +1346,16 @@ * Used for variation fonts as an iterator function. * * @Input: - * size :: - * A handle to the target size object. + * ft_size :: + * A handle to the target TT_Size object. This function will be called + * through a `FT_Size_Reset_Func` pointer which takes `FT_Size`. This + * function must take `FT_Size` as a result. The passed `FT_Size` is + * expected to point to a `TT_Size`. */ FT_LOCAL_DEF( FT_Error ) - tt_size_reset_height( TT_Size size ) + tt_size_reset_height( FT_Size ft_size ) { + TT_Size size = (TT_Size)ft_size; TT_Face face = (TT_Face)size->root.face; FT_Size_Metrics* size_metrics = &size->hinted_metrics; @@ -1408,7 +1412,7 @@ FT_Size_Metrics* size_metrics = &size->hinted_metrics; - error = tt_size_reset_height( size ); + error = tt_size_reset_height( (FT_Size)size ); if ( error ) return error; diff --git a/src/truetype/ttobjs.h b/src/truetype/ttobjs.h index d74264e57..d1834c046 100644 --- a/src/truetype/ttobjs.h +++ b/src/truetype/ttobjs.h @@ -391,7 +391,7 @@ FT_BEGIN_HEADER #endif /* TT_USE_BYTECODE_INTERPRETER */ FT_LOCAL( FT_Error ) - tt_size_reset_height( TT_Size size ); + tt_size_reset_height( FT_Size size ); FT_LOCAL( FT_Error ) tt_size_reset( TT_Size size ); -- cgit v1.2.3 From 8154d8e2be329b1a0a145faae7d5fe0dd6aa7a7a Mon Sep 17 00:00:00 2001 From: Ben Wagner Date: Wed, 19 Apr 2023 13:48:59 -0400 Subject: [services] FT_Size_Reset_Func to return FT_Error The `MetricsVariations` `FT_Size_Reset_Func` is currently defined to return `void`, but the implementations return `FT_Error`. Even though the pointers passed will be the same at runtime, calling a function through a pointer of a different type from the original function pointer type is undefined behavior. This may be caught at runtime by Control Flow Integrity with something like clang's `cfi-icall`. Issue: https://crbug.com/1433651 * include/freetype/internal/services/svmetric.h (FT_Size_Reset_Func): return `FT_Error` instead of `void`. --- include/freetype/internal/services/svmetric.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/freetype/internal/services/svmetric.h b/include/freetype/internal/services/svmetric.h index d067dc977..167617ebb 100644 --- a/include/freetype/internal/services/svmetric.h +++ b/include/freetype/internal/services/svmetric.h @@ -77,7 +77,7 @@ FT_BEGIN_HEADER typedef void (*FT_Metrics_Adjust_Func)( FT_Face face ); - typedef void + typedef FT_Error (*FT_Size_Reset_Func)( FT_Size size ); -- cgit v1.2.3 From 9806414c15230d253d5219ea0dafeddb717307b1 Mon Sep 17 00:00:00 2001 From: suzuki toshiya Date: Mon, 24 Apr 2023 13:36:30 +0900 Subject: [truetype] Fix `make multi'. * src/truetype/ttgxvar.c: Include freetype/internal/services/svmetric.h for the FT_Service_MetricsVariations type definition. --- src/truetype/ttgxvar.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 3af028aac..80553c93a 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include -- cgit v1.2.3 From f312b3402a5ddece433a0a0d24070b7c262df218 Mon Sep 17 00:00:00 2001 From: suzuki toshiya Date: Sat, 22 Apr 2023 02:11:21 +0900 Subject: [t1cid] Change the trace messages of the charstrings retrieval errors. The t1cid driver catches 3 types of errors in the charstrings retrieval; A) The invalid FD number, there are 2 subtypes; A-1) FD number is the maximum number fitting to FDBytes. A-2) FD number is greater than num_dicts. B) Declared length is overrunning. C) Declared length is invalid (its end is before its head). Considering that some widely distributed fonts (e.g., "CJKV" book by O'Reilly) have A-1 errors in the unimplemented glyphs, the trace level for A-1 is calmed to level 1. The errors A-2, B, and C would be irregular; their trace levels are kept at level 0, but the updated trace messages include the CID number. --- src/cid/cidgload.c | 45 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c index ba4b7565d..66e298331 100644 --- a/src/cid/cidgload.c +++ b/src/cid/cidgload.c @@ -117,11 +117,44 @@ off2 = cid_get_offset( &p, cid->gd_bytes ); FT_FRAME_EXIT(); - if ( fd_select >= cid->num_dicts || - off2 > stream->size || - off1 > off2 ) + + if ( fd_select >= cid->num_dicts ) { - FT_TRACE0(( "cid_load_glyph: invalid glyph stream offsets\n" )); + /* + * fd_select == 0xFF is often used to indicate that the CID + * has no charstring to be rendered, similar to GID = 0xFFFF + * in TrueType fonts. + */ + if ( (cid->fd_bytes == 1 && fd_select == 0xFFU ) || + (cid->fd_bytes == 2 && fd_select == 0xFFFFU ) ) + { + FT_TRACE1(( "cid_load_glyph: fail for glyph_index=%d, " + "FD number %d is the max integer fitting into %d byte%s\n", + glyph_index, fd_select, cid->fd_bytes, + cid->fd_bytes == 1 ? "" : "s" )); + } + else + { + FT_TRACE0(( "cid_load_glyph: fail for glyph_index=%d, " + "FD number %d > number of dicts %d\n", + glyph_index, fd_select, cid->num_dicts )); + } + error = FT_THROW( Invalid_Offset ); + goto Exit; + } + else if ( off2 > stream->size ) + { + FT_TRACE0(( "cid_load_glyph: fail for glyph_index=%d, " + "end of the glyph data is beyond the data stream\n", + glyph_index )); + error = FT_THROW( Invalid_Offset ); + goto Exit; + } + else if ( off1 > off2 ) + { + FT_TRACE0(( "cid_load_glyph: fail for glyph_index=%d, " + "the end position of glyph data is set before the start position\n", + glyph_index )); error = FT_THROW( Invalid_Offset ); goto Exit; } @@ -161,7 +194,9 @@ cs_offset = decoder->lenIV >= 0 ? (FT_UInt)decoder->lenIV : 0; if ( cs_offset > glyph_length ) { - FT_TRACE0(( "cid_load_glyph: invalid glyph stream offsets\n" )); + FT_TRACE0(( "cid_load_glyph: fail for glyph_index=%d, " + "offset to the charstring is beyond glyph length\n", + glyph_index )); error = FT_THROW( Invalid_Offset ); goto Exit; } -- cgit v1.2.3 From 40676afc4ce15fbcb4f73e1b7016ebfb3e7b5390 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 25 Apr 2023 09:30:30 +0200 Subject: [sfnt] Fix handling of PS names for Variation Fonts. * src/sfnt/sfdriver.c (get_win_string, get_apple_string): Continue construction of string if an invalid character is encountered. Fixes #1218. --- src/sfnt/sfdriver.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c index 762883db5..1e573fb08 100644 --- a/src/sfnt/sfdriver.c +++ b/src/sfnt/sfdriver.c @@ -523,15 +523,14 @@ FT_TRACE0(( "get_win_string:" " Character 0x%X invalid in PS name string\n", ((unsigned)p[0])*256 + (unsigned)p[1] )); - break; + continue; } } - if ( !len ) - *r = '\0'; + *r = '\0'; FT_FRAME_EXIT(); - if ( !len ) + if ( r != result ) return result; get_win_string_error: @@ -580,15 +579,14 @@ FT_TRACE0(( "get_apple_string:" " Character `%c' (0x%X) invalid in PS name string\n", *p, *p )); - break; + continue; } } - if ( !len ) - *r = '\0'; + *r = '\0'; FT_FRAME_EXIT(); - if ( !len ) + if ( r != result ) return result; get_apple_string_error: -- cgit v1.2.3 From 0a3836c97d5e84d6721ac0fd2839e8ae1b7be8d9 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 25 Apr 2023 09:54:09 +0200 Subject: Improve/add source comments and documentation. --- include/freetype/freetype.h | 12 +++++------- src/sfnt/sfdriver.c | 10 +++++++--- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index efff74fe3..e855e6cb6 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -1002,7 +1002,7 @@ FT_BEGIN_HEADER * Note that the bounding box might be off by (at least) one pixel for * hinted fonts. See @FT_Size_Metrics for further discussion. * - * Note that the bounding box does not vary in OpenType variable fonts + * Note that the bounding box does not vary in OpenType variation fonts * and should only be used in relation to the default instance. * * units_per_EM :: @@ -1090,9 +1090,9 @@ FT_BEGIN_HEADER FT_Generic generic; - /*# The following member variables (down to `underline_thickness`) */ - /*# are only relevant to scalable outlines; cf. @FT_Bitmap_Size */ - /*# for bitmap fonts. */ + /* The following member variables (down to `underline_thickness`) */ + /* are only relevant to scalable outlines; cf. @FT_Bitmap_Size */ + /* for bitmap fonts. */ FT_BBox bbox; FT_UShort units_per_EM; @@ -1110,7 +1110,7 @@ FT_BEGIN_HEADER FT_Size size; FT_CharMap charmap; - /*@private begin */ + /* private fields, internal to FreeType */ FT_Driver driver; FT_Memory memory; @@ -1123,8 +1123,6 @@ FT_BEGIN_HEADER FT_Face_Internal internal; - /*@private end */ - } FT_FaceRec; diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c index 1e573fb08..70c63417b 100644 --- a/src/sfnt/sfdriver.c +++ b/src/sfnt/sfdriver.c @@ -817,9 +817,9 @@ 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 */ + /* according to the 'name' documentation in the OpenType */ + /* specification the font family name is to be used if the */ + /* typographic family name is missing, so let's do that */ found = sfnt_get_name_id( face, TT_NAME_ID_FONT_FAMILY, &win, @@ -851,6 +851,10 @@ { FT_TRACE0(( "sfnt_get_var_ps_name:" " No valid PS name prefix for font instances found\n" )); + /* XXX It probably makes sense to never let this fail */ + /* since an arbitrary prefix should work, too. */ + /* On the other hand, it is very unlikely that */ + /* we ever reach this code at all. */ return NULL; } -- cgit v1.2.3 From 7ab541a28be55256eaa17fd45a285d12143617be Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Wed, 26 Apr 2023 23:15:24 -0400 Subject: [bdf] Clean up the atom property parsing. * src/bdflib.c (bdf_is_atom_): Refactor code with fewer checks. (bdf_list_join_): Return NULL. (bdf_add_comment_): Use const argument. (bdf_get_property): Ditto, ditto, make the function static. * src/bdf.h (bdf_get_property): Remove prototype. --- src/bdf/bdf.h | 4 ---- src/bdf/bdflib.c | 52 +++++++++++++++++++++++++--------------------------- 2 files changed, 25 insertions(+), 31 deletions(-) diff --git a/src/bdf/bdf.h b/src/bdf/bdf.h index 5acbd5f2f..e2cb52c10 100644 --- a/src/bdf/bdf.h +++ b/src/bdf/bdf.h @@ -239,10 +239,6 @@ FT_BEGIN_HEADER FT_LOCAL( void ) bdf_free_font( bdf_font_t* font ); - FT_LOCAL( bdf_property_t * ) - bdf_get_property( char* name, - bdf_font_t* font ); - FT_LOCAL( bdf_property_t * ) bdf_get_font_property( bdf_font_t* font, const char* name ); diff --git a/src/bdf/bdflib.c b/src/bdf/bdflib.c index 2224698fc..936829be4 100644 --- a/src/bdf/bdflib.c +++ b/src/bdf/bdflib.c @@ -378,7 +378,7 @@ *alen = 0; if ( list == NULL || list->used == 0 ) - return 0; + return NULL; dp = list->field[0]; for ( i = j = 0; i < list->used; i++ ) @@ -887,18 +887,18 @@ } - FT_LOCAL_DEF( bdf_property_t* ) - bdf_get_property( char* name, + static bdf_property_t* + bdf_get_property( const char* name, bdf_font_t* font ) { size_t* propid; if ( name == NULL || *name == 0 ) - return 0; + return NULL; if ( ( propid = ft_hash_str_lookup( name, &(font->proptbl) ) ) == NULL ) - return 0; + return NULL; if ( *propid >= num_bdf_properties_ ) return font->user_props + ( *propid - num_bdf_properties_ ); @@ -944,7 +944,7 @@ static FT_Error bdf_add_comment_( bdf_font_t* font, - char* comment, + const char* comment, unsigned long len ) { char* cp; @@ -1053,27 +1053,24 @@ bdf_property_t* p; - *name = sp = ep = line; + sp = ep = line; while ( *ep && *ep != ' ' && *ep != '\t' ) ep++; - hold = -1; - if ( *ep ) - { - hold = *ep; - *ep = 0; - } + hold = *ep; + *ep = '\0'; p = bdf_get_property( sp, font ); - /* Restore the character that was saved before any return can happen. */ - if ( hold != -1 ) - *ep = (char)hold; - /* If the property exists and is not an atom, just return here. */ if ( p && p->format != BDF_ATOM ) + { + *ep = (char)hold; /* Undo NUL-termination. */ return 0; + } + + *name = sp; /* The property is an atom. Trim all leading and trailing whitespace */ /* and double quotes for the atom value. */ @@ -1081,25 +1078,26 @@ ep = line + linelen; /* Trim the leading whitespace if it exists. */ - if ( *sp ) - *sp++ = 0; - while ( *sp && - ( *sp == ' ' || *sp == '\t' ) ) - sp++; + if ( sp < ep ) + do + sp++; + while ( *sp == ' ' || *sp == '\t' ); /* Trim the leading double quote if it exists. */ if ( *sp == '"' ) sp++; + *value = sp; /* Trim the trailing whitespace if it exists. */ - while ( ep > sp && - ( *( ep - 1 ) == ' ' || *( ep - 1 ) == '\t' ) ) - *--ep = 0; + if ( sp < ep ) + do + *ep-- = '\0'; + while ( *ep == ' ' || *ep == '\t' ); /* Trim the trailing double quote if it exists. */ - if ( ep > sp && *( ep - 1 ) == '"' ) - *--ep = 0; + if ( *ep == '"' ) + *ep = '\0'; return 1; } -- cgit v1.2.3 From cfe54d6ac395090e0975b743b9dba941067ba6e0 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 26 Apr 2023 13:15:57 +0200 Subject: s/this is,/that is,/ --- docs/CHANGES | 4 ++-- docs/formats.txt | 2 +- include/freetype/freetype.h | 14 +++++++------- include/freetype/ftdriver.h | 4 ++-- include/freetype/ftimage.h | 2 +- include/freetype/ftoutln.h | 2 +- src/autofit/afblue.dat | 2 +- src/autofit/aflatin.c | 2 +- src/autofit/afshaper.c | 6 +++--- src/base/ftcalc.c | 2 +- src/base/ftsystem.c | 2 +- src/cff/cffload.c | 2 +- src/cff/cffparse.c | 2 +- src/pshinter/pshalgo.c | 2 +- src/sdf/ftsdf.c | 4 ++-- src/truetype/ttinterp.c | 4 ++-- 16 files changed, 28 insertions(+), 28 deletions(-) diff --git a/docs/CHANGES b/docs/CHANGES index 85c154223..bc85f9d57 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -2424,7 +2424,7 @@ CHANGES BETWEEN 2.3.8 and 2.3.7 is provided for x86 and ARM. See FT_CONFIG_OPTION_INLINE_MULFIX and FT_CONFIG_OPTION_NO_ASSEMBLER (in ftoption.h) for more. - - The handling of `tricky' fonts (this is, fonts which don't work + - The handling of `tricky' fonts (that is, fonts which don't work with the autohinter, needing the font format's hinting engine) has been generalized and changed slightly: @@ -2881,7 +2881,7 @@ CHANGES BETWEEN 2.2 and 2.1.10 II. IMPORTANT CHANGES - - Version 2.2 no longer exposes its internals, this is, the header + - Version 2.2 no longer exposes its internals, that is, the header files located in the `include/freetype/internal' directory of the source package are not copied anymore by the `make install' command. Consequently, a number of rogue clients which directly diff --git a/docs/formats.txt b/docs/formats.txt index 7a4bae09b..4b2f32eab 100644 --- a/docs/formats.txt +++ b/docs/formats.txt @@ -57,7 +57,7 @@ Notes (`*') in the table below. FreeType can be configured to support Mac files (on older Mac OS - versions, a `file' is stored as a data and a resource fork, this is, + versions, a `file' is stored as a data and a resource fork, that is, within two separate data chunks). If a file can't be opened as a font, FreeType then checks whether it is a resource fork, trying to extract the contained font data from either a `POST' or `sfnt' diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index e855e6cb6..ec3fd31df 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -918,7 +918,7 @@ FT_BEGIN_HEADER * 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 + * Bit 31 is always zero (that is, `face_index` is always a positive * value). * * [Since 2.9] Changing the design coordinates with @@ -936,7 +936,7 @@ FT_BEGIN_HEADER * * [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 + * (sub)font. Bit 31 is always zero (that is, `style_flags` is always * a positive value). Note that a variation font has always at least * one named instance, namely the default instance. * @@ -1205,13 +1205,13 @@ FT_BEGIN_HEADER * successfully; in all other cases you get an * `FT_Err_Invalid_Argument` error. * - * Note that CID-keyed fonts that are in an SFNT wrapper (this is, all + * Note that CID-keyed fonts that are in an SFNT wrapper (that is, all * OpenType/CFF fonts) don't have this flag set since the glyphs are * accessed in the normal way (using contiguous indices); the * 'CID-ness' isn't visible to the application. * * FT_FACE_FLAG_TRICKY :: - * The face is 'tricky', this is, it always needs the font format's + * The face is 'tricky', that is, it always needs the font format's * native hinting engine to get a reasonable result. A typical example * is the old Chinese font `mingli.ttf` (but not `mingliu.ttc`) that * uses TrueType bytecode instructions to move and scale all of its @@ -2449,7 +2449,7 @@ FT_BEGIN_HEADER * Each new face object created with this function also owns a default * @FT_Size object, accessible as `face->size`. * - * One @FT_Library instance can have multiple face objects, this is, + * One @FT_Library instance can have multiple face objects, that is, * @FT_Open_Face and its siblings can be called multiple times using the * same `library` argument. * @@ -2677,7 +2677,7 @@ FT_BEGIN_HEADER * silently uses outlines if there is no bitmap for a given glyph index. * * For GX and OpenType variation fonts, a bitmap strike makes sense only - * if the default instance is active (this is, no glyph variation takes + * if the default instance is active (that is, no glyph variation takes * place); otherwise, FreeType simply ignores bitmap strikes. The same * is true for all named instances that are different from the default * instance. @@ -2974,7 +2974,7 @@ FT_BEGIN_HEADER * glyph may be transformed. See @FT_Set_Transform for the details. * * For subsetted CID-keyed fonts, `FT_Err_Invalid_Argument` is returned - * for invalid CID values (this is, for CID values that don't have a + * for invalid CID values (that is, for CID values that don't have a * corresponding glyph in the font). See the discussion of the * @FT_FACE_FLAG_CID_KEYED flag for more details. * diff --git a/include/freetype/ftdriver.h b/include/freetype/ftdriver.h index 59804ab1a..7af7465bc 100644 --- a/include/freetype/ftdriver.h +++ b/include/freetype/ftdriver.h @@ -134,7 +134,7 @@ FT_BEGIN_HEADER * 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 + * Hstems (that 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. @@ -446,7 +446,7 @@ FT_BEGIN_HEADER * at smaller sizes. * * For the auto-hinter, stem-darkening is experimental currently and thus - * switched off by default (this is, `no-stem-darkening` is set to TRUE + * switched off by default (that 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 diff --git a/include/freetype/ftimage.h b/include/freetype/ftimage.h index 738b515ed..6baa81256 100644 --- a/include/freetype/ftimage.h +++ b/include/freetype/ftimage.h @@ -862,7 +862,7 @@ FT_BEGIN_HEADER * @FT_SpanFunc that takes the y~coordinate of the span as a parameter. * * The anti-aliased rasterizer produces coverage values from 0 to 255, - * this is, from completely transparent to completely opaque. + * that is, from completely transparent to completely opaque. */ typedef struct FT_Span_ { diff --git a/include/freetype/ftoutln.h b/include/freetype/ftoutln.h index 54434b25f..f9329ca40 100644 --- a/include/freetype/ftoutln.h +++ b/include/freetype/ftoutln.h @@ -118,7 +118,7 @@ FT_BEGIN_HEADER * attachement. * * Similarly, the function returns success for an empty outline also - * (doing nothing, this is, not calling any emitter); if necessary, you + * (doing nothing, that is, not calling any emitter); if necessary, you * should filter this out, too. */ FT_EXPORT( FT_Error ) diff --git a/src/autofit/afblue.dat b/src/autofit/afblue.dat index b7efe8be6..8299baa25 100644 --- a/src/autofit/afblue.dat +++ b/src/autofit/afblue.dat @@ -89,7 +89,7 @@ AF_BLUE_STRING_ENUM AF_BLUE_STRINGS_ARRAY AF_BLUE_STRING_MAX_LEN: "ت ث ط ظ ك" // We don't necessarily have access to medial forms via Unicode in case // Arabic presentational forms are missing. The only character that is - // guaranteed to have the same vertical position with joining (this is, + // guaranteed to have the same vertical position with joining (that is, // non-isolated) forms is U+0640, ARABIC TATWEEL, which must join both // round and flat curves. AF_BLUE_STRING_ARABIC_JOIN diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c index 1082fee9a..d84579238 100644 --- a/src/autofit/aflatin.c +++ b/src/autofit/aflatin.c @@ -2038,7 +2038,7 @@ max = seg2->max_coord; /* compute maximum coordinate difference of the two segments */ - /* (this is, how much they overlap) */ + /* (that is, how much they overlap) */ len = max - min; if ( len >= len_threshold ) { diff --git a/src/autofit/afshaper.c b/src/autofit/afshaper.c index 1b8b870e8..abc6f1d29 100644 --- a/src/autofit/afshaper.c +++ b/src/autofit/afshaper.c @@ -258,7 +258,7 @@ /* * We now check whether we can construct blue zones, using glyphs * covered by the feature only. In case there is not a single zone - * (this is, not a single character is covered), we skip this coverage. + * (that is, not a single character is covered), we skip this coverage. * */ if ( style_class->coverage != AF_COVERAGE_DEFAULT ) @@ -313,9 +313,9 @@ * hinted and usually rendered glyph. * * Consider the superscript feature of font `pala.ttf': Some of the - * glyphs are `real', this is, they have a zero vertical offset, but + * glyphs are `real', that is, they have a zero vertical offset, but * most of them are small caps glyphs shifted up to the superscript - * position (this is, the `sups' feature is present in both the GSUB and + * position (that is, the `sups' feature is present in both the GSUB and * GPOS tables). The code for blue zones computation actually uses a * feature's y offset so that the `real' glyphs get correct hints. But * later on it is impossible to decide whether a glyph index belongs to, diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c index 997921883..442b08ddf 100644 --- a/src/base/ftcalc.c +++ b/src/base/ftcalc.c @@ -1061,7 +1061,7 @@ /* */ /* This approach has the advantage that the angle between */ /* `in' and `out' is not checked. In case one of the two */ - /* vectors is `dominant', this is, much larger than the */ + /* vectors is `dominant', that is, much larger than the */ /* other vector, we thus always have a flat corner. */ /* */ /* hypotenuse */ diff --git a/src/base/ftsystem.c b/src/base/ftsystem.c index 98c046b83..61c99e363 100644 --- a/src/base/ftsystem.c +++ b/src/base/ftsystem.c @@ -206,7 +206,7 @@ * The number of bytes to read from the stream. * * @Return: - * The number of bytes actually read. If `count' is zero (this is, + * The number of bytes actually read. If `count' is zero (that is, * the function is used for seeking), a non-zero return value * indicates an error. */ diff --git a/src/cff/cffload.c b/src/cff/cffload.c index f0e1977e2..fa2c29b28 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -400,7 +400,7 @@ /* Allocate a table containing pointers to an index's elements. */ /* The `pool' argument makes this function convert the index */ - /* entries to C-style strings (this is, null-terminated). */ + /* entries to C-style strings (that is, null-terminated). */ static FT_Error cff_index_get_pointers( CFF_Index idx, FT_Byte*** table, diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c index a31f085d9..89a0263b7 100644 --- a/src/cff/cffparse.c +++ b/src/cff/cffparse.c @@ -622,7 +622,7 @@ dict->has_font_matrix = TRUE; - /* We expect a well-formed font matrix, this is, the matrix elements */ + /* We expect a well-formed font matrix, that is, the matrix elements */ /* `xx' and `yy' are of approximately the same magnitude. To avoid */ /* loss of precision, we use the magnitude of the largest matrix */ /* element to scale all other elements. The scaling factor is then */ diff --git a/src/pshinter/pshalgo.c b/src/pshinter/pshalgo.c index a7f321291..4f622e1e4 100644 --- a/src/pshinter/pshalgo.c +++ b/src/pshinter/pshalgo.c @@ -516,7 +516,7 @@ if ( !psh_hint_is_fitted( parent ) ) psh_hint_align( parent, globals, dimension, glyph ); - /* keep original relation between hints, this is, use the */ + /* keep original relation between hints, that is, use the */ /* scaled distance between the centers of the hints to */ /* compute the new position */ par_org_center = parent->org_pos + ( parent->org_len >> 1 ); diff --git a/src/sdf/ftsdf.c b/src/sdf/ftsdf.c index d8479af10..0a43e9be6 100644 --- a/src/sdf/ftsdf.c +++ b/src/sdf/ftsdf.c @@ -2371,7 +2371,7 @@ * ``` * * (6) Our task is to find a value of `t` such that the above equation - * `Q(t)` becomes zero, this is, the point-to-curve vector makes + * `Q(t)` becomes zero, that is, the point-to-curve vector makes * 90~degrees with the curve. We solve this with the Newton-Raphson * method. * @@ -2684,7 +2684,7 @@ * ``` * * (6) Our task is to find a value of `t` such that the above equation - * `Q(t)` becomes zero, this is, the point-to-curve vector makes + * `Q(t)` becomes zero, that is, the point-to-curve vector makes * 90~degree with curve. We solve this with the Newton-Raphson * method. * diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index c6a6cde6b..3b7b21cca 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -7837,7 +7837,7 @@ /* a variable number of arguments */ /* it is the job of the application to `activate' GX handling, */ - /* this is, calling any of the GX API functions on the current */ + /* that is, calling any of the GX API functions on the current */ /* font to select a variation instance */ if ( exc->face->blend ) exc->new_top = exc->args + exc->face->blend->num_axis; @@ -8397,7 +8397,7 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT case 0x91: /* it is the job of the application to `activate' GX handling, */ - /* this is, calling any of the GX API functions on the current */ + /* that is, calling any of the GX API functions on the current */ /* font to select a variation instance */ if ( exc->face->blend ) Ins_GETVARIATION( exc, args ); -- cgit v1.2.3 From 9a3d05d9804c36d4862ff705bd112f400903c222 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 26 Apr 2023 19:00:05 +0200 Subject: * src/ttgxvar.c: Minor changes. (TT_Get_MM_Var): Improve tracing messages. (tt_set_mm_blend): Minor speed-up. --- src/cff/cffload.c | 2 +- src/truetype/ttgxvar.c | 39 +++++++++++++++++++++------------------ 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/src/cff/cffload.c b/src/cff/cffload.c index fa2c29b28..a090111e3 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -1612,7 +1612,7 @@ FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; - if (mm) + if ( mm ) mm->done_blend( FT_FACE( face ) ); } diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 80553c93a..a50231a89 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -2544,7 +2544,7 @@ goto Exit; } - FT_TRACE5(( "%d instance%s\n", + FT_TRACE5(( "%d named instance%s\n", fvar_head.instanceCount, fvar_head.instanceCount == 1 ? "" : "s" )); @@ -2602,7 +2602,7 @@ (void)FT_STREAM_SEEK( pos ); - FT_TRACE5(( " instance %d (%s%s%s, %s%s%s)\n", + FT_TRACE5(( " named instance %d (%s%s%s, %s%s%s)\n", i, strname ? "name: `" : "", strname ? strname : "unnamed", @@ -2845,26 +2845,29 @@ } } - if ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) ) + if ( !have_diff ) { - FT_UInt instance_index = (FT_UInt)face->root.face_index >> 16; + if ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) ) + { + FT_UInt instance_index = (FT_UInt)face->root.face_index >> 16; - c = blend->normalizedcoords + i; - n = blend->normalized_stylecoords + - ( instance_index - 1 ) * mmvar->num_axis + - i; + c = blend->normalizedcoords + i; + n = blend->normalized_stylecoords + + ( instance_index - 1 ) * 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; + 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' */ -- cgit v1.2.3 From 13df1c7d29467eb74a367a0cfc0dc4e002309816 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 26 Apr 2023 13:17:36 +0200 Subject: Minor documentation updates. --- include/freetype/freetype.h | 15 ++++++++------- include/freetype/internal/tttypes.h | 36 ++++++++++++++++++++++-------------- src/truetype/ttgxvar.c | 6 ++++-- 3 files changed, 34 insertions(+), 23 deletions(-) diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index ec3fd31df..87aad1a29 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -1233,8 +1233,8 @@ FT_BEGIN_HEADER * FT_FACE_FLAG_VARIATION :: * [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. + * @FT_Set_Var_Design_Coordinates, @FT_Set_Var_Blend_Coordinates, or + * @FT_Set_MM_WeightVector to select a non-default instance. * * FT_FACE_FLAG_SVG :: * [Since 2.12] The face has an 'SVG~' OpenType table. @@ -1449,8 +1449,8 @@ FT_BEGIN_HEADER * * @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. + * @FT_Set_MM_Design_Coordinates, @FT_Set_Var_Design_Coordinates, + * @FT_Set_Var_Blend_Coordinates, or @FT_Set_MM_WeightVector. * * @since: * 2.9 @@ -4264,9 +4264,10 @@ FT_BEGIN_HEADER * * [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. + * the font has corresponding entries in its 'fvar' table or is the + * default named instance). 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/internal/tttypes.h b/include/freetype/internal/tttypes.h index d257d05bd..af6830a4d 100644 --- a/include/freetype/internal/tttypes.h +++ b/include/freetype/internal/tttypes.h @@ -1200,12 +1200,16 @@ FT_BEGIN_HEADER * mm :: * A pointer to the Multiple Masters service. * - * var :: - * A pointer to the Metrics Variations service. + * tt_var :: + * A pointer to the Metrics Variations service for the "truetype" + * driver. * - * hdmx :: - * The face's horizontal device metrics ('hdmx' table). This table is - * optional in TrueType/OpenType fonts. + * face_var :: + * A pointer to the Metrics Variations service for this `TT_Face`'s + * driver. + * + * psaux :: + * A pointer to the PostScript Auxiliary service. * * gasp :: * The grid-fitting and scaling properties table ('gasp'). This table @@ -1357,14 +1361,6 @@ FT_BEGIN_HEADER * A mapping between the strike indices exposed by the API and the * indices used in the font's sbit table. * - * cpal :: - * A pointer to data related to the 'CPAL' table. `NULL` if the table - * is not available. - * - * colr :: - * A pointer to data related to the 'COLR' table. `NULL` if the table - * is not available. - * * kern_table :: * A pointer to the 'kern' table. * @@ -1405,6 +1401,18 @@ FT_BEGIN_HEADER * * ebdt_size :: * The size of the sbit data table. + * + * cpal :: + * A pointer to data related to the 'CPAL' table. `NULL` if the table + * is not available. + * + * colr :: + * A pointer to data related to the 'COLR' table. `NULL` if the table + * is not available. + * + * svg :: + * A pointer to data related to the 'SVG' table. `NULL` if the table + * is not available. */ typedef struct TT_FaceRec_ { @@ -1462,7 +1470,7 @@ FT_BEGIN_HEADER /* a typeless pointer to the FT_Service_MetricsVariationsRec table */ /* used to handle the HVAR, VVAR, and MVAR OpenType tables by this */ /* TT_Face's driver */ - void* face_var; + void* face_var; /* since 2.13.1 */ #endif /* a typeless pointer to the PostScript Aux service */ diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index a50231a89..963dcb7e3 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -2965,7 +2965,8 @@ * An array of `num_coords', each between [-1,1]. * * @Return: - * FreeType error code. 0 means success. + * FreeType error code. 0 means success, -1 means success and unchanged + * axis values. */ FT_LOCAL_DEF( FT_Error ) TT_Set_MM_Blend( TT_Face face, @@ -3012,7 +3013,8 @@ * An array of `num_coords', each between [-1,1]. * * @Return: - * FreeType error code. 0 means success. + * FreeType error code. 0 means success, -1 means success and unchanged + * axis values. */ FT_LOCAL_DEF( FT_Error ) TT_Get_MM_Blend( TT_Face face, -- cgit v1.2.3 From 4908c1e84d1a69015fd4313eb2b78cf59a9c83ca Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 28 Apr 2023 06:54:25 +0200 Subject: * src/cid/cidgload.c (cid_load_glyph): Fix compiler warnings. --- src/cid/cidgload.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c index 66e298331..f4fe582be 100644 --- a/src/cid/cidgload.c +++ b/src/cid/cidgload.c @@ -129,14 +129,14 @@ (cid->fd_bytes == 2 && fd_select == 0xFFFFU ) ) { FT_TRACE1(( "cid_load_glyph: fail for glyph_index=%d, " - "FD number %d is the max integer fitting into %d byte%s\n", + "FD number %ld is the max integer fitting into %d byte%s\n", glyph_index, fd_select, cid->fd_bytes, cid->fd_bytes == 1 ? "" : "s" )); } else { FT_TRACE0(( "cid_load_glyph: fail for glyph_index=%d, " - "FD number %d > number of dicts %d\n", + "FD number %ld > number of dicts %d\n", glyph_index, fd_select, cid->num_dicts )); } error = FT_THROW( Invalid_Offset ); -- cgit v1.2.3 From 17a0c5dfd5d94944f091c96145a5c96bba46de0a Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 28 Apr 2023 10:40:41 +0200 Subject: * src/cff/cffdrivr.c (cff_ps_get_font_info): Reject 'CFF2' format. --- src/cff/cffdrivr.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index 688c4c0b3..81bff1fcc 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -471,6 +471,12 @@ FT_Error error = FT_Err_Ok; + if ( face->is_cff2 ) + { + error = FT_THROW( Invalid_Argument ); + goto Fail; + } + if ( cff && !cff->font_info ) { CFF_FontRecDict dict = &cff->top_font.font_dict; -- cgit v1.2.3 From 966ff5a55cbe46e9ae4658e6e0e7ecb1e6e82b07 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 28 Apr 2023 15:25:20 +0200 Subject: * src/cff/cffdrivr/c (cff_get_ps_name): Avoid unnecessary crash. The situation can happen if `FT_New_Face` (or one of its siblings) is called with a negative index to get the number of contained faces, followed immediately by a call to `FT_Get_Postscript_Name`. While this is not a valid use of the FreeType library there is no need for a crash. Fixes #1219. --- src/cff/cffdrivr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index 81bff1fcc..7d45e4641 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -634,7 +634,7 @@ return service->get_ps_font_name( FT_FACE( face ) ); } - return (const char*)cff->font_name; + return cff ? (const char*)cff->font_name : NULL; } -- cgit v1.2.3 From 08268691aaf22444179e1360ad95403988755126 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 28 Apr 2023 15:32:16 +0200 Subject: * src/sfnt/ttload.c (tt_face_load_font_dir): Add another guard. Reject 'OTTO' fonts with no valid tables. --- src/sfnt/ttload.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c index 14f625c82..7b44e9cd2 100644 --- a/src/sfnt/ttload.c +++ b/src/sfnt/ttload.c @@ -504,6 +504,13 @@ FT_FRAME_EXIT(); + if ( !valid_entries ) + { + FT_TRACE2(( "tt_face_load_font_dir: no valid tables found\n" )); + error = FT_THROW( Unknown_File_Format ); + goto Exit; + } + FT_TRACE2(( "table directory loaded\n" )); FT_TRACE2(( "\n" )); -- cgit v1.2.3 From 36a086b6306dda5fad01ba17cc3810a82164785e Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Fri, 28 Apr 2023 19:40:35 -0400 Subject: * src/sfnt/pngshim.c (Load_SBit_Png): Remove FALL_THROUGH warning. --- src/sfnt/pngshim.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/sfnt/pngshim.c b/src/sfnt/pngshim.c index c7f8a290d..33712162e 100644 --- a/src/sfnt/pngshim.c +++ b/src/sfnt/pngshim.c @@ -406,10 +406,7 @@ switch ( color_type ) { - default: - /* Shouldn't happen, but ... */ - FALL_THROUGH; - + default: /* Shouldn't happen, but ... */ case PNG_COLOR_TYPE_RGB_ALPHA: png_set_read_user_transform_fn( png, premultiply_data ); break; -- cgit v1.2.3 From 77bbfc5960f47412f8d433948bcb3317e9c93b7c Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 24 Apr 2023 09:48:09 +0200 Subject: API documentation: Re-organize chapters and sections * Split the very long 'Base Interface' section into smaller sections. * Split the 'Core API' chapter into two chapters. * Remove single enumeration values from `@order` fields since they have no effect. --- include/freetype/freetype.h | 507 ++++++++++++++++++++++++++++++++---------- include/freetype/ftchapters.h | 23 +- 2 files changed, 412 insertions(+), 118 deletions(-) diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 87aad1a29..15609e6a2 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -102,61 +102,25 @@ FT_BEGIN_HEADER */ - - /*************************************************************************/ - /*************************************************************************/ - /* */ - /* B A S I C T Y P E S */ - /* */ - /*************************************************************************/ - /*************************************************************************/ - - /************************************************************************** * * @section: - * base_interface + * font_testing_macros * * @title: - * Base Interface + * Font Testing Macros * * @abstract: - * The FreeType~2 base font interface. + * Macros to test various properties of fonts. * * @description: - * This section describes the most important public high-level API - * functions of FreeType~2. + * Macros to test the most important font properties. * - * @order: - * FT_Library - * FT_Face - * FT_Size - * FT_GlyphSlot - * FT_CharMap - * FT_Encoding - * FT_ENC_TAG - * - * FT_FaceRec - * - * FT_FACE_FLAG_SCALABLE - * FT_FACE_FLAG_FIXED_SIZES - * FT_FACE_FLAG_FIXED_WIDTH - * FT_FACE_FLAG_HORIZONTAL - * FT_FACE_FLAG_VERTICAL - * FT_FACE_FLAG_COLOR - * FT_FACE_FLAG_SFNT - * FT_FACE_FLAG_CID_KEYED - * 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 - * FT_FACE_FLAG_SVG - * FT_FACE_FLAG_SBIX - * FT_FACE_FLAG_SBIX_OVERLAY + * It is recommended to use these high-level macros instead of directly + * testing the corresponding flags, which are scattered over various + * structures. * + * @order: * FT_HAS_HORIZONTAL * FT_HAS_VERTICAL * FT_HAS_KERNING @@ -176,21 +140,59 @@ FT_BEGIN_HEADER * FT_IS_NAMED_INSTANCE * FT_IS_VARIATION * - * FT_STYLE_FLAG_BOLD - * FT_STYLE_FLAG_ITALIC + */ + + + /************************************************************************** + * + * @section: + * library_setup * - * FT_SizeRec - * FT_Size_Metrics + * @title: + * Library Setup * - * FT_GlyphSlotRec - * FT_Glyph_Metrics - * FT_SubGlyph + * @abstract: + * Functions to start and end the usage of the FreeType library. * - * FT_Bitmap_Size + * @description: + * Functions to start and end the usage of the FreeType library. + * + * Note that @FT_Library_Version and @FREETYPE_XXX are of limited use + * because even a new release of FreeType with only documentation + * changes increases the version number. * + * @order: + * FT_Library * FT_Init_FreeType * FT_Done_FreeType * + * FT_Library_Version + * FREETYPE_XXX + * + */ + + + /************************************************************************** + * + * @section: + * face_creation + * + * @title: + * Face Creation + * + * @abstract: + * Functions to manage fonts. + * + * @description: + * The functions and structures collected in this section operate on + * fonts globally. + * + * @order: + * FT_Face + * FT_FaceRec + * FT_FACE_FLAG_XXX + * FT_STYLE_FLAG_XXX + * * FT_New_Face * FT_Done_Face * FT_Reference_Face @@ -198,10 +200,36 @@ FT_BEGIN_HEADER * FT_Face_Properties * FT_Open_Face * FT_Open_Args + * FT_OPEN_XXX * FT_Parameter * FT_Attach_File * FT_Attach_Stream * + */ + + + /************************************************************************** + * + * @section: + * sizing_and_scaling + * + * @title: + * Sizing and Scaling + * + * @abstract: + * Functions to manage font sizes. + * + * @description: + * The functions and structures collected in this section are related to + * selecting and manipulating the size of a font globally. + * + * @order: + * FT_Size + * FT_SizeRec + * FT_Size_Metrics + * + * FT_Bitmap_Size + * * FT_Set_Char_Size * FT_Set_Pixel_Sizes * FT_Request_Size @@ -209,44 +237,37 @@ FT_BEGIN_HEADER * FT_Size_Request_Type * FT_Size_RequestRec * FT_Size_Request + * * FT_Set_Transform * FT_Get_Transform - * FT_Load_Glyph - * FT_Get_Char_Index - * FT_Get_First_Char - * FT_Get_Next_Char - * FT_Load_Char * - * FT_OPEN_MEMORY - * FT_OPEN_STREAM - * FT_OPEN_PATHNAME - * FT_OPEN_DRIVER - * FT_OPEN_PARAMS - * - * FT_LOAD_DEFAULT - * FT_LOAD_RENDER - * FT_LOAD_MONOCHROME - * FT_LOAD_LINEAR_DESIGN - * FT_LOAD_NO_SCALE - * FT_LOAD_NO_HINTING - * FT_LOAD_NO_BITMAP - * FT_LOAD_SBITS_ONLY - * FT_LOAD_NO_AUTOHINT - * FT_LOAD_COLOR - * - * FT_LOAD_VERTICAL_LAYOUT - * FT_LOAD_IGNORE_TRANSFORM - * FT_LOAD_FORCE_AUTOHINT - * FT_LOAD_NO_RECURSE - * FT_LOAD_PEDANTIC - * - * FT_LOAD_TARGET_NORMAL - * FT_LOAD_TARGET_LIGHT - * FT_LOAD_TARGET_MONO - * FT_LOAD_TARGET_LCD - * FT_LOAD_TARGET_LCD_V + */ + + + /************************************************************************** + * + * @section: + * glyph_retrieval + * + * @title: + * Glyph Retrieval + * + * @abstract: + * Functions to manage glyphs. + * + * @description: + * The functions and structures collected in this section operate on + * single glyphs, of which @FT_Load_Glyph is most important. * + * @order: + * FT_GlyphSlot + * FT_GlyphSlotRec + * FT_Glyph_Metrics + * + * FT_Load_Glyph + * FT_LOAD_XXX * FT_LOAD_TARGET_MODE + * FT_LOAD_TARGET_XXX * * FT_Render_Glyph * FT_Render_Mode @@ -254,34 +275,121 @@ FT_BEGIN_HEADER * FT_Kerning_Mode * FT_Get_Track_Kerning * + */ + + + /************************************************************************** + * + * @section: + * character_mapping + * + * @title: + * Character Mapping + * + * @abstract: + * Functions to manage character-to-glyph maps. + * + * @description: + * This section holds functions and structures that are related to + * mapping character input codes to glyph indices. + * + * Note that for many scripts the simplistic approach used by FreeType + * of mapping a single character to a single glyph is not valid or + * possible! In general, a higher-level library like HarfBuzz or ICU + * should be used for handling text strings. + * + * @order: + * FT_CharMap * FT_CharMapRec + * FT_Encoding + * FT_ENC_TAG + * * FT_Select_Charmap * FT_Set_Charmap * FT_Get_Charmap_Index * + * FT_Get_Char_Index + * FT_Get_First_Char + * FT_Get_Next_Char + * FT_Load_Char + * + */ + + + /************************************************************************** + * + * @section: + * information_retrieval + * + * @title: + * Information Retrieval + * + * @abstract: + * Functions to retrieve font and glyph information. + * + * @description: + * Functions to retrieve font and glyph information. Only some very + * basic data is covered; see also the chapter on the format-specific + * API for more. + * + * + * @order: * FT_Get_Name_Index * FT_Get_Glyph_Name * FT_Get_Postscript_Name * FT_Get_FSType_Flags + * FT_FSTYPE_XXX * FT_Get_SubGlyph_Info + * FT_SUBGLYPH_FLAG_XXX + * + */ + + + /************************************************************************** + * + * @section: + * other_api_data + * + * @title: + * Other API Data + * + * @abstract: + * Other structures, enumerations, and macros. * + * @description: + * Other structures, enumerations, and macros. Deprecated functions are + * also listed here. + * + * @order: * FT_Face_Internal * FT_Size_Internal * FT_Slot_Internal * - * FT_FACE_FLAG_XXX - * FT_STYLE_FLAG_XXX - * FT_OPEN_XXX - * FT_LOAD_XXX - * FT_LOAD_TARGET_XXX - * FT_SUBGLYPH_FLAG_XXX - * FT_FSTYPE_XXX + * FT_SubGlyph * * FT_HAS_FAST_GLYPHS + * FT_Face_CheckTrueTypePatents + * FT_Face_SetUnpatentedHinting * */ + /*************************************************************************/ + /*************************************************************************/ + /* */ + /* B A S I C T Y P E S */ + /* */ + /*************************************************************************/ + /*************************************************************************/ + + + /************************************************************************** + * + * @section: + * glyph_retrieval + * + */ + /************************************************************************** * * @struct: @@ -349,6 +457,13 @@ FT_BEGIN_HEADER } FT_Glyph_Metrics; + /************************************************************************** + * + * @section: + * sizing_and_scaling + * + */ + /************************************************************************** * * @struct: @@ -409,6 +524,13 @@ FT_BEGIN_HEADER /*************************************************************************/ /*************************************************************************/ + /************************************************************************** + * + * @section: + * library_setup + * + */ + /************************************************************************** * * @type: @@ -483,7 +605,7 @@ FT_BEGIN_HEADER /************************************************************************** * * @section: - * base_interface + * face_creation * */ @@ -519,6 +641,13 @@ FT_BEGIN_HEADER typedef struct FT_FaceRec_* FT_Face; + /************************************************************************** + * + * @section: + * sizing_and_scaling + * + */ + /************************************************************************** * * @type: @@ -551,6 +680,13 @@ FT_BEGIN_HEADER typedef struct FT_SizeRec_* FT_Size; + /************************************************************************** + * + * @section: + * glyph_retrieval + * + */ + /************************************************************************** * * @type: @@ -570,6 +706,13 @@ FT_BEGIN_HEADER typedef struct FT_GlyphSlotRec_* FT_GlyphSlot; + /************************************************************************** + * + * @section: + * character_mapping + * + */ + /************************************************************************** * * @type: @@ -877,6 +1020,13 @@ FT_BEGIN_HEADER /*************************************************************************/ + /************************************************************************** + * + * @section: + * other_api_data + * + */ + /************************************************************************** * * @type: @@ -892,6 +1042,13 @@ FT_BEGIN_HEADER typedef struct FT_Face_InternalRec_* FT_Face_Internal; + /************************************************************************** + * + * @section: + * face_creation + * + */ + /************************************************************************** * * @struct: @@ -1270,6 +1427,13 @@ FT_BEGIN_HEADER #define FT_FACE_FLAG_SBIX_OVERLAY ( 1L << 18 ) + /************************************************************************** + * + * @section: + * font_testing_macros + * + */ + /************************************************************************** * * @macro: @@ -1379,6 +1543,13 @@ FT_BEGIN_HEADER ( !!( (face)->face_flags & FT_FACE_FLAG_FIXED_SIZES ) ) + /************************************************************************** + * + * @section: + * other_api_data + * + */ + /************************************************************************** * * @macro: @@ -1391,6 +1562,13 @@ FT_BEGIN_HEADER #define FT_HAS_FAST_GLYPHS( face ) 0 + /************************************************************************** + * + * @section: + * font_testing_macros + * + */ + /************************************************************************** * * @macro: @@ -1626,6 +1804,13 @@ FT_BEGIN_HEADER ( !!( (face)->face_flags & FT_FACE_FLAG_SBIX_OVERLAY ) ) + /************************************************************************** + * + * @section: + * face_creation + * + */ + /************************************************************************** * * @enum: @@ -1652,6 +1837,13 @@ FT_BEGIN_HEADER #define FT_STYLE_FLAG_BOLD ( 1 << 1 ) + /************************************************************************** + * + * @section: + * other_api_data + * + */ + /************************************************************************** * * @type: @@ -1664,6 +1856,13 @@ FT_BEGIN_HEADER typedef struct FT_Size_InternalRec_* FT_Size_Internal; + /************************************************************************** + * + * @section: + * sizing_and_scaling + * + */ + /************************************************************************** * * @struct: @@ -1815,6 +2014,13 @@ FT_BEGIN_HEADER } FT_SizeRec; + /************************************************************************** + * + * @section: + * other_api_data + * + */ + /************************************************************************** * * @struct: @@ -1846,6 +2052,13 @@ FT_BEGIN_HEADER typedef struct FT_Slot_InternalRec_* FT_Slot_Internal; + /************************************************************************** + * + * @section: + * glyph_retrieval + * + */ + /************************************************************************** * * @struct: @@ -2090,6 +2303,13 @@ FT_BEGIN_HEADER /*************************************************************************/ + /************************************************************************** + * + * @section: + * library_setup + * + */ + /************************************************************************** * * @function: @@ -2147,6 +2367,13 @@ FT_BEGIN_HEADER FT_Done_FreeType( FT_Library library ); + /************************************************************************** + * + * @section: + * face_creation + * + */ + /************************************************************************** * * @enum: @@ -2648,6 +2875,13 @@ FT_BEGIN_HEADER FT_Done_Face( FT_Face face ); + /************************************************************************** + * + * @section: + * sizing_and_scaling + * + */ + /************************************************************************** * * @function: @@ -2940,6 +3174,13 @@ FT_BEGIN_HEADER FT_UInt pixel_height ); + /************************************************************************** + * + * @section: + * glyph_retrieval + * + */ + /************************************************************************** * * @function: @@ -2988,6 +3229,13 @@ FT_BEGIN_HEADER FT_Int32 load_flags ); + /************************************************************************** + * + * @section: + * character_mapping + * + */ + /************************************************************************** * * @function: @@ -3031,6 +3279,13 @@ FT_BEGIN_HEADER FT_Int32 load_flags ); + /************************************************************************** + * + * @section: + * glyph_retrieval + * + */ + /************************************************************************** * * @enum: @@ -3370,6 +3625,13 @@ FT_BEGIN_HEADER FT_STATIC_CAST( FT_Render_Mode, ( (x) >> 16 ) & 15 ) + /************************************************************************** + * + * @section: + * sizing_and_scaling + * + */ + /************************************************************************** * * @function: @@ -3445,6 +3707,13 @@ FT_BEGIN_HEADER FT_Vector* delta ); + /************************************************************************** + * + * @section: + * glyph_retrieval + * + */ + /************************************************************************** * * @enum: @@ -3839,6 +4108,13 @@ FT_BEGIN_HEADER FT_Fixed* akerning ); + /************************************************************************** + * + * @section: + * character_mapping + * + */ + /************************************************************************** * * @function: @@ -4055,6 +4331,13 @@ FT_BEGIN_HEADER FT_UInt *agindex ); + /************************************************************************** + * + * @section: + * face_creation + * + */ + /************************************************************************** * * @function: @@ -4153,6 +4436,13 @@ FT_BEGIN_HEADER FT_Parameter* properties ); + /************************************************************************** + * + * @section: + * information_retrieval + * + */ + /************************************************************************** * * @function: @@ -4899,32 +5189,10 @@ FT_BEGIN_HEADER /************************************************************************** * * @section: - * version - * - * @title: - * FreeType Version - * - * @abstract: - * Functions and macros related to FreeType versions. - * - * @description: - * Note that those functions and macros are of limited use because even a - * new release of FreeType with only documentation changes increases the - * version number. - * - * @order: - * FT_Library_Version - * - * FREETYPE_MAJOR - * FREETYPE_MINOR - * FREETYPE_PATCH - * - * FT_Face_CheckTrueTypePatents - * FT_Face_SetUnpatentedHinting + * library_setup * */ - /************************************************************************** * * @enum: @@ -4991,6 +5259,13 @@ FT_BEGIN_HEADER FT_Int *apatch ); + /************************************************************************** + * + * @section: + * other_api_data + * + */ + /************************************************************************** * * @function: diff --git a/include/freetype/ftchapters.h b/include/freetype/ftchapters.h index 6a9733ad7..7566fbd10 100644 --- a/include/freetype/ftchapters.h +++ b/include/freetype/ftchapters.h @@ -31,9 +31,28 @@ * Core API * * @sections: - * version * basic_types - * base_interface + * library_setup + * face_creation + * font_testing_macros + * sizing_and_scaling + * glyph_retrieval + * character_mapping + * information_retrieval + * other_api_data + * + */ + + + /************************************************************************** + * + * @chapter: + * extended_api + * + * @title: + * Extended API + * + * @sections: * glyph_variants * color_management * layer_management -- cgit v1.2.3 From be15811c4602a1c2584684eb7ed5242e2bf16a5e Mon Sep 17 00:00:00 2001 From: suzuki toshiya Date: Wed, 3 May 2023 01:31:37 +0000 Subject: [t1cid] Improve cid_get_cid_from_glyph_index(). Update cid_get_cid_from_glyph_index() to return an error and CID=0 in the case that the specified glyph index points to an invalid entry. cidgload.h (cid_compute_fd_and_offsets): Declare new helper function to set the fd_select and 2 offsets to access the glyph description data. cidgload.c (cid_compute_fd_and_offsets): Move the part loading fd_select and 2 offsets from cid_load_glyph() to here. If the loaded parameters are broken, return the Invalid_Offset error. This function does not load the glyph data, only fills these parameters. (cid_load_glyph): Use new helper function in above. cidriver.c (cid_get_cid_from_glyph_index): Check whether the requested glyph index points to a valid entry, by calling cid_compute_fd_and_offsets(). If it is valid, fill the cid by the glyph index (=CID). If it is invalid, return an error and fill the cid by 0. --- src/cid/cidgload.c | 161 ++++++++++++++++++++++++++++++++++------------------- src/cid/cidgload.h | 8 +++ src/cid/cidriver.c | 18 +++++- 3 files changed, 128 insertions(+), 59 deletions(-) diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c index f4fe582be..babaf957c 100644 --- a/src/cid/cidgload.c +++ b/src/cid/cidgload.c @@ -40,6 +40,108 @@ #define FT_COMPONENT cidgload + /* + * A helper function to compute FD number (fd_select), + * the offset to the head of the glyph data (off1), + * and the offset to the and of the glyph data (off2). + * + * The number how many times cid_get_offset() is invoked + * can be controlled by the number how many non-NULL + * arguments are given. If fd_select is non-NULL but + * off1 and off2 are NULL, cid_get_offset() is invoked + * only for fd_select, off1/off2 are not validated. + * + */ + FT_LOCAL_DEF( FT_Error ) + cid_compute_fd_and_offsets( CID_Face face, + FT_UInt glyph_index, + FT_ULong* fd_select_p, + FT_ULong* off1_p, + FT_ULong* off2_p ) + { + FT_Error error = FT_Err_Ok; + CID_FaceInfo cid = &face->cid; + FT_Stream stream = face->cid_stream; + FT_UInt entry_len = cid->fd_bytes + cid->gd_bytes; + FT_Byte* p; + FT_Bool need_frame_exit = 0; + FT_ULong fd_select, off1, off2; + + + /* For ordinary fonts read the CID font dictionary index */ + /* and charstring offset from the CIDMap. */ + + if ( FT_STREAM_SEEK( cid->data_offset + cid->cidmap_offset + + glyph_index * entry_len ) || + FT_FRAME_ENTER( 2 * entry_len ) ) + goto Exit; + + need_frame_exit = 1; + + p = (FT_Byte*)stream->cursor; + fd_select = cid_get_offset( &p, cid->fd_bytes ); + off1 = cid_get_offset( &p, cid->gd_bytes ); + + p += cid->fd_bytes; + off2 = cid_get_offset( &p, cid->gd_bytes ); + + if (fd_select_p) + *fd_select_p = fd_select; + + if (off1_p) + *off1_p = off1; + + if (off2_p) + *off2_p = off2; + + if ( fd_select >= cid->num_dicts ) + { + /* + * fd_select == 0xFF is often used to indicate that the CID + * has no charstring to be rendered, similar to GID = 0xFFFF + * in TrueType fonts. + */ + if ( (cid->fd_bytes == 1 && fd_select == 0xFFU ) || + (cid->fd_bytes == 2 && fd_select == 0xFFFFU ) ) + { + FT_TRACE1(( "cid_load_glyph: fail for glyph_index=%d, " + "FD number %ld is the max integer fitting into %d byte%s\n", + glyph_index, fd_select, cid->fd_bytes, + cid->fd_bytes == 1 ? "" : "s" )); + } + else + { + FT_TRACE0(( "cid_load_glyph: fail for glyph_index=%d, " + "FD number %ld > number of dicts %d\n", + glyph_index, fd_select, cid->num_dicts )); + } + error = FT_THROW( Invalid_Offset ); + goto Exit; + } + else if ( off2 > stream->size ) + { + FT_TRACE0(( "cid_load_glyph: fail for glyph_index=%d, " + "end of the glyph data is beyond the data stream\n", + glyph_index )); + error = FT_THROW( Invalid_Offset ); + goto Exit; + } + else if ( off1 > off2 ) + { + FT_TRACE0(( "cid_load_glyph: fail for glyph_index=%d, " + "the end position of glyph data is set before the start position\n", + glyph_index )); + error = FT_THROW( Invalid_Offset ); + } + + Exit: + if ( need_frame_exit ) + FT_FRAME_EXIT(); + + return error; + } + + FT_CALLBACK_DEF( FT_Error ) cid_load_glyph( T1_Decoder decoder, FT_UInt glyph_index ) @@ -97,67 +199,14 @@ else #endif /* FT_CONFIG_OPTION_INCREMENTAL */ - - /* For ordinary fonts read the CID font dictionary index */ - /* and charstring offset from the CIDMap. */ { - FT_UInt entry_len = cid->fd_bytes + cid->gd_bytes; FT_ULong off1, off2; - if ( FT_STREAM_SEEK( cid->data_offset + cid->cidmap_offset + - glyph_index * entry_len ) || - FT_FRAME_ENTER( 2 * entry_len ) ) - goto Exit; - - p = (FT_Byte*)stream->cursor; - fd_select = cid_get_offset( &p, cid->fd_bytes ); - off1 = cid_get_offset( &p, cid->gd_bytes ); - p += cid->fd_bytes; - off2 = cid_get_offset( &p, cid->gd_bytes ); - FT_FRAME_EXIT(); - - - if ( fd_select >= cid->num_dicts ) - { - /* - * fd_select == 0xFF is often used to indicate that the CID - * has no charstring to be rendered, similar to GID = 0xFFFF - * in TrueType fonts. - */ - if ( (cid->fd_bytes == 1 && fd_select == 0xFFU ) || - (cid->fd_bytes == 2 && fd_select == 0xFFFFU ) ) - { - FT_TRACE1(( "cid_load_glyph: fail for glyph_index=%d, " - "FD number %ld is the max integer fitting into %d byte%s\n", - glyph_index, fd_select, cid->fd_bytes, - cid->fd_bytes == 1 ? "" : "s" )); - } - else - { - FT_TRACE0(( "cid_load_glyph: fail for glyph_index=%d, " - "FD number %ld > number of dicts %d\n", - glyph_index, fd_select, cid->num_dicts )); - } - error = FT_THROW( Invalid_Offset ); - goto Exit; - } - else if ( off2 > stream->size ) - { - FT_TRACE0(( "cid_load_glyph: fail for glyph_index=%d, " - "end of the glyph data is beyond the data stream\n", - glyph_index )); - error = FT_THROW( Invalid_Offset ); - goto Exit; - } - else if ( off1 > off2 ) - { - FT_TRACE0(( "cid_load_glyph: fail for glyph_index=%d, " - "the end position of glyph data is set before the start position\n", - glyph_index )); - error = FT_THROW( Invalid_Offset ); + error = cid_compute_fd_and_offsets( face, glyph_index, + &fd_select, &off1, &off2 ); + if ( error ) goto Exit; - } glyph_length = off2 - off1; diff --git a/src/cid/cidgload.h b/src/cid/cidgload.h index 97954d418..edd622923 100644 --- a/src/cid/cidgload.h +++ b/src/cid/cidgload.h @@ -42,6 +42,14 @@ FT_BEGIN_HEADER FT_Int32 load_flags ); + FT_LOCAL( FT_Error ) + cid_compute_fd_and_offsets( CID_Face face, + FT_UInt glyph_index, + FT_ULong* fd_select_p, + FT_ULong* off1_p, + FT_ULong* off2_p ); + + FT_END_HEADER #endif /* CIDGLOAD_H_ */ diff --git a/src/cid/cidriver.c b/src/cid/cidriver.c index f7499237d..10cb8c1fd 100644 --- a/src/cid/cidriver.c +++ b/src/cid/cidriver.c @@ -150,11 +150,23 @@ FT_UInt *cid ) { FT_Error error = FT_Err_Ok; - FT_UNUSED( face ); - if ( cid ) - *cid = glyph_index; /* identity mapping */ + /* + * Currently, FreeType does not support an incrementally- + * defined CID-keyed font that stores the glyph description + * data in /GlyphDirectory array or dictionary. + * Thus the font loaded by the incremental loading feature + * is not handled in here. + */ + error = cid_compute_fd_and_offsets( face, glyph_index, + NULL, NULL, NULL ); + + + if ( error ) + *cid = 0; + else + *cid = glyph_index; return error; } -- cgit v1.2.3 From f2f975454263a28cc4a2699459cf1897b2399cbf Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Wed, 3 May 2023 23:02:04 -0400 Subject: [cache] Revise list cleansing. * src/cache/ftcmru.c (FTC_MruList_RemoveSelection): Use one loop to do it. * src/cache/ftcmanag.c (FTC_Manager_Compress, FTC_Manager_FlushN): Streamline loops. --- src/cache/ftcmanag.c | 42 +++++++++++++++++------------------------- src/cache/ftcmru.c | 28 +++++++++++----------------- 2 files changed, 28 insertions(+), 42 deletions(-) diff --git a/src/cache/ftcmanag.c b/src/cache/ftcmanag.c index 6c8433910..94f8469c9 100644 --- a/src/cache/ftcmanag.c +++ b/src/cache/ftcmanag.c @@ -426,7 +426,7 @@ memory = manager->memory; /* now discard all caches */ - for (idx = manager->num_caches; idx-- > 0; ) + for ( idx = manager->num_caches; idx-- > 0; ) { FTC_Cache cache = manager->caches[idx]; @@ -537,7 +537,7 @@ FT_LOCAL_DEF( void ) FTC_Manager_Compress( FTC_Manager manager ) { - FTC_Node node, first; + FTC_Node node, prev, first; if ( !manager ) @@ -557,20 +557,16 @@ return; /* go to last node -- it's a circular list */ - node = FTC_NODE_PREV( first ); + prev = FTC_NODE_PREV( first ); do { - FTC_Node prev; - - - prev = ( node == first ) ? NULL : FTC_NODE_PREV( node ); + node = prev; + prev = FTC_NODE_PREV( node ); if ( node->ref_count <= 0 ) ftc_node_destroy( node, manager ); - node = prev; - - } while ( node && manager->cur_weight > manager->max_weight ); + } while ( node != first && manager->cur_weight > manager->max_weight ); } @@ -633,20 +629,20 @@ FT_UInt count ) { FTC_Node first = manager->nodes_list; - FTC_Node node; - FT_UInt result; + FTC_Node prev, node; + FT_UInt result = 0; /* try to remove `count' nodes from the list */ - if ( !first ) /* empty list! */ - return 0; + if ( !first || !count ) + return result; - /* go to last node - it's a circular list */ - node = FTC_NODE_PREV(first); - for ( result = 0; result < count; ) + /* go to last node -- it's a circular list */ + prev = FTC_NODE_PREV( first ); + do { - FTC_Node prev = FTC_NODE_PREV( node ); - + node = prev; + prev = FTC_NODE_PREV( node ); /* don't touch locked nodes */ if ( node->ref_count <= 0 ) @@ -654,13 +650,9 @@ ftc_node_destroy( node, manager ); result++; } + } while ( node != first && result < count ); - if ( node == first ) - break; - - node = prev; - } - return result; + return result; } diff --git a/src/cache/ftcmru.c b/src/cache/ftcmru.c index 67227033e..fb1693dae 100644 --- a/src/cache/ftcmru.c +++ b/src/cache/ftcmru.c @@ -329,29 +329,23 @@ FTC_MruNode_CompareFunc selection, FT_Pointer key ) { - FTC_MruNode first, node, next; + FTC_MruNode first = list->nodes; + FTC_MruNode node, next; - first = list->nodes; - while ( first && ( !selection || selection( first, key ) ) ) - { - FTC_MruList_Remove( list, first ); - first = list->nodes; - } + if ( !first || !selection ) + return; - if ( first ) + next = first; + do { - node = first->next; - while ( node != first ) - { - next = node->next; + node = next; + next = node->next; - if ( selection( node, key ) ) - FTC_MruList_Remove( list, node ); + if ( selection( node, key ) ) + FTC_MruList_Remove( list, node ); - node = next; - } - } + } while ( next != first ); } -- cgit v1.2.3 From 345f88109bf45911d9032e168dedea3e9bc0d587 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Wed, 3 May 2023 23:33:32 -0400 Subject: * src/cache/ftcmru.c (FTC_MruList_RemoveSelection): Purge backwards. --- src/cache/ftcmru.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cache/ftcmru.c b/src/cache/ftcmru.c index fb1693dae..ad10a06bc 100644 --- a/src/cache/ftcmru.c +++ b/src/cache/ftcmru.c @@ -330,22 +330,22 @@ FT_Pointer key ) { FTC_MruNode first = list->nodes; - FTC_MruNode node, next; + FTC_MruNode prev, node; if ( !first || !selection ) return; - next = first; + prev = first->prev; do { - node = next; - next = node->next; + node = prev; + prev = node->prev; if ( selection( node, key ) ) FTC_MruList_Remove( list, node ); - } while ( next != first ); + } while ( node != first ); } -- cgit v1.2.3 From 9127c68f593d9509bc289518bf907c311425e694 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Thu, 4 May 2023 16:54:22 +0000 Subject: * src/cache/ftccache.c (ftc_node_hash_unlink): Minor. --- src/cache/ftccache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cache/ftccache.c b/src/cache/ftccache.c index d54e68ca9..ef7369d0a 100644 --- a/src/cache/ftccache.c +++ b/src/cache/ftccache.c @@ -239,7 +239,7 @@ if ( node == node0 ) break; - pnode = &(*pnode)->link; + pnode = &node->link; } *pnode = node0->link; -- cgit v1.2.3 From b5e57b041b1ee4a86e58b1f63ea1b95fd0b2a3d7 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 6 May 2023 16:41:13 +0200 Subject: [cid] Improve tracing messages; formatting. --- include/freetype/internal/ftdrv.h | 1 + src/cid/cidgload.c | 93 +++++++++++++++++++++------------------ src/cid/cidriver.c | 11 ++--- 3 files changed, 56 insertions(+), 49 deletions(-) diff --git a/include/freetype/internal/ftdrv.h b/include/freetype/internal/ftdrv.h index f78912ca0..9001c07ad 100644 --- a/include/freetype/internal/ftdrv.h +++ b/include/freetype/internal/ftdrv.h @@ -157,6 +157,7 @@ FT_BEGIN_HEADER * A handle to a function used to select a new fixed size. It is used * only if @FT_FACE_FLAG_FIXED_SIZES is set. Can be set to 0 if the * scaling done in the base layer suffices. + * * @note: * Most function pointers, with the exception of `load_glyph`, can be set * to 0 to indicate a default behaviour. diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c index babaf957c..0e6a7ad6b 100644 --- a/src/cid/cidgload.c +++ b/src/cid/cidgload.c @@ -41,35 +41,36 @@ /* - * A helper function to compute FD number (fd_select), - * the offset to the head of the glyph data (off1), - * and the offset to the and of the glyph data (off2). + * A helper function to compute FD number (`fd_select`), the offset to the + * head of the glyph data (`off1`), and the offset to the and of the glyph + * data (`off2`). * - * The number how many times cid_get_offset() is invoked - * can be controlled by the number how many non-NULL - * arguments are given. If fd_select is non-NULL but - * off1 and off2 are NULL, cid_get_offset() is invoked - * only for fd_select, off1/off2 are not validated. + * The number how many times `cid_get_offset` is invoked can be controlled + * by the number of non-NULL arguments. If `fd_select` is non-NULL but + * `off1` and `off2` are NULL, `cid_get_offset` is invoked only for + * `fd_select`; `off1` and `off2` are not validated. * */ FT_LOCAL_DEF( FT_Error ) - cid_compute_fd_and_offsets( CID_Face face, - FT_UInt glyph_index, - FT_ULong* fd_select_p, - FT_ULong* off1_p, - FT_ULong* off2_p ) + cid_compute_fd_and_offsets( CID_Face face, + FT_UInt glyph_index, + FT_ULong* fd_select_p, + FT_ULong* off1_p, + FT_ULong* off2_p ) { - FT_Error error = FT_Err_Ok; - CID_FaceInfo cid = &face->cid; - FT_Stream stream = face->cid_stream; + FT_Error error = FT_Err_Ok; + + CID_FaceInfo cid = &face->cid; + FT_Stream stream = face->cid_stream; FT_UInt entry_len = cid->fd_bytes + cid->gd_bytes; - FT_Byte* p; - FT_Bool need_frame_exit = 0; - FT_ULong fd_select, off1, off2; + + FT_Byte* p; + FT_Bool need_frame_exit = 0; + FT_ULong fd_select, off1, off2; - /* For ordinary fonts read the CID font dictionary index */ - /* and charstring offset from the CIDMap. */ + /* For ordinary fonts, read the CID font dictionary index */ + /* and charstring offset from the CIDMap. */ if ( FT_STREAM_SEEK( cid->data_offset + cid->cidmap_offset + glyph_index * entry_len ) || @@ -78,20 +79,18 @@ need_frame_exit = 1; - p = (FT_Byte*)stream->cursor; + p = (FT_Byte*)stream->cursor; fd_select = cid_get_offset( &p, cid->fd_bytes ); off1 = cid_get_offset( &p, cid->gd_bytes ); - p += cid->fd_bytes; - off2 = cid_get_offset( &p, cid->gd_bytes ); + p += cid->fd_bytes; + off2 = cid_get_offset( &p, cid->gd_bytes ); - if (fd_select_p) + if ( fd_select_p ) *fd_select_p = fd_select; - - if (off1_p) + if ( off1_p ) *off1_p = off1; - - if (off2_p) + if ( off2_p ) *off2_p = off2; if ( fd_select >= cid->num_dicts ) @@ -101,36 +100,46 @@ * has no charstring to be rendered, similar to GID = 0xFFFF * in TrueType fonts. */ - if ( (cid->fd_bytes == 1 && fd_select == 0xFFU ) || - (cid->fd_bytes == 2 && fd_select == 0xFFFFU ) ) + if ( ( cid->fd_bytes == 1 && fd_select == 0xFFU ) || + ( cid->fd_bytes == 2 && fd_select == 0xFFFFU ) ) { - FT_TRACE1(( "cid_load_glyph: fail for glyph_index=%d, " - "FD number %ld is the max integer fitting into %d byte%s\n", - glyph_index, fd_select, cid->fd_bytes, - cid->fd_bytes == 1 ? "" : "s" )); + FT_TRACE1(( "cid_load_glyph: fail for glyph index %d:\n", + glyph_index )); + FT_TRACE1(( " FD number %ld is the maximum\n", + fd_select )); + FT_TRACE1(( " integer fitting into %d byte%s\n", + cid->fd_bytes, cid->fd_bytes == 1 ? "" : "s" )); } else { - FT_TRACE0(( "cid_load_glyph: fail for glyph_index=%d, " - "FD number %ld > number of dicts %d\n", - glyph_index, fd_select, cid->num_dicts )); + FT_TRACE0(( "cid_load_glyph: fail for glyph index %d:\n", + glyph_index )); + FT_TRACE0(( " FD number %ld is larger\n", + fd_select )); + FT_TRACE0(( " than number of dictionaries (%d)\n", + cid->num_dicts )); } + error = FT_THROW( Invalid_Offset ); goto Exit; } else if ( off2 > stream->size ) { - FT_TRACE0(( "cid_load_glyph: fail for glyph_index=%d, " - "end of the glyph data is beyond the data stream\n", + FT_TRACE0(( "cid_load_glyph: fail for glyph index %d:\n", glyph_index )); + FT_TRACE0(( " end of the glyph data\n" )); + FT_TRACE0(( " is beyond the data stream\n" )); + error = FT_THROW( Invalid_Offset ); goto Exit; } else if ( off1 > off2 ) { - FT_TRACE0(( "cid_load_glyph: fail for glyph_index=%d, " - "the end position of glyph data is set before the start position\n", + FT_TRACE0(( "cid_load_glyph: fail for glyph index %d:\n", glyph_index )); + FT_TRACE0(( " the end position of glyph data\n" )); + FT_TRACE0(( " is set before the start position\n" )); + error = FT_THROW( Invalid_Offset ); } diff --git a/src/cid/cidriver.c b/src/cid/cidriver.c index 10cb8c1fd..9669eb73e 100644 --- a/src/cid/cidriver.c +++ b/src/cid/cidriver.c @@ -153,16 +153,13 @@ /* - * Currently, FreeType does not support an incrementally- - * defined CID-keyed font that stores the glyph description - * data in /GlyphDirectory array or dictionary. - * Thus the font loaded by the incremental loading feature - * is not handled in here. + * Currently, FreeType does not support incrementally-defined, CID-keyed + * fonts that store the glyph description data in a `/GlyphDirectory` + * array or dictionary. Fonts loaded by the incremental loading feature + * are thus not handled here. */ error = cid_compute_fd_and_offsets( face, glyph_index, NULL, NULL, NULL ); - - if ( error ) *cid = 0; else -- cgit v1.2.3 From fb982e78a7d4468aa55ae2b560f0213d289c52fa Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 26 Apr 2023 08:17:17 +0200 Subject: New Variation Font function `FT_Get_Default_Named_Instance`. * include/freetype/ftmm.h, src/base/ftmm.c (FT_Get_Default_Named_Instance): New function. * include/freetype/internal/services/svmm.h (FT_Get_Default_Named_Instance_Func): New typedef. (FT_Service_MultiMasters): New field `get_default_named_instance`. (FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated. * include/freetype/internal/tttypes.h (TT_Face): New field `var_default_named_instance`. * src/sfnt/sfobjc.s (sfnt_init_face): Initialize `var_default_named_instance`. * src/cff/cffdrivr.c (cff_get_default_named_instance): New function. (cff_service_multi_masters): Updated. * src/truetype/ttgxvar.c (TT_Get_MM_Var): Initialize `var_default_named_instance`. (TT_Get_Default_Named_Instance): 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. * docs/CHANGES: Updated. --- docs/CHANGES | 12 ++++- include/freetype/ftmm.h | 39 +++++++++++++++ include/freetype/internal/services/svmm.h | 81 +++++++++++++++++-------------- include/freetype/internal/tttypes.h | 4 ++ src/base/ftmm.c | 28 +++++++++++ src/cff/cffdrivr.c | 48 +++++++++++------- src/sfnt/sfobjs.c | 3 ++ src/truetype/ttdriver.c | 37 +++++++------- src/truetype/ttgxvar.c | 48 +++++++++++++++++- src/truetype/ttgxvar.h | 4 ++ src/type1/t1driver.c | 36 +++++++------- 11 files changed, 249 insertions(+), 91 deletions(-) diff --git a/docs/CHANGES b/docs/CHANGES index bc85f9d57..105f976e8 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -1,3 +1,13 @@ +CHANGES BETWEEN 2.13.0 and 2.13.1 (2023-XXX-XX) + + I. MISCELLANEOUS + + - New function `FT_Get_Default_Named_Instance` to get the index of + the default named instance of an OpenType Variation Font. + + +====================================================================== + CHANGES BETWEEN 2.12.1 and 2.13.0 (2023-Feb-09) I. IMPORTANT CHANGES @@ -12,7 +22,7 @@ CHANGES BETWEEN 2.12.1 and 2.13.0 (2023-Feb-09) https://learn.microsoft.com/en-us/typography/opentype/spec/colr - III. MISCELLANEOUS + II. MISCELLANEOUS - For OpenType Variable Fonts, `avar` table format 2.0 is now supported. The code was contributed by Behdad Esfahbod. diff --git a/include/freetype/ftmm.h b/include/freetype/ftmm.h index 3eabdd5f2..2c2f165fa 100644 --- a/include/freetype/ftmm.h +++ b/include/freetype/ftmm.h @@ -753,6 +753,45 @@ FT_BEGIN_HEADER FT_Set_Named_Instance( FT_Face face, FT_UInt instance_index ); + + /************************************************************************** + * + * @function: + * FT_Get_Default_Named_Instance + * + * @description: + * Retrieve the index of the default named instance, to be used with + * @FT_Set_Named_Instance. + * + * The default instance of a variation font is that instance for which + * the nth axis coordinate is equal to `axis[n].def` (as specified in the + * @FT_MM_Var structure), with~n covering all axes. + * + * FreeType synthesizes a named instance for the default instance if the + * font does not contain such an entry. + * + * @input: + * face :: + * A handle to the source face. + * + * @output: + * instance_index :: + * The index of the default named instance. + * + * @return: + * FreeType error code. 0~means success. + * + * @note: + * For Adobe MM fonts (which don't have named instances) this function + * always returns zero for `instance_index`. + * + * @since: + * 2.13.1 + */ + FT_EXPORT( FT_Error ) + FT_Get_Default_Named_Instance( FT_Face face, + FT_UInt *instance_index ); + /* */ diff --git a/include/freetype/internal/services/svmm.h b/include/freetype/internal/services/svmm.h index d94204232..f87b8acf7 100644 --- a/include/freetype/internal/services/svmm.h +++ b/include/freetype/internal/services/svmm.h @@ -73,6 +73,10 @@ FT_BEGIN_HEADER (*FT_Set_Instance_Func)( FT_Face face, FT_UInt instance_index ); + typedef FT_Error + (*FT_Get_Default_Named_Instance_Func)( FT_Face face, + FT_UInt *instance_index ); + typedef FT_Error (*FT_Get_MM_Blend_Func)( FT_Face face, FT_UInt num_coords, @@ -135,6 +139,7 @@ FT_BEGIN_HEADER FT_Set_Var_Design_Func set_var_design; FT_Get_Var_Design_Func get_var_design; FT_Set_Instance_Func set_instance; + FT_Get_Default_Named_Instance_Func get_default_named_instance; FT_Set_MM_WeightVector_Func set_mm_weightvector; FT_Get_MM_WeightVector_Func get_mm_weightvector; @@ -149,43 +154,45 @@ FT_BEGIN_HEADER }; -#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_, \ - set_weightvector_, \ - get_weightvector_, \ - load_delta_set_idx_map_, \ - load_item_var_store_, \ - get_item_delta_, \ - done_item_var_store_, \ - done_delta_set_idx_map_, \ - 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_, \ - set_weightvector_, \ - get_weightvector_, \ - load_delta_set_idx_map_, \ - load_item_var_store_, \ - get_item_delta_, \ - done_item_var_store_, \ - done_delta_set_idx_map_, \ - 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_default_named_instance_, \ + set_weightvector_, \ + get_weightvector_, \ + load_delta_set_idx_map_, \ + load_item_var_store_, \ + get_item_delta_, \ + done_item_var_store_, \ + done_delta_set_idx_map_, \ + 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_default_named_instance_, \ + set_weightvector_, \ + get_weightvector_, \ + load_delta_set_idx_map_, \ + load_item_var_store_, \ + get_item_delta_, \ + done_item_var_store_, \ + done_delta_set_idx_map_, \ + get_var_blend_, \ + done_blend_ \ }; /* */ diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h index af6830a4d..10af061b9 100644 --- a/include/freetype/internal/tttypes.h +++ b/include/freetype/internal/tttypes.h @@ -1315,6 +1315,9 @@ FT_BEGIN_HEADER * var_postscript_prefix_len :: * The length of the `var_postscript_prefix` string. * + * var_default_named_instance :: + * The index of the default named instance. + * * horz_metrics_size :: * The size of the 'hmtx' table. * @@ -1552,6 +1555,7 @@ FT_BEGIN_HEADER const char* var_postscript_prefix; /* since 2.7.2 */ FT_UInt var_postscript_prefix_len; /* since 2.7.2 */ + FT_UInt var_default_named_instance; /* since 2.13.1 */ #endif /* since version 2.2 */ diff --git a/src/base/ftmm.c b/src/base/ftmm.c index a2b4bd03d..781db315e 100644 --- a/src/base/ftmm.c +++ b/src/base/ftmm.c @@ -565,4 +565,32 @@ } + /* documentation is in ftmm.h */ + + FT_EXPORT_DEF( FT_Error ) + FT_Get_Default_Named_Instance( FT_Face face, + FT_UInt *instance_index ) + { + FT_Error error; + + FT_Service_MultiMasters service_mm = NULL; + + + /* check of `face' delayed to `ft_face_get_mm_service' */ + + error = ft_face_get_mm_service( face, &service_mm ); + if ( !error ) + { + /* no error if `get_default_named_instance` is not available */ + if ( service_mm->get_default_named_instance ) + error = service_mm->get_default_named_instance( face, + instance_index ); + else + error = FT_Err_Ok; + } + + return error; + } + + /* END */ diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index 7d45e4641..d9ed35b2b 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -942,6 +942,17 @@ } + static FT_Error + cff_get_default_named_instance( CFF_Face face, + FT_UInt *instance_index ) + { + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + + + return mm->get_default_named_instance( FT_FACE( face ), instance_index ); + } + + static FT_Error cff_load_item_variation_store( CFF_Face face, FT_ULong offset, @@ -1009,36 +1020,39 @@ FT_DEFINE_SERVICE_MULTIMASTERSREC( cff_service_multi_masters, - (FT_Get_MM_Func) NULL, /* get_mm */ - (FT_Set_MM_Design_Func) NULL, /* set_mm_design */ - (FT_Set_MM_Blend_Func) cff_set_mm_blend, /* set_mm_blend */ - (FT_Get_MM_Blend_Func) cff_get_mm_blend, /* get_mm_blend */ - (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) cff_set_instance, /* set_instance */ + (FT_Get_MM_Func) NULL, /* get_mm */ + (FT_Set_MM_Design_Func) NULL, /* set_mm_design */ + (FT_Set_MM_Blend_Func) cff_set_mm_blend, /* set_mm_blend */ + (FT_Get_MM_Blend_Func) cff_get_mm_blend, /* get_mm_blend */ + (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) cff_set_instance, /* set_instance */ + (FT_Get_Default_Named_Instance_Func) + cff_get_default_named_instance, + /* get_default_named_instance */ (FT_Set_MM_WeightVector_Func) cff_set_mm_weightvector, - /* set_mm_weightvector */ + /* set_mm_weightvector */ (FT_Get_MM_WeightVector_Func) cff_get_mm_weightvector, - /* get_mm_weightvector */ + /* get_mm_weightvector */ (FT_Var_Load_Delta_Set_Idx_Map_Func) cff_load_delta_set_index_mapping, - /* load_delta_set_idx_map */ + /* load_delta_set_idx_map */ (FT_Var_Load_Item_Var_Store_Func) cff_load_item_variation_store, - /* load_item_variation_store */ + /* load_item_variation_store */ (FT_Var_Get_Item_Delta_Func) - cff_get_item_delta, /* get_item_delta */ + cff_get_item_delta, /* get_item_delta */ (FT_Var_Done_Item_Var_Store_Func) cff_done_item_variation_store, - /* done_item_variation_store */ + /* done_item_variation_store */ (FT_Var_Done_Delta_Set_Idx_Map_Func) cff_done_delta_set_index_map, - /* done_delta_set_index_map */ - (FT_Get_Var_Blend_Func) cff_get_var_blend, /* get_var_blend */ - (FT_Done_Blend_Func) cff_done_blend /* done_blend */ + /* done_delta_set_index_map */ + (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/sfnt/sfobjs.c b/src/sfnt/sfobjs.c index 13f2f45f4..1574c353d 100644 --- a/src/sfnt/sfobjs.c +++ b/src/sfnt/sfobjs.c @@ -698,6 +698,9 @@ instance_offset += instance_size; } + /* named instance indices start with value 1 */ + face->var_default_named_instance = i + 1; + if ( i == num_instances ) { /* no default instance in named instance table; */ diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c index c2e041cd3..c128be19d 100644 --- a/src/truetype/ttdriver.c +++ b/src/truetype/ttdriver.c @@ -517,34 +517,37 @@ FT_DEFINE_SERVICE_MULTIMASTERSREC( tt_service_gx_multi_masters, - (FT_Get_MM_Func) NULL, /* get_mm */ - (FT_Set_MM_Design_Func) NULL, /* set_mm_design */ - (FT_Set_MM_Blend_Func) TT_Set_MM_Blend, /* set_mm_blend */ - (FT_Get_MM_Blend_Func) TT_Get_MM_Blend, /* get_mm_blend */ - (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) TT_Set_Named_Instance, /* set_instance */ + (FT_Get_MM_Func) NULL, /* get_mm */ + (FT_Set_MM_Design_Func) NULL, /* set_mm_design */ + (FT_Set_MM_Blend_Func) TT_Set_MM_Blend, /* set_mm_blend */ + (FT_Get_MM_Blend_Func) TT_Get_MM_Blend, /* get_mm_blend */ + (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) TT_Set_Named_Instance, /* set_instance */ + (FT_Get_Default_Named_Instance_Func) + TT_Get_Default_Named_Instance, + /* get_default_named_instance */ (FT_Set_MM_WeightVector_Func) - NULL, /* set_mm_weightvector */ + NULL, /* set_mm_weightvector */ (FT_Get_MM_WeightVector_Func) - NULL, /* get_mm_weightvector */ + NULL, /* get_mm_weightvector */ (FT_Var_Load_Delta_Set_Idx_Map_Func) tt_var_load_delta_set_index_mapping, - /* load_delta_set_idx_map */ + /* load_delta_set_idx_map */ (FT_Var_Load_Item_Var_Store_Func) tt_var_load_item_variation_store, - /* load_item_variation_store */ + /* load_item_variation_store */ (FT_Var_Get_Item_Delta_Func) - tt_var_get_item_delta, /* get_item_delta */ + tt_var_get_item_delta, /* get_item_delta */ (FT_Var_Done_Item_Var_Store_Func) tt_var_done_item_variation_store, - /* done_item_variation_store */ + /* done_item_variation_store */ (FT_Var_Done_Delta_Set_Idx_Map_Func) tt_var_done_delta_set_index_map, - /* done_delta_set_index_map */ - (FT_Get_Var_Blend_Func) tt_get_var_blend, /* get_var_blend */ - (FT_Done_Blend_Func) tt_done_blend /* done_blend */ + /* done_delta_set_index_map */ + (FT_Get_Var_Blend_Func) tt_get_var_blend, /* get_var_blend */ + (FT_Done_Blend_Func) tt_done_blend /* done_blend */ ) FT_DEFINE_SERVICE_METRICSVARIATIONSREC( diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 963dcb7e3..d28cc245e 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -2630,8 +2630,10 @@ FT_UInt strid = ~0U; - /* the default instance is missing in array the */ - /* of named instances; try to synthesize an entry */ + /* The default instance is missing in array the */ + /* of named instances; try to synthesize an entry. */ + /* If this fails, `default_named_instance` remains */ + /* at value zero, which doesn't do any harm. */ found = sfnt->get_name_id( face, TT_NAME_ID_TYPOGRAPHIC_SUBFAMILY, &dummy1, @@ -2659,6 +2661,9 @@ FT_TRACE5(( "TT_Get_MM_Var:" " Adding default instance to named instances\n" )); + /* named instance indices start with value 1 */ + face->var_default_named_instance = num_instances; + ns = &mmvar->namedstyle[fvar_head.instanceCount]; ns->strid = strid; @@ -3386,6 +3391,45 @@ } + /************************************************************************** + * + * @Function: + * TT_Get_Default_Named_Instance + * + * @Description: + * Get the default named instance. + * + * @Input: + * face :: + * A handle to the source face. + * + * @Output: + * instance_index :: + * The default named instance index. + * + * @Return: + * FreeType error code. 0~means success. + */ + FT_LOCAL_DEF( FT_Error ) + TT_Get_Default_Named_Instance( TT_Face face, + FT_UInt *instance_index ) + { + FT_Error error = FT_Err_Ok; + + + if ( !face->blend ) + { + if ( FT_SET_ERROR( TT_Get_MM_Var( face, NULL ) ) ) + goto Exit; + } + + *instance_index = face->var_default_named_instance; + + Exit: + return error; + } + + /*************************************************************************/ /*************************************************************************/ /***** *****/ diff --git a/src/truetype/ttgxvar.h b/src/truetype/ttgxvar.h index 4fec980dc..0c096f7df 100644 --- a/src/truetype/ttgxvar.h +++ b/src/truetype/ttgxvar.h @@ -374,6 +374,10 @@ FT_BEGIN_HEADER TT_Set_Named_Instance( TT_Face face, FT_UInt instance_index ); + FT_LOCAL( FT_Error ) + TT_Get_Default_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 ded3b264e..5d0fe533c 100644 --- a/src/type1/t1driver.c +++ b/src/type1/t1driver.c @@ -121,30 +121,32 @@ #ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT static const FT_Service_MultiMastersRec t1_service_multi_masters = { - (FT_Get_MM_Func) T1_Get_Multi_Master, /* get_mm */ - (FT_Set_MM_Design_Func) T1_Set_MM_Design, /* set_mm_design */ - (FT_Set_MM_Blend_Func) T1_Set_MM_Blend, /* set_mm_blend */ - (FT_Get_MM_Blend_Func) T1_Get_MM_Blend, /* get_mm_blend */ - (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) T1_Reset_MM_Blend, /* set_instance */ + (FT_Get_MM_Func) T1_Get_Multi_Master, /* get_mm */ + (FT_Set_MM_Design_Func) T1_Set_MM_Design, /* set_mm_design */ + (FT_Set_MM_Blend_Func) T1_Set_MM_Blend, /* set_mm_blend */ + (FT_Get_MM_Blend_Func) T1_Get_MM_Blend, /* get_mm_blend */ + (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) T1_Reset_MM_Blend, /* set_instance */ + (FT_Get_Default_Named_Instance_Func) + NULL, /* get_default_named_instance */ (FT_Set_MM_WeightVector_Func) - T1_Set_MM_WeightVector, /* set_mm_weightvector */ + T1_Set_MM_WeightVector, /* set_mm_weightvector */ (FT_Get_MM_WeightVector_Func) - T1_Get_MM_WeightVector, /* get_mm_weightvector */ + T1_Get_MM_WeightVector, /* get_mm_weightvector */ (FT_Var_Load_Delta_Set_Idx_Map_Func) - NULL, /* load_delta_set_idx_map */ + NULL, /* load_delta_set_idx_map */ (FT_Var_Load_Item_Var_Store_Func) - NULL, /* load_item_variation_store */ + NULL, /* load_item_variation_store */ (FT_Var_Get_Item_Delta_Func) - NULL, /* get_item_delta */ + NULL, /* get_item_delta */ (FT_Var_Done_Item_Var_Store_Func) - NULL, /* done_item_variation_store */ + NULL, /* done_item_variation_store */ (FT_Var_Done_Delta_Set_Idx_Map_Func) - NULL, /* done_delta_set_index_map */ - (FT_Get_Var_Blend_Func) NULL, /* get_var_blend */ - (FT_Done_Blend_Func) T1_Done_Blend /* done_blend */ + NULL, /* done_delta_set_index_map */ + (FT_Get_Var_Blend_Func) NULL, /* get_var_blend */ + (FT_Done_Blend_Func) T1_Done_Blend /* done_blend */ }; #endif -- cgit v1.2.3 From fdcb14a2eebb48bb137f6e9afc27faac931967b6 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 27 Apr 2023 06:18:38 +0200 Subject: s/set_instance/set_named_instance/ * include/freetype/internal/services/svmm.h (FT_Set_Instance_Func): Renamed to... (FT_Set_Named_Instance_Func): ...this. (FT_Service_MultiMasters): Rename `set_instance` to `set_named_instance`. (FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated. * src/base/ftmm.c (FT_Set_Named_Instance): Updated. * src/cff/cffdrivr.c (cff_set_instance): Renamed to... (cff_set_named_instance): ...this. (cff_service_multi_masters): Updated. * src/cff/cffobjs.c (cff_face_init): Updated. * src/truetype/ttdriver.c (tt_service_gx_multi_masters): Updated. * src/type1/t1driver.c (t1_service_multi_masters): Updated. --- include/freetype/internal/services/svmm.h | 10 +++++----- src/base/ftmm.c | 4 ++-- src/cff/cffdrivr.c | 10 ++++++---- src/cff/cffobjs.c | 2 +- src/truetype/ttdriver.c | 3 ++- src/type1/t1driver.c | 3 ++- 6 files changed, 18 insertions(+), 14 deletions(-) diff --git a/include/freetype/internal/services/svmm.h b/include/freetype/internal/services/svmm.h index f87b8acf7..80541c4ce 100644 --- a/include/freetype/internal/services/svmm.h +++ b/include/freetype/internal/services/svmm.h @@ -70,8 +70,8 @@ FT_BEGIN_HEADER FT_Fixed* coords ); typedef FT_Error - (*FT_Set_Instance_Func)( FT_Face face, - FT_UInt instance_index ); + (*FT_Set_Named_Instance_Func)( FT_Face face, + FT_UInt instance_index ); typedef FT_Error (*FT_Get_Default_Named_Instance_Func)( FT_Face face, @@ -138,7 +138,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; + FT_Set_Named_Instance_Func set_named_instance; FT_Get_Default_Named_Instance_Func get_default_named_instance; FT_Set_MM_WeightVector_Func set_mm_weightvector; FT_Get_MM_WeightVector_Func get_mm_weightvector; @@ -162,7 +162,7 @@ FT_BEGIN_HEADER get_mm_var_, \ set_var_design_, \ get_var_design_, \ - set_instance_, \ + set_named_instance_, \ get_default_named_instance_, \ set_weightvector_, \ get_weightvector_, \ @@ -182,7 +182,7 @@ FT_BEGIN_HEADER get_mm_var_, \ set_var_design_, \ get_var_design_, \ - set_instance_, \ + set_named_instance_, \ get_default_named_instance_, \ set_weightvector_, \ get_weightvector_, \ diff --git a/src/base/ftmm.c b/src/base/ftmm.c index 781db315e..1d5e2bcca 100644 --- a/src/base/ftmm.c +++ b/src/base/ftmm.c @@ -535,8 +535,8 @@ if ( !error ) { error = FT_ERR( Invalid_Argument ); - if ( service_mm->set_instance ) - error = service_mm->set_instance( face, instance_index ); + if ( service_mm->set_named_instance ) + error = service_mm->set_named_instance( face, instance_index ); } if ( !error ) diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index d9ed35b2b..29f2a2b11 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -932,13 +932,13 @@ static FT_Error - cff_set_instance( CFF_Face face, - FT_UInt instance_index ) + cff_set_named_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 ); + return mm->set_named_instance( FT_FACE( face ), instance_index ); } @@ -1027,7 +1027,9 @@ (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) cff_set_instance, /* set_instance */ + (FT_Set_Named_Instance_Func) + cff_set_named_instance, + /* set_named_instance */ (FT_Get_Default_Named_Instance_Func) cff_get_default_named_instance, /* get_default_named_instance */ diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index 9608a4178..2285c1a48 100644 --- a/src/cff/cffobjs.c +++ b/src/cff/cffobjs.c @@ -731,7 +731,7 @@ mm && instance_index > 0 ) { - error = mm->set_instance( cffface, instance_index ); + error = mm->set_named_instance( cffface, instance_index ); if ( error ) goto Exit; diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c index c128be19d..54ad932ed 100644 --- a/src/truetype/ttdriver.c +++ b/src/truetype/ttdriver.c @@ -524,7 +524,8 @@ (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) TT_Set_Named_Instance, /* set_instance */ + (FT_Set_Named_Instance_Func) + TT_Set_Named_Instance, /* set_named_instance */ (FT_Get_Default_Named_Instance_Func) TT_Get_Default_Named_Instance, /* get_default_named_instance */ diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c index 5d0fe533c..4239d86fe 100644 --- a/src/type1/t1driver.c +++ b/src/type1/t1driver.c @@ -128,7 +128,8 @@ (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) T1_Reset_MM_Blend, /* set_instance */ + (FT_Set_Named_Instance_Func) + T1_Reset_MM_Blend, /* set_named_instance */ (FT_Get_Default_Named_Instance_Func) NULL, /* get_default_named_instance */ (FT_Set_MM_WeightVector_Func) -- cgit v1.2.3 From 6713b1e41a147897887c3a9b0136104a3f9ed2cf Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 26 Apr 2023 12:03:04 +0200 Subject: [truetype] Fix deactivation of variation font handling. According to the documentation, the functions `FT_Set_Named_Instance`, `FT_Set_MM_Design_Coordinates`, `FT_Set_Var_Design_Coordinates`, and `FT_Set_Var_Blend_Coordinates` can unset the `FT_FACE_FLAG_VARIATION` flag. (The same is true for `FT_Set_MM_WeightVector` but this information was accidentally omitted from the documentation.) However, if a call of these functions didn't change the axis values this could fail because internal shortcuts exited too early. This commit reorganizes the code to handle `FT_FACE_FLAG_VARIATION` in the top-level API functions, also taking care of the issue at hand. * src/base/ftmm.c (FT_Set_MM_Design_Coordinates, FT_Set_MM_WeightVector, FT_Set_Var_Design_Coordinates, FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): Handle `FT_FACE_FLAG_VARIATION`. * src/truetype/ttgxvar.c (TT_Set_MM_Blend, TT_Set_Var_Design, TT_Set_Named_Instance) Don't handle `FT_FACE_FLAG_VARIATION`. * src/type1/t1load.c (T1_Set_MM_Blend, T1_Set_MM_WeightVector, T1_Set_MM_Design): Ditto. * src/cff/cffobjs.c (cff_face_init): Use `FT_Set_Named_Instance` instead of low-level functions. * src/truetype/ttobjs.c (tt_face_init): Ditto. --- include/freetype/ftmm.h | 8 +++++--- src/base/ftmm.c | 40 ++++++++++++++++++++++++++++++++++++++++ src/cff/cffobjs.c | 11 +---------- src/truetype/ttgxvar.c | 15 ++------------- src/truetype/ttobjs.c | 6 +----- src/type1/t1load.c | 15 --------------- 6 files changed, 49 insertions(+), 46 deletions(-) diff --git a/include/freetype/ftmm.h b/include/freetype/ftmm.h index 2c2f165fa..d145128a9 100644 --- a/include/freetype/ftmm.h +++ b/include/freetype/ftmm.h @@ -602,10 +602,12 @@ FT_BEGIN_HEADER * * @note: * Adobe Multiple Master fonts limit the number of designs, and thus the - * length of the weight vector to~16. + * length of the weight vector to 16~elements. * - * If `len` is zero and `weightvector` is `NULL`, the weight vector array - * is reset to the default values. + * If `len` 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 `len` is zero, this bit flag + * is unset and the weight vector array is reset to the default values. * * The Adobe documentation also states that the values in the * WeightVector array must total 1.0 +/-~0.001. In practice this does diff --git a/src/base/ftmm.c b/src/base/ftmm.c index 1d5e2bcca..c061431a4 100644 --- a/src/base/ftmm.c +++ b/src/base/ftmm.c @@ -185,6 +185,14 @@ error = FT_ERR( Invalid_Argument ); if ( service->set_mm_design ) error = service->set_mm_design( face, num_coords, coords ); + + if ( !error ) + { + if ( num_coords ) + face->face_flags |= FT_FACE_FLAG_VARIATION; + else + face->face_flags &= ~FT_FACE_FLAG_VARIATION; + } } /* enforce recomputation of auto-hinting data */ @@ -220,6 +228,14 @@ error = FT_ERR( Invalid_Argument ); if ( service->set_mm_weightvector ) error = service->set_mm_weightvector( face, len, weightvector ); + + if ( !error ) + { + if ( len ) + face->face_flags |= FT_FACE_FLAG_VARIATION; + else + face->face_flags &= ~FT_FACE_FLAG_VARIATION; + } } /* enforce recomputation of auto-hinting data */ @@ -283,6 +299,14 @@ if ( service_mm->set_var_design ) error = service_mm->set_var_design( face, num_coords, coords ); + if ( !error || error == -1 ) + { + if ( num_coords ) + face->face_flags |= FT_FACE_FLAG_VARIATION; + else + face->face_flags &= ~FT_FACE_FLAG_VARIATION; + } + /* internal error code -1 means `no change'; we can exit immediately */ if ( error == -1 ) return FT_Err_Ok; @@ -359,6 +383,14 @@ if ( service_mm->set_mm_blend ) error = service_mm->set_mm_blend( face, num_coords, coords ); + if ( !error || error == -1 ) + { + if ( num_coords ) + face->face_flags |= FT_FACE_FLAG_VARIATION; + else + face->face_flags &= ~FT_FACE_FLAG_VARIATION; + } + /* internal error code -1 means `no change'; we can exit immediately */ if ( error == -1 ) return FT_Err_Ok; @@ -410,6 +442,14 @@ if ( service_mm->set_mm_blend ) error = service_mm->set_mm_blend( face, num_coords, coords ); + if ( !error || error == -1 ) + { + if ( num_coords ) + face->face_flags |= FT_FACE_FLAG_VARIATION; + else + face->face_flags &= ~FT_FACE_FLAG_VARIATION; + } + /* internal error code -1 means `no change'; we can exit immediately */ if ( error == -1 ) return FT_Err_Ok; diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index 2285c1a48..1f24f3d91 100644 --- a/src/cff/cffobjs.c +++ b/src/cff/cffobjs.c @@ -719,24 +719,15 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT { - FT_Service_MultiMasters - mm = (FT_Service_MultiMasters)face->mm; - FT_Service_MetricsVariations - var = (FT_Service_MetricsVariations)face->face_var; - FT_UInt instance_index = (FT_UInt)face_index >> 16; if ( FT_HAS_MULTIPLE_MASTERS( cffface ) && - mm && instance_index > 0 ) { - error = mm->set_named_instance( cffface, instance_index ); + error = FT_Set_Named_Instance( cffface, instance_index ); 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 d28cc245e..44483625a 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -2985,11 +2985,6 @@ 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; } @@ -3208,11 +3203,6 @@ 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 ); return error; @@ -3382,9 +3372,8 @@ 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; + face->root.face_index = ( instance_index << 16 ) | + ( face->root.face_index & 0xFFFFL ); Exit: return error; diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c index c351e082b..29d41da07 100644 --- a/src/truetype/ttobjs.c +++ b/src/truetype/ttobjs.c @@ -777,7 +777,6 @@ } #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - { FT_UInt instance_index = (FT_UInt)face_index >> 16; @@ -785,14 +784,11 @@ if ( FT_HAS_MULTIPLE_MASTERS( ttface ) && instance_index > 0 ) { - error = TT_Set_Named_Instance( face, instance_index ); + error = FT_Set_Named_Instance( ttface, instance_index ); if ( error ) goto Exit; - - tt_apply_mvar( face ); } } - #endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ /* initialize standard glyph loading routines */ diff --git a/src/type1/t1load.c b/src/type1/t1load.c index 371edf4c1..a3b281009 100644 --- a/src/type1/t1load.c +++ b/src/type1/t1load.c @@ -449,11 +449,6 @@ 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; } @@ -522,11 +517,6 @@ for ( ; i < blend->num_designs; i++ ) blend->weight_vector[i] = (FT_Fixed)0; - - if ( len ) - face->root.face_flags |= FT_FACE_FLAG_VARIATION; - else - face->root.face_flags &= ~FT_FACE_FLAG_VARIATION; } return FT_Err_Ok; @@ -638,11 +628,6 @@ 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; } -- cgit v1.2.3 From 7af8fd0063f773ae3d3eb4866154b88dd4ec6542 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 27 Apr 2023 07:37:14 +0200 Subject: * include/freetype/internal/services/svmm.h: Minor changes. --- include/freetype/internal/services/svmm.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/freetype/internal/services/svmm.h b/include/freetype/internal/services/svmm.h index 80541c4ce..59910f2e3 100644 --- a/include/freetype/internal/services/svmm.h +++ b/include/freetype/internal/services/svmm.h @@ -90,7 +90,7 @@ FT_BEGIN_HEADER FT_MM_Var* *mm_var ); typedef void - (*FT_Done_Blend_Func)( FT_Face ); + (*FT_Done_Blend_Func)( FT_Face face ); typedef FT_Error (*FT_Set_MM_WeightVector_Func)( FT_Face face, @@ -164,8 +164,8 @@ FT_BEGIN_HEADER get_var_design_, \ set_named_instance_, \ get_default_named_instance_, \ - set_weightvector_, \ - get_weightvector_, \ + set_mm_weightvector_, \ + get_mm_weightvector_, \ load_delta_set_idx_map_, \ load_item_var_store_, \ get_item_delta_, \ @@ -184,8 +184,8 @@ FT_BEGIN_HEADER get_var_design_, \ set_named_instance_, \ get_default_named_instance_, \ - set_weightvector_, \ - get_weightvector_, \ + set_mm_weightvector_, \ + get_mm_weightvector_, \ load_delta_set_idx_map_, \ load_item_var_store_, \ get_item_delta_, \ -- cgit v1.2.3 From c8a24209d314c23632deaccd328e107888fab13a Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 27 Apr 2023 11:40:46 +0200 Subject: [truetype] Fix PostScript name handling for variation fonts. A variation font's PostScript name of a named instance is usually different from the PostScript name of an unnamed instance. However, if a change between a named instance and an unnamed instance with exactly the same design axis values happened, it was possible that the PostScript name wasn't correctly updated. This commit reorganizes the code to handle this issue within the top-level API functions, using a new service to trigger recomputation of the PostScript name. * include/freetype/internal/services/svmm.h (FT_Construct_PS_Name_Func): New typedef. (FT_Service_MultiMasters): New field `construct_ps_name`. (FT_DEFINE_SERVICE_MULTIMASTERSREC): Updated. * src/base/ftmm.c (FT_Set_Var_Design_Coordinates, FT_Set_MM_Blend_Coordinates, FT_Set_Var_Blend_Coordinates): Call `mm->construct_ps_name` to handle `postscript_name`. (FT_Set_Named_Instance): Call `mm->construct_ps_name` to handle `postscript_name`. Use shortcut. * src/cff/cffdrivr.c (cff_construct_ps_name): New function. (cff_service_multi_masters): Updated. * src/truetype/ttgxvar.c (tt_set_mm_blend): Don't handle `postscript_name`. (TT_Set_MM_Blend): Simplify. (TT_Set_Named_Instance): Return -1 if axis values haven't changed. Don't set `face_index`. (tt_construct_ps_name): 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. * src/type1/t1load.c (T1_Set_MM_Blend): Simplify. --- include/freetype/internal/services/svmm.h | 8 +++ src/base/ftmm.c | 82 ++++++++++++++++++++++++++++--- src/cff/cffdrivr.c | 14 ++++++ src/truetype/ttdriver.c | 3 ++ src/truetype/ttgxvar.c | 38 ++++++-------- src/truetype/ttgxvar.h | 4 +- src/type1/t1driver.c | 3 ++ src/type1/t1load.c | 9 +--- 8 files changed, 123 insertions(+), 38 deletions(-) diff --git a/include/freetype/internal/services/svmm.h b/include/freetype/internal/services/svmm.h index 59910f2e3..982bb47db 100644 --- a/include/freetype/internal/services/svmm.h +++ b/include/freetype/internal/services/svmm.h @@ -102,6 +102,9 @@ FT_BEGIN_HEADER FT_UInt* len, FT_Fixed* weight_vector ); + typedef void + (*FT_Construct_PS_Name_Func)( FT_Face face ); + typedef FT_Error (*FT_Var_Load_Delta_Set_Idx_Map_Func)( FT_Face face, FT_ULong offset, @@ -144,6 +147,7 @@ FT_BEGIN_HEADER FT_Get_MM_WeightVector_Func get_mm_weightvector; /* for internal use; only needed for code sharing between modules */ + FT_Construct_PS_Name_Func construct_ps_name; FT_Var_Load_Delta_Set_Idx_Map_Func load_delta_set_idx_map; FT_Var_Load_Item_Var_Store_Func load_item_var_store; FT_Var_Get_Item_Delta_Func get_item_delta; @@ -166,6 +170,8 @@ FT_BEGIN_HEADER get_default_named_instance_, \ set_mm_weightvector_, \ get_mm_weightvector_, \ + \ + construct_ps_name_, \ load_delta_set_idx_map_, \ load_item_var_store_, \ get_item_delta_, \ @@ -186,6 +192,8 @@ FT_BEGIN_HEADER get_default_named_instance_, \ set_mm_weightvector_, \ get_mm_weightvector_, \ + \ + construct_ps_name_, \ load_delta_set_idx_map_, \ load_item_var_store_, \ get_item_delta_, \ diff --git a/src/base/ftmm.c b/src/base/ftmm.c index c061431a4..9e2dd7ee7 100644 --- a/src/base/ftmm.c +++ b/src/base/ftmm.c @@ -301,10 +301,26 @@ if ( !error || error == -1 ) { + FT_Bool is_variation_old = FT_IS_VARIATION( face ); + + if ( num_coords ) face->face_flags |= FT_FACE_FLAG_VARIATION; else face->face_flags &= ~FT_FACE_FLAG_VARIATION; + + if ( service_mm->construct_ps_name ) + { + if ( error == -1 ) + { + /* The PS name of a named instance and a non-named instance */ + /* usually differs, even if the axis values are identical. */ + if ( is_variation_old != FT_IS_VARIATION( face ) ) + service_mm->construct_ps_name( face ); + } + else + service_mm->construct_ps_name( face ); + } } /* internal error code -1 means `no change'; we can exit immediately */ @@ -385,10 +401,26 @@ if ( !error || error == -1 ) { + FT_Bool is_variation_old = FT_IS_VARIATION( face ); + + if ( num_coords ) face->face_flags |= FT_FACE_FLAG_VARIATION; else face->face_flags &= ~FT_FACE_FLAG_VARIATION; + + if ( service_mm->construct_ps_name ) + { + if ( error == -1 ) + { + /* The PS name of a named instance and a non-named instance */ + /* usually differs, even if the axis values are identical. */ + if ( is_variation_old != FT_IS_VARIATION( face ) ) + service_mm->construct_ps_name( face ); + } + else + service_mm->construct_ps_name( face ); + } } /* internal error code -1 means `no change'; we can exit immediately */ @@ -444,10 +476,26 @@ if ( !error || error == -1 ) { + FT_Bool is_variation_old = FT_IS_VARIATION( face ); + + if ( num_coords ) face->face_flags |= FT_FACE_FLAG_VARIATION; else face->face_flags &= ~FT_FACE_FLAG_VARIATION; + + if ( service_mm->construct_ps_name ) + { + if ( error == -1 ) + { + /* The PS name of a named instance and a non-named instance */ + /* usually differs, even if the axis values are identical. */ + if ( is_variation_old != FT_IS_VARIATION( face ) ) + service_mm->construct_ps_name( face ); + } + else + service_mm->construct_ps_name( face ); + } } /* internal error code -1 means `no change'; we can exit immediately */ @@ -577,6 +625,33 @@ error = FT_ERR( Invalid_Argument ); if ( service_mm->set_named_instance ) error = service_mm->set_named_instance( face, instance_index ); + + if ( !error || error == -1 ) + { + FT_Bool is_variation_old = FT_IS_VARIATION( face ); + + + face->face_flags &= ~FT_FACE_FLAG_VARIATION; + face->face_index = ( instance_index << 16 ) | + ( face->face_index & 0xFFFFL ); + + if ( service_mm->construct_ps_name ) + { + if ( error == -1 ) + { + /* The PS name of a named instance and a non-named instance */ + /* usually differs, even if the axis values are identical. */ + if ( is_variation_old != FT_IS_VARIATION( face ) ) + service_mm->construct_ps_name( face ); + } + else + service_mm->construct_ps_name( face ); + } + } + + /* internal error code -1 means `no change'; we can exit immediately */ + if ( error == -1 ) + return FT_Err_Ok; } if ( !error ) @@ -594,13 +669,6 @@ 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; } diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index 29f2a2b11..6d96e4abe 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -896,6 +896,16 @@ } + static void + cff_construct_ps_name( CFF_Face face ) + { + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + + + mm->construct_ps_name( FT_FACE( face ) ); + } + + static FT_Error cff_get_mm_var( CFF_Face face, FT_MM_Var* *master ) @@ -1039,6 +1049,10 @@ (FT_Get_MM_WeightVector_Func) cff_get_mm_weightvector, /* get_mm_weightvector */ + + (FT_Construct_PS_Name_Func) + cff_construct_ps_name, + /* construct_ps_name */ (FT_Var_Load_Delta_Set_Idx_Map_Func) cff_load_delta_set_index_mapping, /* load_delta_set_idx_map */ diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c index 54ad932ed..8bde30fbf 100644 --- a/src/truetype/ttdriver.c +++ b/src/truetype/ttdriver.c @@ -533,6 +533,9 @@ NULL, /* set_mm_weightvector */ (FT_Get_MM_WeightVector_Func) NULL, /* get_mm_weightvector */ + + (FT_Construct_PS_Name_Func) + tt_construct_ps_name, /* construct_ps_name */ (FT_Var_Load_Delta_Set_Idx_Map_Func) tt_var_load_delta_set_index_mapping, /* load_delta_set_idx_map */ diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 44483625a..aec43c851 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -2936,9 +2936,6 @@ } } - /* enforce recomputation of the PostScript name; */ - FT_FREE( face->postscript_name ); - Exit: return error; } @@ -2978,14 +2975,7 @@ FT_UInt num_coords, FT_Fixed* coords ) { - FT_Error error; - - - error = tt_set_mm_blend( face, num_coords, coords, 1 ); - if ( error ) - return error; - - return FT_Err_Ok; + return tt_set_mm_blend( face, num_coords, coords, 1 ); } @@ -3305,7 +3295,8 @@ * Value 0 indicates to not use an instance. * * @Return: - * FreeType error code. 0~means success. + * FreeType error code. 0~means success, -1 means success and unchanged + * axis values. */ FT_LOCAL_DEF( FT_Error ) TT_Set_Named_Instance( TT_Face face, @@ -3361,20 +3352,10 @@ error = TT_Set_Var_Design( face, mmvar->num_axis, named_style->coords ); - if ( error ) - { - /* internal error code -1 means `no change' */ - if ( error == -1 ) - error = FT_Err_Ok; - goto Exit; - } } else error = TT_Set_Var_Design( face, 0, NULL ); - face->root.face_index = ( instance_index << 16 ) | - ( face->root.face_index & 0xFFFFL ); - Exit: return error; } @@ -3419,6 +3400,19 @@ } + /* This function triggers (lazy) recomputation of the `postscript_name` */ + /* field in `TT_Face`. */ + + FT_LOCAL_DEF( void ) + tt_construct_ps_name( TT_Face face ) + { + FT_Memory memory = face->root.memory; + + + FT_FREE( face->postscript_name ); + } + + /*************************************************************************/ /*************************************************************************/ /***** *****/ diff --git a/src/truetype/ttgxvar.h b/src/truetype/ttgxvar.h index 0c096f7df..4de772c87 100644 --- a/src/truetype/ttgxvar.h +++ b/src/truetype/ttgxvar.h @@ -378,6 +378,9 @@ FT_BEGIN_HEADER TT_Get_Default_Named_Instance( TT_Face face, FT_UInt *instance_index ); + FT_LOCAL( void ) + tt_construct_ps_name( TT_Face face ); + FT_LOCAL( FT_Error ) tt_face_vary_cvt( TT_Face face, FT_Stream stream ); @@ -401,7 +404,6 @@ FT_BEGIN_HEADER FT_LOCAL( void ) tt_apply_mvar( TT_Face face ); - FT_LOCAL( FT_Error ) tt_var_load_item_variation_store( TT_Face face, FT_ULong offset, diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c index 4239d86fe..4abcef173 100644 --- a/src/type1/t1driver.c +++ b/src/type1/t1driver.c @@ -136,6 +136,9 @@ T1_Set_MM_WeightVector, /* set_mm_weightvector */ (FT_Get_MM_WeightVector_Func) T1_Get_MM_WeightVector, /* get_mm_weightvector */ + + (FT_Construct_PS_Name_Func) + NULL, /* construct_ps_name */ (FT_Var_Load_Delta_Set_Idx_Map_Func) NULL, /* load_delta_set_idx_map */ (FT_Var_Load_Item_Var_Store_Func) diff --git a/src/type1/t1load.c b/src/type1/t1load.c index a3b281009..ee52bf276 100644 --- a/src/type1/t1load.c +++ b/src/type1/t1load.c @@ -442,14 +442,7 @@ FT_UInt num_coords, FT_Fixed* coords ) { - FT_Error error; - - - error = t1_set_mm_blend( face, num_coords, coords ); - if ( error ) - return error; - - return FT_Err_Ok; + return t1_set_mm_blend( face, num_coords, coords ); } -- cgit v1.2.3 From 8fe50c2adca74a4eca1501c831251283b4cc6d9b Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 27 Apr 2023 23:06:51 +0200 Subject: [truetype] Fix style name handling for variation fonts. * include/freetype/internal/tttypes.h (TT_FaceRec): New field `non_var_style_name`. * src/sfnt/sfobjs.c (sfnt_load_face): Initialize `non_var_style_name`. (sfnt_done_face): Free `non_var_style_name`. * src/truetype/ttgxvar.c (TT_Set_Named_Instance): Restore non-VF style name if switching back to non-VF mode. --- include/freetype/internal/tttypes.h | 5 +++++ src/sfnt/sfobjs.c | 11 +++++++++++ src/truetype/ttgxvar.c | 11 +++++++++-- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h index 10af061b9..984121a0e 100644 --- a/include/freetype/internal/tttypes.h +++ b/include/freetype/internal/tttypes.h @@ -1318,6 +1318,9 @@ FT_BEGIN_HEADER * var_default_named_instance :: * The index of the default named instance. * + * non_var_style_name :: + * The non-variation style name, used as a backup. + * * horz_metrics_size :: * The size of the 'hmtx' table. * @@ -1556,6 +1559,8 @@ FT_BEGIN_HEADER FT_UInt var_postscript_prefix_len; /* since 2.7.2 */ FT_UInt var_default_named_instance; /* since 2.13.1 */ + + const char* non_var_style_name; /* since 2.13.1 */ #endif /* since version 2.2 */ diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c index 1574c353d..f5d66ef84 100644 --- a/src/sfnt/sfobjs.c +++ b/src/sfnt/sfobjs.c @@ -1063,6 +1063,16 @@ GET_NAME( FONT_SUBFAMILY, &face->root.style_name ); } +#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT + { + FT_Memory memory = face->root.memory; + + + if ( FT_STRDUP( face->non_var_style_name, face->root.style_name ) ) + goto Exit; + } +#endif + /* now set up root fields */ { FT_Face root = &face->root; @@ -1509,6 +1519,7 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT FT_FREE( face->var_postscript_prefix ); + FT_FREE( face->non_var_style_name ); #endif /* freeing glyph color palette data */ diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index aec43c851..249ef316a 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -3306,6 +3306,8 @@ GX_Blend blend; FT_MM_Var* mmvar; + FT_Memory memory = face->root.memory; + FT_UInt num_instances; @@ -3329,8 +3331,7 @@ if ( instance_index > 0 ) { - FT_Memory memory = face->root.memory; - SFNT_Service sfnt = (SFNT_Service)face->sfnt; + SFNT_Service sfnt = (SFNT_Service)face->sfnt; FT_Var_Named_Style* named_style; FT_String* style_name; @@ -3354,7 +3355,13 @@ named_style->coords ); } else + { + /* restore non-VF style name */ + FT_FREE( face->root.style_name ); + if ( FT_STRDUP( face->root.style_name, face->non_var_style_name ) ) + goto Exit; error = TT_Set_Var_Design( face, 0, NULL ); + } Exit: return error; -- cgit v1.2.3 From c041411917261ba05213c97469f0b530475ae08e Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 6 May 2023 18:57:42 +0200 Subject: * src/cff/*: Clean up interface. Ensure that all driver functions use the signature of the service or driver. This avoids pointer mismatches, which are technically undefined behaviour. Recent compilers are more picky in catching them as part of Control Flow Integrity tests. --- src/cff/cffdrivr.c | 308 ++++++++++++++++++++++++++++------------------------- src/cff/cffload.c | 14 +-- src/cff/cffload.h | 4 +- src/cff/cffobjs.c | 2 +- 4 files changed, 173 insertions(+), 155 deletions(-) diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index 6d96e4abe..3d08f8d5b 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -108,20 +108,20 @@ * They can be implemented by format-specific interfaces. */ FT_CALLBACK_DEF( FT_Error ) - cff_get_kerning( FT_Face ttface, /* TT_Face */ + cff_get_kerning( FT_Face face, /* CFF_Face */ FT_UInt left_glyph, FT_UInt right_glyph, FT_Vector* kerning ) { - TT_Face face = (TT_Face)ttface; - SFNT_Service sfnt = (SFNT_Service)face->sfnt; + CFF_Face cffface = (CFF_Face)face; + SFNT_Service sfnt = (SFNT_Service)cffface->sfnt; kerning->x = 0; kerning->y = 0; if ( sfnt ) - kerning->x = sfnt->get_kerning( face, left_glyph, right_glyph ); + kerning->x = sfnt->get_kerning( cffface, left_glyph, right_glyph ); return FT_Err_Ok; } @@ -158,38 +158,38 @@ * FreeType error code. 0 means success. */ FT_CALLBACK_DEF( FT_Error ) - cff_glyph_load( FT_GlyphSlot cffslot, /* CFF_GlyphSlot */ - FT_Size cffsize, /* CFF_Size */ + cff_glyph_load( FT_GlyphSlot slot, /* CFF_GlyphSlot */ + FT_Size size, /* CFF_Size */ FT_UInt glyph_index, FT_Int32 load_flags ) { FT_Error error; - CFF_GlyphSlot slot = (CFF_GlyphSlot)cffslot; - CFF_Size size = (CFF_Size)cffsize; + CFF_GlyphSlot cffslot = (CFF_GlyphSlot)slot; + CFF_Size cffsize = (CFF_Size)size; - if ( !slot ) + if ( !cffslot ) return FT_THROW( Invalid_Slot_Handle ); FT_TRACE1(( "cff_glyph_load: glyph index %d\n", glyph_index )); /* check whether we want a scaled outline or bitmap */ - if ( !size ) + if ( !cffsize ) load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING; /* reset the size object if necessary */ if ( load_flags & FT_LOAD_NO_SCALE ) size = NULL; - if ( size ) + if ( cffsize ) { /* these two objects must have the same parent */ - if ( cffsize->face != cffslot->face ) + if ( size->face != slot->face ) return FT_THROW( Invalid_Face_Handle ); } /* now load the glyph outline if necessary */ - error = cff_slot_load( slot, size, glyph_index, load_flags ); + error = cff_slot_load( cffslot, cffsize, glyph_index, load_flags ); /* force drop-out mode to 2 - irrelevant now */ /* slot->outline.dropout_mode = 2; */ @@ -216,7 +216,7 @@ /* it is no longer necessary that those values are identical to */ /* the values in the `CFF' table */ - TT_Face ttface = (TT_Face)face; + CFF_Face cffface = (CFF_Face)face; FT_Short dummy; @@ -225,7 +225,7 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT /* no fast retrieval for blended MM fonts without VVAR table */ if ( ( FT_IS_NAMED_INSTANCE( face ) || FT_IS_VARIATION( face ) ) && - !( ttface->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) ) + !( cffface->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) ) return FT_THROW( Unimplemented_Feature ); #endif @@ -233,7 +233,7 @@ /* otherwise we extract the info from the CFF glyphstrings */ /* (instead of synthesizing a global value using the `OS/2' */ /* table) */ - if ( !ttface->vertical_info ) + if ( !cffface->vertical_info ) goto Missing_Table; for ( nn = 0; nn < count; nn++ ) @@ -241,11 +241,11 @@ FT_UShort ah; - ( (SFNT_Service)ttface->sfnt )->get_metrics( ttface, - 1, - start + nn, - &dummy, - &ah ); + ( (SFNT_Service)cffface->sfnt )->get_metrics( cffface, + 1, + start + nn, + &dummy, + &ah ); FT_TRACE5(( " idx %d: advance height %d font unit%s\n", start + nn, @@ -259,12 +259,12 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT /* no fast retrieval for blended MM fonts without HVAR table */ if ( ( FT_IS_NAMED_INSTANCE( face ) || FT_IS_VARIATION( face ) ) && - !( ttface->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) ) + !( cffface->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) ) return FT_THROW( Unimplemented_Feature ); #endif /* check whether we have data from the `hmtx' table at all */ - if ( !ttface->horizontal.number_Of_HMetrics ) + if ( !cffface->horizontal.number_Of_HMetrics ) goto Missing_Table; for ( nn = 0; nn < count; nn++ ) @@ -272,11 +272,11 @@ FT_UShort aw; - ( (SFNT_Service)ttface->sfnt )->get_metrics( ttface, - 0, - start + nn, - &dummy, - &aw ); + ( (SFNT_Service)cffface->sfnt )->get_metrics( cffface, + 0, + start + nn, + &dummy, + &aw ); FT_TRACE5(( " idx %d: advance width %d font unit%s\n", start + nn, @@ -312,13 +312,14 @@ * */ - static FT_Error - cff_get_glyph_name( CFF_Face face, + FT_CALLBACK_DEF( FT_Error ) + cff_get_glyph_name( FT_Face face, /* CFF_Face */ FT_UInt glyph_index, FT_Pointer buffer, FT_UInt buffer_max ) { - CFF_Font font = (CFF_Font)face->extra.data; + CFF_Face cffface = (CFF_Face)face; + CFF_Font font = (CFF_Font)cffface->extra.data; FT_String* gname; FT_UShort sid; FT_Error error; @@ -338,10 +339,7 @@ if ( service && service->get_name ) - return service->get_name( FT_FACE( face ), - glyph_index, - buffer, - buffer_max ); + return service->get_name( face, glyph_index, buffer, buffer_max ); else { FT_ERROR(( "cff_get_glyph_name:" @@ -366,7 +364,7 @@ /* first, locate the sid in the charset table */ sid = font->charset.sids[glyph_index]; - /* now, lookup the name itself */ + /* now, look up the name itself */ gname = cff_index_get_sid_string( font, sid ); if ( gname ) @@ -379,21 +377,19 @@ } - static FT_UInt - cff_get_name_index( CFF_Face face, + FT_CALLBACK_DEF( FT_UInt ) + cff_get_name_index( FT_Face face, /* CFF_Face */ const FT_String* glyph_name ) { - CFF_Font cff; - CFF_Charset charset; + CFF_Face cffface = (CFF_Face)face; + CFF_Font cff = (CFF_Font)cffface->extra.data; + CFF_Charset charset = &cff->charset; FT_Service_PsCMaps psnames; FT_String* name; FT_UShort sid; FT_UInt i; - cff = (CFF_FontRec *)face->extra.data; - charset = &cff->charset; - /* CFF2 table does not have glyph names; */ /* we need to use `post' table method */ if ( cff->version_major == 2 ) @@ -408,7 +404,7 @@ if ( service && service->name_index ) - return service->name_index( FT_FACE( face ), glyph_name ); + return service->name_index( face, glyph_name ); else { FT_ERROR(( "cff_get_name_index:" @@ -456,22 +452,23 @@ * */ - static FT_Int + FT_CALLBACK_DEF( FT_Int ) cff_ps_has_glyph_names( FT_Face face ) { return ( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES ) > 0; } - static FT_Error - cff_ps_get_font_info( CFF_Face face, + FT_CALLBACK_DEF( FT_Error ) + cff_ps_get_font_info( FT_Face face, /* CFF_Face */ PS_FontInfoRec* afont_info ) { - CFF_Font cff = (CFF_Font)face->extra.data; - FT_Error error = FT_Err_Ok; + CFF_Face cffface = (CFF_Face)face; + CFF_Font cff = (CFF_Font)cffface->extra.data; + FT_Error error = FT_Err_Ok; - if ( face->is_cff2 ) + if ( cffface->is_cff2 ) { error = FT_THROW( Invalid_Argument ); goto Fail; @@ -480,7 +477,7 @@ if ( cff && !cff->font_info ) { CFF_FontRecDict dict = &cff->top_font.font_dict; - FT_Memory memory = face->root.memory; + FT_Memory memory = FT_FACE_MEMORY( face ); PS_FontInfoRec* font_info = NULL; @@ -513,18 +510,19 @@ } - static FT_Error - cff_ps_get_font_extra( CFF_Face face, + FT_CALLBACK_DEF( FT_Error ) + cff_ps_get_font_extra( FT_Face face, /* CFF_Face */ PS_FontExtraRec* afont_extra ) { - CFF_Font cff = (CFF_Font)face->extra.data; - FT_Error error = FT_Err_Ok; + CFF_Face cffface = (CFF_Face)face; + CFF_Font cff = (CFF_Font)cffface->extra.data; + FT_Error error = FT_Err_Ok; if ( cff && !cff->font_extra ) { CFF_FontRecDict dict = &cff->top_font.font_dict; - FT_Memory memory = face->root.memory; + FT_Memory memory = FT_FACE_MEMORY( face ); PS_FontExtraRec* font_extra = NULL; FT_String* embedded_postscript; @@ -609,17 +607,18 @@ * */ - static const char* - cff_get_ps_name( CFF_Face face ) + FT_CALLBACK_DEF( const char* ) + cff_get_ps_name( FT_Face face ) /* CFF_Face */ { - CFF_Font cff = (CFF_Font)face->extra.data; - SFNT_Service sfnt = (SFNT_Service)face->sfnt; + CFF_Face cffface = (CFF_Face)face; + CFF_Font cff = (CFF_Font)cffface->extra.data; + SFNT_Service sfnt = (SFNT_Service)cffface->sfnt; /* following the OpenType specification 1.7, we return the name stored */ /* in the `name' table for a CFF wrapped into an SFNT container */ - if ( FT_IS_SFNT( FT_FACE( face ) ) && sfnt ) + if ( FT_IS_SFNT( face ) && sfnt ) { FT_Library library = FT_FACE_LIBRARY( face ); FT_Module sfnt_module = FT_Get_Module( library, "sfnt" ); @@ -631,7 +630,7 @@ if ( service && service->get_ps_font_name ) - return service->get_ps_font_name( FT_FACE( face ) ); + return service->get_ps_font_name( face ); } return cff ? (const char*)cff->font_name : NULL; @@ -655,7 +654,7 @@ * Otherwise call the service function in the sfnt module. * */ - static FT_Error + FT_CALLBACK_DEF( FT_Error ) cff_get_cmap_info( FT_CharMap charmap, TT_CMapInfo *cmap_info ) { @@ -697,14 +696,15 @@ * CID INFO SERVICE * */ - static FT_Error - cff_get_ros( CFF_Face face, + FT_CALLBACK_DEF( FT_Error ) + cff_get_ros( FT_Face face, /* FT_Face */ const char* *registry, const char* *ordering, FT_Int *supplement ) { - FT_Error error = FT_Err_Ok; - CFF_Font cff = (CFF_Font)face->extra.data; + FT_Error error = FT_Err_Ok; + CFF_Face cffface = (CFF_Face)face; + CFF_Font cff = (CFF_Font)cffface->extra.data; if ( cff ) @@ -754,12 +754,13 @@ } - static FT_Error - cff_get_is_cid( CFF_Face face, + FT_CALLBACK_DEF( FT_Error ) + cff_get_is_cid( FT_Face face, /* CFF_Face */ FT_Bool *is_cid ) { - FT_Error error = FT_Err_Ok; - CFF_Font cff = (CFF_Font)face->extra.data; + FT_Error error = FT_Err_Ok; + CFF_Face cffface = (CFF_Face)face; + CFF_Font cff = (CFF_Font)cffface->extra.data; *is_cid = 0; @@ -777,17 +778,16 @@ } - static FT_Error - cff_get_cid_from_glyph_index( CFF_Face face, + FT_CALLBACK_DEF( FT_Error ) + cff_get_cid_from_glyph_index( FT_Face face, /* CFF_Face */ FT_UInt glyph_index, FT_UInt *cid ) { - FT_Error error = FT_Err_Ok; - CFF_Font cff; + FT_Error error = FT_Err_Ok; + CFF_Face cffface = (CFF_Face)face; + CFF_Font cff = (CFF_Font)cffface->extra.data; - cff = (CFF_Font)face->extra.data; - if ( cff ) { FT_UInt c; @@ -848,181 +848,195 @@ * */ - static FT_Error - cff_set_mm_blend( CFF_Face face, + FT_CALLBACK_DEF( FT_Error ) + cff_set_mm_blend( FT_Face face, /* CFF_Face */ FT_UInt num_coords, FT_Fixed* coords ) { - FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + CFF_Face cffface = (CFF_Face)face; + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm; - return mm->set_mm_blend( FT_FACE( face ), num_coords, coords ); + return mm->set_mm_blend( face, num_coords, coords ); } - static FT_Error - cff_get_mm_blend( CFF_Face face, + FT_CALLBACK_DEF( FT_Error ) + cff_get_mm_blend( FT_Face face, /* CFF_Face */ FT_UInt num_coords, FT_Fixed* coords ) { - FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + CFF_Face cffface = (CFF_Face)face; + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm; - return mm->get_mm_blend( FT_FACE( face ), num_coords, coords ); + return mm->get_mm_blend( face, num_coords, coords ); } - static FT_Error - cff_set_mm_weightvector( CFF_Face face, + FT_CALLBACK_DEF( FT_Error ) + cff_set_mm_weightvector( FT_Face face, /* CFF_Face */ FT_UInt len, FT_Fixed* weightvector ) { - FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + CFF_Face cffface = (CFF_Face)face; + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm; - return mm->set_mm_weightvector( FT_FACE( face ), len, weightvector ); + return mm->set_mm_weightvector( face, len, weightvector ); } - static FT_Error - cff_get_mm_weightvector( CFF_Face face, + FT_CALLBACK_DEF( FT_Error ) + cff_get_mm_weightvector( FT_Face face, /* CFF_Face */ FT_UInt* len, FT_Fixed* weightvector ) { - FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + CFF_Face cffface = (CFF_Face)face; + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm; - return mm->get_mm_weightvector( FT_FACE( face ), len, weightvector ); + return mm->get_mm_weightvector( face, len, weightvector ); } - static void - cff_construct_ps_name( CFF_Face face ) + FT_CALLBACK_DEF( void ) + cff_construct_ps_name( FT_Face face ) /* CFF_Face */ { - FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + CFF_Face cffface = (CFF_Face)face; + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm; - mm->construct_ps_name( FT_FACE( face ) ); + mm->construct_ps_name( face ); } - static FT_Error - cff_get_mm_var( CFF_Face face, + FT_CALLBACK_DEF( FT_Error ) + cff_get_mm_var( FT_Face face, /* CFF_Face */ FT_MM_Var* *master ) { - FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + CFF_Face cffface = (CFF_Face)face; + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm; - return mm->get_mm_var( FT_FACE( face ), master ); + return mm->get_mm_var( face, master ); } - static FT_Error - cff_set_var_design( CFF_Face face, + FT_CALLBACK_DEF( FT_Error ) + cff_set_var_design( FT_Face face, /* CFF_Face */ FT_UInt num_coords, FT_Fixed* coords ) { - FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + CFF_Face cffface = (CFF_Face)face; + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm; - return mm->set_var_design( FT_FACE( face ), num_coords, coords ); + return mm->set_var_design( face, num_coords, coords ); } - static FT_Error - cff_get_var_design( CFF_Face face, + FT_CALLBACK_DEF( FT_Error ) + cff_get_var_design( FT_Face face, /* CFF_Face */ FT_UInt num_coords, FT_Fixed* coords ) { - FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + CFF_Face cffface = (CFF_Face)face; + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm; - return mm->get_var_design( FT_FACE( face ), num_coords, coords ); + return mm->get_var_design( face, num_coords, coords ); } - static FT_Error - cff_set_named_instance( CFF_Face face, + FT_CALLBACK_DEF( FT_Error ) + cff_set_named_instance( FT_Face face, /* CFF_Face */ FT_UInt instance_index ) { - FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + CFF_Face cffface = (CFF_Face)face; + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm; - return mm->set_named_instance( FT_FACE( face ), instance_index ); + return mm->set_named_instance( face, instance_index ); } - static FT_Error - cff_get_default_named_instance( CFF_Face face, + FT_CALLBACK_DEF( FT_Error ) + cff_get_default_named_instance( FT_Face face, /* CFF_Face */ FT_UInt *instance_index ) { - FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + CFF_Face cffface = (CFF_Face)face; + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm; - return mm->get_default_named_instance( FT_FACE( face ), instance_index ); + return mm->get_default_named_instance( face, instance_index ); } - static FT_Error - cff_load_item_variation_store( CFF_Face face, + FT_CALLBACK_DEF( FT_Error ) + cff_load_item_variation_store( FT_Face face, /* CFF_Face */ FT_ULong offset, GX_ItemVarStore itemStore ) { - FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + CFF_Face cffface = (CFF_Face)face; + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm; - return mm->load_item_var_store( FT_FACE(face), offset, itemStore ); + return mm->load_item_var_store( face, offset, itemStore ); } - static FT_Error - cff_load_delta_set_index_mapping( CFF_Face face, + FT_CALLBACK_DEF( FT_Error ) + cff_load_delta_set_index_mapping( FT_Face face, /* CFF_Face */ FT_ULong offset, GX_DeltaSetIdxMap map, GX_ItemVarStore itemStore, FT_ULong table_len ) { - FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + CFF_Face cffface = (CFF_Face)face; + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm; - return mm->load_delta_set_idx_map( FT_FACE( face ), offset, map, + return mm->load_delta_set_idx_map( face, offset, map, itemStore, table_len ); } - static FT_Int - cff_get_item_delta( CFF_Face face, + FT_CALLBACK_DEF( FT_Int ) + cff_get_item_delta( FT_Face face, /* CFF_Face */ GX_ItemVarStore itemStore, FT_UInt outerIndex, FT_UInt innerIndex ) { - FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + CFF_Face cffface = (CFF_Face)face; + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm; - return mm->get_item_delta( FT_FACE( face ), itemStore, - outerIndex, innerIndex ); + return mm->get_item_delta( face, itemStore, outerIndex, innerIndex ); } - static void - cff_done_item_variation_store( CFF_Face face, + FT_CALLBACK_DEF( void ) + cff_done_item_variation_store( FT_Face face, /* CFF_Face */ GX_ItemVarStore itemStore ) { - FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + CFF_Face cffface = (CFF_Face)face; + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm; - mm->done_item_var_store( FT_FACE( face ), itemStore ); + mm->done_item_var_store( face, itemStore ); } - static void - cff_done_delta_set_index_map( CFF_Face face, + FT_CALLBACK_DEF( void ) + cff_done_delta_set_index_map( FT_Face face, /* CFF_Face */ GX_DeltaSetIdxMap deltaSetIdxMap ) { - FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + CFF_Face cffface = (CFF_Face)face; + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm; - mm->done_delta_set_idx_map( FT_FACE ( face ), deltaSetIdxMap ); + mm->done_delta_set_idx_map( face, deltaSetIdxMap ); } @@ -1077,27 +1091,29 @@ * */ - static FT_Error - cff_hadvance_adjust( CFF_Face face, + FT_CALLBACK_DEF( FT_Error ) + cff_hadvance_adjust( FT_Face face, /* CFF_Face */ FT_UInt gindex, FT_Int *avalue ) { + CFF_Face cffface = (CFF_Face)face; FT_Service_MetricsVariations - var = (FT_Service_MetricsVariations)face->tt_var; + var = (FT_Service_MetricsVariations)cffface->tt_var; - return var->hadvance_adjust( FT_FACE( face ), gindex, avalue ); + return var->hadvance_adjust( face, gindex, avalue ); } - static void - cff_metrics_adjust( CFF_Face face ) + FT_CALLBACK_DEF( void ) + cff_metrics_adjust( FT_Face face ) /* CFF_Face */ { + CFF_Face cffface = (CFF_Face)face; FT_Service_MetricsVariations - var = (FT_Service_MetricsVariations)face->tt_var; + var = (FT_Service_MetricsVariations)cffface->tt_var; - var->metrics_adjust( FT_FACE( face ) ); + var->metrics_adjust( face ); } diff --git a/src/cff/cffload.c b/src/cff/cffload.c index a090111e3..f96002ec0 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -1589,16 +1589,17 @@ #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT FT_LOCAL_DEF( FT_Error ) - cff_get_var_blend( CFF_Face face, + cff_get_var_blend( FT_Face face, /* CFF_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; + CFF_Face cffface = (CFF_Face)face; + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm; - return mm->get_var_blend( FT_FACE( face ), + return mm->get_var_blend( face, num_coords, coords, normalizedcoords, @@ -1607,13 +1608,14 @@ FT_LOCAL_DEF( void ) - cff_done_blend( CFF_Face face ) + cff_done_blend( FT_Face face ) /* CFF_Face */ { - FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm; + CFF_Face cffface = (CFF_Face)face; + FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm; if ( mm ) - mm->done_blend( FT_FACE( face ) ); + mm->done_blend( face ); } #endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ diff --git a/src/cff/cffload.h b/src/cff/cffload.h index 5a41cdebc..b5286b0c8 100644 --- a/src/cff/cffload.h +++ b/src/cff/cffload.h @@ -105,14 +105,14 @@ FT_BEGIN_HEADER #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT FT_LOCAL( FT_Error ) - cff_get_var_blend( CFF_Face face, + cff_get_var_blend( FT_Face face, FT_UInt *num_coords, FT_Fixed* *coords, FT_Fixed* *normalizedcoords, FT_MM_Var* *mm_var ); FT_LOCAL( void ) - cff_done_blend( CFF_Face face ); + cff_done_blend( FT_Face face ); #endif diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index 1f24f3d91..6d08620c4 100644 --- a/src/cff/cffobjs.c +++ b/src/cff/cffobjs.c @@ -1150,7 +1150,7 @@ } #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - cff_done_blend( face ); + cff_done_blend( cffface ); face->blend = NULL; #endif } -- cgit v1.2.3 From bc7466ad45ea014f4b2ceb4a913f140b762a55c7 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 6 May 2023 19:15:01 +0200 Subject: * src/bdf/bdfdrivr.c: Clean up interface. Ensure that all driver functions use the signature of the service or driver. This avoids pointer mismatches, which are technically undefined behaviour. Recent compilers are more picky in catching them as part of Control Flow Integrity tests. --- src/bdf/bdfdrivr.c | 116 +++++++++++++++++++++++++++-------------------------- 1 file changed, 60 insertions(+), 56 deletions(-) diff --git a/src/bdf/bdfdrivr.c b/src/bdf/bdfdrivr.c index d7e8e0efc..e02a16093 100644 --- a/src/bdf/bdfdrivr.c +++ b/src/bdf/bdfdrivr.c @@ -311,9 +311,9 @@ THE SOFTWARE. FT_CALLBACK_DEF( void ) - BDF_Face_Done( FT_Face bdfface ) /* BDF_Face */ + BDF_Face_Done( FT_Face face ) /* BDF_Face */ { - BDF_Face face = (BDF_Face)bdfface; + BDF_Face bdfface = (BDF_Face)face; FT_Memory memory; @@ -322,31 +322,31 @@ THE SOFTWARE. memory = FT_FACE_MEMORY( face ); - bdf_free_font( face->bdffont ); + bdf_free_font( bdfface->bdffont ); - FT_FREE( face->en_table ); + FT_FREE( bdfface->en_table ); - FT_FREE( face->charset_encoding ); - FT_FREE( face->charset_registry ); - FT_FREE( bdfface->family_name ); - FT_FREE( bdfface->style_name ); + FT_FREE( bdfface->charset_encoding ); + FT_FREE( bdfface->charset_registry ); + FT_FREE( face->family_name ); + FT_FREE( face->style_name ); - FT_FREE( bdfface->available_sizes ); + FT_FREE( face->available_sizes ); - FT_FREE( face->bdffont ); + FT_FREE( bdfface->bdffont ); } FT_CALLBACK_DEF( FT_Error ) BDF_Face_Init( FT_Stream stream, - FT_Face bdfface, /* BDF_Face */ + FT_Face face, /* BDF_Face */ FT_Int face_index, FT_Int num_params, FT_Parameter* params ) { - FT_Error error = FT_Err_Ok; - BDF_Face face = (BDF_Face)bdfface; - FT_Memory memory = FT_FACE_MEMORY( face ); + FT_Error error = FT_Err_Ok; + BDF_Face bdfface = (BDF_Face)face; + FT_Memory memory = FT_FACE_MEMORY( face ); bdf_font_t* font = NULL; bdf_options_t options; @@ -375,7 +375,7 @@ THE SOFTWARE. goto Exit; /* we have a bdf font: let's construct the face object */ - face->bdffont = font; + bdfface->bdffont = font; /* BDF cannot have multiple faces in a single font file. * XXX: non-zero face_index is already invalid argument, but @@ -386,7 +386,7 @@ THE SOFTWARE. if ( face_index > 0 && ( face_index & 0xFFFF ) > 0 ) { FT_ERROR(( "BDF_Face_Init: invalid face index\n" )); - BDF_Face_Done( bdfface ); + BDF_Face_Done( face ); return FT_THROW( Invalid_Argument ); } @@ -401,18 +401,18 @@ THE SOFTWARE. font->unencoded_size, font->unencoded_used )); - bdfface->num_faces = 1; - bdfface->face_index = 0; + face->num_faces = 1; + face->face_index = 0; - bdfface->face_flags |= FT_FACE_FLAG_FIXED_SIZES | - FT_FACE_FLAG_HORIZONTAL; + face->face_flags |= FT_FACE_FLAG_FIXED_SIZES | + FT_FACE_FLAG_HORIZONTAL; prop = bdf_get_font_property( font, "SPACING" ); if ( prop && prop->format == BDF_ATOM && prop->value.atom && ( *(prop->value.atom) == 'M' || *(prop->value.atom) == 'm' || *(prop->value.atom) == 'C' || *(prop->value.atom) == 'c' ) ) - bdfface->face_flags |= FT_FACE_FLAG_FIXED_WIDTH; + face->face_flags |= FT_FACE_FLAG_FIXED_WIDTH; /* FZ XXX: TO DO: FT_FACE_FLAGS_VERTICAL */ /* FZ XXX: I need a font to implement this */ @@ -420,26 +420,27 @@ THE SOFTWARE. prop = bdf_get_font_property( font, "FAMILY_NAME" ); if ( prop && prop->value.atom ) { - if ( FT_STRDUP( bdfface->family_name, prop->value.atom ) ) + if ( FT_STRDUP( face->family_name, prop->value.atom ) ) goto Exit; } else - bdfface->family_name = NULL; + face->family_name = NULL; - if ( FT_SET_ERROR( bdf_interpret_style( face ) ) ) + if ( FT_SET_ERROR( bdf_interpret_style( bdfface ) ) ) goto Exit; /* the number of glyphs (with one slot for the undefined glyph */ /* at position 0 and all unencoded glyphs) */ - bdfface->num_glyphs = (FT_Long)( font->glyphs_size + 1 ); + face->num_glyphs = (FT_Long)( font->glyphs_size + 1 ); - bdfface->num_fixed_sizes = 1; - if ( FT_NEW( bdfface->available_sizes ) ) + face->num_fixed_sizes = 1; + if ( FT_NEW( face->available_sizes ) ) goto Exit; { - FT_Bitmap_Size* bsize = bdfface->available_sizes; - FT_Short resolution_x = 0, resolution_y = 0; + FT_Bitmap_Size* bsize = face->available_sizes; + FT_Short resolution_x = 0; + FT_Short resolution_y = 0; long value; @@ -598,20 +599,20 @@ THE SOFTWARE. unsigned long n; - if ( FT_QNEW_ARRAY( face->en_table, font->glyphs_size ) ) + if ( FT_QNEW_ARRAY( bdfface->en_table, font->glyphs_size ) ) goto Exit; - face->default_glyph = 0; + bdfface->default_glyph = 0; for ( n = 0; n < font->glyphs_size; n++ ) { - (face->en_table[n]).enc = cur[n].encoding; + (bdfface->en_table[n]).enc = cur[n].encoding; FT_TRACE4(( " idx %ld, val 0x%lX\n", n, cur[n].encoding )); - (face->en_table[n]).glyph = (FT_UShort)n; + (bdfface->en_table[n]).glyph = (FT_UShort)n; if ( cur[n].encoding == font->default_char ) { if ( n < FT_UINT_MAX ) - face->default_glyph = (FT_UInt)n; + bdfface->default_glyph = (FT_UInt)n; else FT_TRACE1(( "BDF_Face_Init:" " idx %ld is too large for this system\n", n )); @@ -639,27 +640,27 @@ THE SOFTWARE. const char* s; - if ( FT_STRDUP( face->charset_encoding, + if ( FT_STRDUP( bdfface->charset_encoding, charset_encoding->value.atom ) || - FT_STRDUP( face->charset_registry, + FT_STRDUP( bdfface->charset_registry, charset_registry->value.atom ) ) goto Exit; /* Uh, oh, compare first letters manually to avoid dependency */ /* on locales. */ - s = face->charset_registry; + s = bdfface->charset_registry; if ( ( s[0] == 'i' || s[0] == 'I' ) && ( s[1] == 's' || s[1] == 'S' ) && ( s[2] == 'o' || s[2] == 'O' ) ) { s += 3; - if ( !ft_strcmp( s, "10646" ) || - ( !ft_strcmp( s, "8859" ) && - !ft_strcmp( face->charset_encoding, "1" ) ) ) + if ( !ft_strcmp( s, "10646" ) || + ( !ft_strcmp( s, "8859" ) && + !ft_strcmp( bdfface->charset_encoding, "1" ) ) ) unicode_charmap = 1; /* another name for ASCII */ - else if ( !ft_strcmp( s, "646.1991" ) && - !ft_strcmp( face->charset_encoding, "IRV" ) ) + else if ( !ft_strcmp( s, "646.1991" ) && + !ft_strcmp( bdfface->charset_encoding, "IRV" ) ) unicode_charmap = 1; } @@ -667,7 +668,7 @@ THE SOFTWARE. FT_CharMapRec charmap; - charmap.face = FT_FACE( face ); + charmap.face = face; charmap.encoding = FT_ENCODING_NONE; /* initial platform/encoding should indicate unset status? */ charmap.platform_id = TT_PLATFORM_APPLE_UNICODE; @@ -693,7 +694,7 @@ THE SOFTWARE. FT_CharMapRec charmap; - charmap.face = FT_FACE( face ); + charmap.face = face; charmap.encoding = FT_ENCODING_ADOBE_STANDARD; charmap.platform_id = TT_PLATFORM_ADOBE; charmap.encoding_id = TT_ADOBE_ID_STANDARD; @@ -701,8 +702,8 @@ THE SOFTWARE. error = FT_CMap_New( &bdf_cmap_class, NULL, &charmap, NULL ); /* Select default charmap */ - if ( bdfface->num_charmaps ) - bdfface->charmap = bdfface->charmaps[0]; + if ( face->num_charmaps ) + face->charmap = face->charmaps[0]; } } } @@ -711,7 +712,7 @@ THE SOFTWARE. return error; Fail: - BDF_Face_Done( bdfface ); + BDF_Face_Done( face ); return FT_THROW( Unknown_File_Format ); } @@ -868,17 +869,18 @@ THE SOFTWARE. * */ - static FT_Error - bdf_get_bdf_property( BDF_Face face, + FT_CALLBACK_DEF( FT_Error ) + bdf_get_bdf_property( FT_Face face, /* BDF_Face */ const char* prop_name, BDF_PropertyRec *aproperty ) { + BDF_Face bdfface = (BDF_Face)face; bdf_property_t* prop; - FT_ASSERT( face && face->bdffont ); + FT_ASSERT( bdfface && bdfface->bdffont ); - prop = bdf_get_font_property( face->bdffont, prop_name ); + prop = bdf_get_font_property( bdfface->bdffont, prop_name ); if ( prop ) { switch ( prop->format ) @@ -921,13 +923,16 @@ THE SOFTWARE. } - static FT_Error - bdf_get_charset_id( BDF_Face face, + FT_CALLBACK_DEF( FT_Error ) + bdf_get_charset_id( FT_Face face, /* BDF_Face */ const char* *acharset_encoding, const char* *acharset_registry ) { - *acharset_encoding = face->charset_encoding; - *acharset_registry = face->charset_registry; + BDF_Face bdfface = (BDF_Face)face; + + + *acharset_encoding = bdfface->charset_encoding; + *acharset_registry = bdfface->charset_registry; return 0; } @@ -964,7 +969,6 @@ THE SOFTWARE. } - FT_CALLBACK_TABLE_DEF const FT_Driver_ClassRec bdf_driver_class = { -- cgit v1.2.3 From b9ce8e33a76104390956cb0517aa81689830f81c Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 6 May 2023 19:23:45 +0200 Subject: * src/cid/cidriver.c: Clean up interface. Ensure that all driver functions use the signature of the service or driver. This avoids pointer mismatches, which are technically undefined behaviour. Recent compilers are more picky in catching them as part of Control Flow Integrity tests. --- src/cid/cidriver.c | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/src/cid/cidriver.c b/src/cid/cidriver.c index 9669eb73e..fd015ef2e 100644 --- a/src/cid/cidriver.c +++ b/src/cid/cidriver.c @@ -48,10 +48,11 @@ * */ - static const char* - cid_get_postscript_name( CID_Face face ) + FT_CALLBACK_DEF( const char* ) + cid_get_postscript_name( FT_Face face ) /* CID_Face */ { - const char* result = face->cid.cid_font_name; + CID_Face cidface = (CID_Face)face; + const char* result = cidface->cid.cid_font_name; if ( result && result[0] == '/' ) @@ -72,24 +73,26 @@ * */ - static FT_Error - cid_ps_get_font_info( FT_Face face, + FT_CALLBACK_DEF( FT_Error ) + cid_ps_get_font_info( FT_Face face, /* CID_Face */ PS_FontInfoRec* afont_info ) { - *afont_info = ((CID_Face)face)->cid.font_info; + *afont_info = ( (CID_Face)face )->cid.font_info; return FT_Err_Ok; } - static FT_Error - cid_ps_get_font_extra( FT_Face face, - PS_FontExtraRec* afont_extra ) + + FT_CALLBACK_DEF( FT_Error ) + cid_ps_get_font_extra( FT_Face face, /* CID_Face */ + PS_FontExtraRec* afont_extra ) { - *afont_extra = ((CID_Face)face)->font_extra; + *afont_extra = ( (CID_Face)face )->font_extra; return FT_Err_Ok; } + static const FT_Service_PsInfoRec cid_service_ps_info = { (PS_GetFontInfoFunc) cid_ps_get_font_info, /* ps_get_font_info */ @@ -107,13 +110,14 @@ * CID INFO SERVICE * */ - static FT_Error - cid_get_ros( CID_Face face, + FT_CALLBACK_DEF( FT_Error ) + cid_get_ros( FT_Face face, /* CID_Face */ const char* *registry, const char* *ordering, FT_Int *supplement ) { - CID_FaceInfo cid = &face->cid; + CID_Face cidface = (CID_Face)face; + CID_FaceInfo cid = &cidface->cid; if ( registry ) @@ -129,8 +133,8 @@ } - static FT_Error - cid_get_is_cid( CID_Face face, + FT_CALLBACK_DEF( FT_Error ) + cid_get_is_cid( FT_Face face, /* CID_Face */ FT_Bool *is_cid ) { FT_Error error = FT_Err_Ok; @@ -144,12 +148,13 @@ } - static FT_Error - cid_get_cid_from_glyph_index( CID_Face face, + FT_CALLBACK_DEF( FT_Error ) + cid_get_cid_from_glyph_index( FT_Face face, /* CID_Face */ FT_UInt glyph_index, FT_UInt *cid ) { - FT_Error error = FT_Err_Ok; + FT_Error error = FT_Err_Ok; + CID_Face cidface = (CID_Face)face; /* @@ -158,7 +163,7 @@ * array or dictionary. Fonts loaded by the incremental loading feature * are thus not handled here. */ - error = cid_compute_fd_and_offsets( face, glyph_index, + error = cid_compute_fd_and_offsets( cidface, glyph_index, NULL, NULL, NULL ); if ( error ) *cid = 0; @@ -218,7 +223,6 @@ } - FT_CALLBACK_TABLE_DEF const FT_Driver_ClassRec t1cid_driver_class = { -- cgit v1.2.3 From 0685b0ad36c65266d9d2246b2487dca838044e50 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 6 May 2023 20:01:47 +0200 Subject: * src/pcf/pcfdrivr.c: Clean up interface. Ensure that all driver functions use the signature of the service or driver. This avoids pointer mismatches, which are technically undefined behaviour. Recent compilers are more picky in catching them as part of Control Flow Integrity tests. --- src/pcf/pcfdrivr.c | 120 +++++++++++++++++++++++++++-------------------------- 1 file changed, 62 insertions(+), 58 deletions(-) diff --git a/src/pcf/pcfdrivr.c b/src/pcf/pcfdrivr.c index bfa6eacca..ad481b3b1 100644 --- a/src/pcf/pcfdrivr.c +++ b/src/pcf/pcfdrivr.c @@ -75,36 +75,36 @@ THE SOFTWARE. FT_CALLBACK_DEF( FT_Error ) - pcf_cmap_init( FT_CMap pcfcmap, /* PCF_CMap */ + pcf_cmap_init( FT_CMap cmap, /* PCF_CMap */ FT_Pointer init_data ) { - PCF_CMap cmap = (PCF_CMap)pcfcmap; - PCF_Face face = (PCF_Face)FT_CMAP_FACE( pcfcmap ); + PCF_CMap pcfcmap = (PCF_CMap)cmap; + PCF_Face face = (PCF_Face)FT_CMAP_FACE( cmap ); FT_UNUSED( init_data ); - cmap->enc = &face->enc; + pcfcmap->enc = &face->enc; return FT_Err_Ok; } FT_CALLBACK_DEF( void ) - pcf_cmap_done( FT_CMap pcfcmap ) /* PCF_CMap */ + pcf_cmap_done( FT_CMap cmap ) /* PCF_CMap */ { - PCF_CMap cmap = (PCF_CMap)pcfcmap; + PCF_CMap pcfcmap = (PCF_CMap)cmap; - cmap->enc = NULL; + pcfcmap->enc = NULL; } FT_CALLBACK_DEF( FT_UInt ) - pcf_cmap_char_index( FT_CMap pcfcmap, /* PCF_CMap */ + pcf_cmap_char_index( FT_CMap cmap, /* PCF_CMap */ FT_UInt32 charcode ) { - PCF_Enc enc = ( (PCF_CMap)pcfcmap )->enc; + PCF_Enc enc = ( (PCF_CMap)cmap )->enc; FT_UInt32 i = ( charcode >> 8 ) - enc->firstRow; FT_UInt32 j = ( charcode & 0xFF ) - enc->firstCol; @@ -121,10 +121,10 @@ THE SOFTWARE. FT_CALLBACK_DEF( FT_UInt ) - pcf_cmap_char_next( FT_CMap pcfcmap, /* PCF_CMap */ + pcf_cmap_char_next( FT_CMap cmap, /* PCF_CMap */ FT_UInt32 *acharcode ) { - PCF_Enc enc = ( (PCF_CMap)pcfcmap )->enc; + PCF_Enc enc = ( (PCF_CMap)cmap )->enc; FT_UInt32 charcode = *acharcode + 1; FT_UInt32 i = ( charcode >> 8 ) - enc->firstRow; @@ -170,9 +170,9 @@ THE SOFTWARE. FT_CALLBACK_DEF( void ) - PCF_Face_Done( FT_Face pcfface ) /* PCF_Face */ + PCF_Face_Done( FT_Face face ) /* PCF_Face */ { - PCF_Face face = (PCF_Face)pcfface; + PCF_Face pcfface = (PCF_Face)face; FT_Memory memory; @@ -181,18 +181,18 @@ THE SOFTWARE. memory = FT_FACE_MEMORY( face ); - FT_FREE( face->metrics ); - FT_FREE( face->enc.offset ); + FT_FREE( pcfface->metrics ); + FT_FREE( pcfface->enc.offset ); /* free properties */ - if ( face->properties ) + if ( pcfface->properties ) { FT_Int i; - for ( i = 0; i < face->nprops; i++ ) + for ( i = 0; i < pcfface->nprops; i++ ) { - PCF_Property prop = &face->properties[i]; + PCF_Property prop = &pcfface->properties[i]; if ( prop ) @@ -203,33 +203,33 @@ THE SOFTWARE. } } - FT_FREE( face->properties ); + FT_FREE( pcfface->properties ); } - FT_FREE( face->toc.tables ); - FT_FREE( pcfface->family_name ); - FT_FREE( pcfface->style_name ); - FT_FREE( pcfface->available_sizes ); - FT_FREE( face->charset_encoding ); - FT_FREE( face->charset_registry ); + FT_FREE( pcfface->toc.tables ); + FT_FREE( face->family_name ); + FT_FREE( face->style_name ); + FT_FREE( face->available_sizes ); + FT_FREE( pcfface->charset_encoding ); + FT_FREE( pcfface->charset_registry ); /* close compressed stream if any */ - if ( pcfface->stream == &face->comp_stream ) + if ( face->stream == &pcfface->comp_stream ) { - FT_Stream_Close( &face->comp_stream ); - pcfface->stream = face->comp_source; + FT_Stream_Close( &pcfface->comp_stream ); + face->stream = pcfface->comp_source; } } FT_CALLBACK_DEF( FT_Error ) PCF_Face_Init( FT_Stream stream, - FT_Face pcfface, /* PCF_Face */ + FT_Face face, /* PCF_Face */ FT_Int face_index, FT_Int num_params, FT_Parameter* params ) { - PCF_Face face = (PCF_Face)pcfface; + PCF_Face pcfface = (PCF_Face)face; FT_Error error; FT_UNUSED( num_params ); @@ -238,10 +238,10 @@ THE SOFTWARE. FT_TRACE2(( "PCF driver\n" )); - error = pcf_load_font( stream, face, face_index ); + error = pcf_load_font( stream, pcfface, face_index ); if ( error ) { - PCF_Face_Done( pcfface ); + PCF_Face_Done( face ); #if defined( FT_CONFIG_OPTION_USE_ZLIB ) || \ defined( FT_CONFIG_OPTION_USE_LZW ) || \ @@ -254,7 +254,7 @@ THE SOFTWARE. /* this didn't work, try gzip support! */ FT_TRACE2(( " ... try gzip stream\n" )); - error2 = FT_Stream_OpenGzip( &face->comp_stream, stream ); + error2 = FT_Stream_OpenGzip( &pcfface->comp_stream, stream ); if ( FT_ERR_EQ( error2, Unimplemented_Feature ) ) goto Fail; @@ -270,7 +270,7 @@ THE SOFTWARE. /* this didn't work, try LZW support! */ FT_TRACE2(( " ... try LZW stream\n" )); - error3 = FT_Stream_OpenLZW( &face->comp_stream, stream ); + error3 = FT_Stream_OpenLZW( &pcfface->comp_stream, stream ); if ( FT_ERR_EQ( error3, Unimplemented_Feature ) ) goto Fail; @@ -286,7 +286,7 @@ THE SOFTWARE. /* this didn't work, try Bzip2 support! */ FT_TRACE2(( " ... try Bzip2 stream\n" )); - error4 = FT_Stream_OpenBzip2( &face->comp_stream, stream ); + error4 = FT_Stream_OpenBzip2( &pcfface->comp_stream, stream ); if ( FT_ERR_EQ( error4, Unimplemented_Feature ) ) goto Fail; @@ -297,12 +297,12 @@ THE SOFTWARE. if ( error ) goto Fail; - face->comp_source = stream; - pcfface->stream = &face->comp_stream; + pcfface->comp_source = stream; + face->stream = &pcfface->comp_stream; - stream = pcfface->stream; + stream = face->stream; - error = pcf_load_font( stream, face, face_index ); + error = pcf_load_font( stream, pcfface, face_index ); if ( error ) goto Fail; @@ -326,14 +326,14 @@ THE SOFTWARE. else if ( face_index > 0 && ( face_index & 0xFFFF ) > 0 ) { FT_ERROR(( "PCF_Face_Init: invalid face index\n" )); - PCF_Face_Done( pcfface ); + PCF_Face_Done( face ); return FT_THROW( Invalid_Argument ); } /* set up charmap */ { - FT_String *charset_registry = face->charset_registry; - FT_String *charset_encoding = face->charset_encoding; + FT_String *charset_registry = pcfface->charset_registry; + FT_String *charset_encoding = pcfface->charset_encoding; FT_Bool unicode_charmap = 0; @@ -349,13 +349,13 @@ THE SOFTWARE. ( s[2] == 'o' || s[2] == 'O' ) ) { s += 3; - if ( !ft_strcmp( s, "10646" ) || - ( !ft_strcmp( s, "8859" ) && - !ft_strcmp( face->charset_encoding, "1" ) ) ) + if ( !ft_strcmp( s, "10646" ) || + ( !ft_strcmp( s, "8859" ) && + !ft_strcmp( pcfface->charset_encoding, "1" ) ) ) unicode_charmap = 1; /* another name for ASCII */ - else if ( !ft_strcmp( s, "646.1991" ) && - !ft_strcmp( face->charset_encoding, "IRV" ) ) + else if ( !ft_strcmp( s, "646.1991" ) && + !ft_strcmp( pcfface->charset_encoding, "IRV" ) ) unicode_charmap = 1; } } @@ -364,7 +364,7 @@ THE SOFTWARE. FT_CharMapRec charmap; - charmap.face = FT_FACE( face ); + charmap.face = face; charmap.encoding = FT_ENCODING_NONE; /* initial platform/encoding should indicate unset status? */ charmap.platform_id = TT_PLATFORM_APPLE_UNICODE; @@ -386,7 +386,7 @@ THE SOFTWARE. Fail: FT_TRACE2(( " not a PCF file\n" )); - PCF_Face_Done( pcfface ); + PCF_Face_Done( face ); error = FT_THROW( Unknown_File_Format ); /* error */ goto Exit; } @@ -569,15 +569,16 @@ THE SOFTWARE. * */ - static FT_Error - pcf_get_bdf_property( PCF_Face face, + FT_CALLBACK_DEF( FT_Error ) + pcf_get_bdf_property( FT_Face face, /* PCF_Face */ const char* prop_name, BDF_PropertyRec *aproperty ) { + PCF_Face pcfface = (PCF_Face)face; PCF_Property prop; - prop = pcf_find_property( face, prop_name ); + prop = pcf_find_property( pcfface, prop_name ); if ( prop ) { if ( prop->isString ) @@ -611,13 +612,16 @@ THE SOFTWARE. } - static FT_Error - pcf_get_charset_id( PCF_Face face, + FT_CALLBACK_DEF( FT_Error ) + pcf_get_charset_id( FT_Face face, /* PCF_Face */ const char* *acharset_encoding, const char* *acharset_registry ) { - *acharset_encoding = face->charset_encoding; - *acharset_registry = face->charset_registry; + PCF_Face pcfface = (PCF_Face)face; + + + *acharset_encoding = pcfface->charset_encoding; + *acharset_registry = pcfface->charset_registry; return FT_Err_Ok; } @@ -634,7 +638,7 @@ THE SOFTWARE. * PROPERTY SERVICE * */ - static FT_Error + FT_CALLBACK_DEF( FT_Error ) pcf_property_set( FT_Module module, /* PCF_Driver */ const char* property_name, const void* value, @@ -695,7 +699,7 @@ THE SOFTWARE. } - static FT_Error + FT_CALLBACK_DEF( FT_Error ) pcf_property_get( FT_Module module, /* PCF_Driver */ const char* property_name, const void* value ) -- cgit v1.2.3 From 4360e20e31d7ad26bbb7389930a94d57e9bb6372 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 6 May 2023 20:05:42 +0200 Subject: * src/pfr/pfrdrivr.c: face -> pfrface, pfrface -> face. --- src/pfr/pfrdrivr.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/pfr/pfrdrivr.c b/src/pfr/pfrdrivr.c index 78c6c6882..0048f5241 100644 --- a/src/pfr/pfrdrivr.c +++ b/src/pfr/pfrdrivr.c @@ -27,16 +27,16 @@ FT_CALLBACK_DEF( FT_Error ) - pfr_get_kerning( FT_Face pfrface, /* PFR_Face */ + pfr_get_kerning( FT_Face face, /* PFR_Face */ FT_UInt left, FT_UInt right, FT_Vector *avector ) { - PFR_Face face = (PFR_Face)pfrface; - PFR_PhyFont phys = &face->phy_font; + PFR_Face pfrface = (PFR_Face)face; + PFR_PhyFont phys = &pfrface->phy_font; - (void)pfr_face_get_kerning( pfrface, left, right, avector ); + (void)pfr_face_get_kerning( face, left, right, avector ); /* convert from metrics to outline units when necessary */ if ( phys->outline_resolution != phys->metrics_resolution ) @@ -62,12 +62,12 @@ */ FT_CALLBACK_DEF( FT_Error ) - pfr_get_advance( FT_Face pfrface, /* PFR_Face */ + pfr_get_advance( FT_Face face, /* PFR_Face */ FT_UInt gindex, FT_Pos *anadvance ) { - PFR_Face face = (PFR_Face)pfrface; - FT_Error error = FT_ERR( Invalid_Argument ); + PFR_Face pfrface = (PFR_Face)face; + FT_Error error = FT_ERR( Invalid_Argument ); *anadvance = 0; @@ -77,9 +77,9 @@ gindex--; - if ( face ) + if ( pfrface ) { - PFR_PhyFont phys = &face->phy_font; + PFR_PhyFont phys = &pfrface->phy_font; if ( gindex < phys->num_chars ) @@ -95,16 +95,16 @@ FT_CALLBACK_DEF( FT_Error ) - pfr_get_metrics( FT_Face pfrface, /* PFR_Face */ + pfr_get_metrics( FT_Face face, /* PFR_Face */ FT_UInt *anoutline_resolution, FT_UInt *ametrics_resolution, FT_Fixed *ametrics_x_scale, FT_Fixed *ametrics_y_scale ) { - PFR_Face face = (PFR_Face)pfrface; - PFR_PhyFont phys = &face->phy_font; + PFR_Face pfrface = (PFR_Face)face; + PFR_PhyFont phys = &pfrface->phy_font; FT_Fixed x_scale, y_scale; - FT_Size size = face->root.size; + FT_Size size = pfrface->root.size; if ( anoutline_resolution ) -- cgit v1.2.3 From ceba488cf8366a71db4aac9b2c623746b086e62b Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 6 May 2023 20:14:27 +0200 Subject: * src/psnames/psmodule.c: Use `FT_CALLBACK_DEF`. --- src/psnames/psmodule.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/psnames/psmodule.c b/src/psnames/psmodule.c index d8a2cc764..5a9e1eab8 100644 --- a/src/psnames/psmodule.c +++ b/src/psnames/psmodule.c @@ -57,7 +57,7 @@ /* the name, as in `A.swash' or `e.final'; in this case, the */ /* VARIANT_BIT is set in the return value. */ /* */ - static FT_UInt32 + FT_CALLBACK_DEF( FT_UInt32 ) ps_unicode_value( const char* glyph_name ) { /* If the name begins with `uni', then the glyph name may be a */ @@ -309,7 +309,7 @@ /* Build a table that maps Unicode values to glyph indices. */ - static FT_Error + FT_CALLBACK_DEF( FT_Error ) ps_unicodes_init( FT_Memory memory, PS_Unicodes table, FT_UInt num_glyphs, @@ -408,7 +408,7 @@ } - static FT_UInt + FT_CALLBACK_DEF( FT_UInt ) ps_unicodes_char_index( PS_Unicodes table, FT_UInt32 unicode ) { @@ -453,7 +453,7 @@ } - static FT_UInt + FT_CALLBACK_DEF( FT_UInt ) ps_unicodes_char_next( PS_Unicodes table, FT_UInt32 *unicode ) { @@ -518,7 +518,7 @@ #endif /* FT_CONFIG_OPTION_ADOBE_GLYPH_LIST */ - static const char* + FT_CALLBACK_DEF( const char* ) ps_get_macintosh_name( FT_UInt name_index ) { if ( name_index >= FT_NUM_MAC_NAMES ) @@ -528,7 +528,7 @@ } - static const char* + FT_CALLBACK_DEF( const char* ) ps_get_standard_strings( FT_UInt sid ) { if ( sid >= FT_NUM_SID_NAMES ) -- cgit v1.2.3 From e245951c43c9d69cd6e508190bf00f29f47ccbc6 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 6 May 2023 23:59:25 +0200 Subject: * src/sfnt/sfdriver.c, src/sfnt/ttbdf.c: Clean up interface. Ensure that all driver functions use the signature of the service or driver. This avoids pointer mismatches, which are technically undefined behaviour. Recent compilers are more picky in catching them as part of Control Flow Integrity tests. * src/sfnt/sfdriver.c (sfnt_load_table): New wrapper function. (sfnt_service_sfnt_table): Use it. --- src/sfnt/sfdriver.c | 97 ++++++++++++++++++++++++++++++++--------------------- src/sfnt/ttbdf.c | 11 +++--- src/sfnt/ttbdf.h | 2 +- 3 files changed, 66 insertions(+), 44 deletions(-) diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c index 70c63417b..cb8ab440e 100644 --- a/src/sfnt/sfdriver.c +++ b/src/sfnt/sfdriver.c @@ -79,41 +79,57 @@ * */ - static void* - get_sfnt_table( TT_Face face, + FT_CALLBACK_DEF( FT_Error ) + sfnt_load_table( FT_Face face, /* TT_Face */ + FT_ULong tag, + FT_Long offset, + FT_Byte* buffer, + FT_ULong* length ) + { + TT_Face ttface = (TT_Face)face; + + + return tt_face_load_any( ttface, tag, offset, buffer, length ); + } + + + FT_CALLBACK_DEF( void* ) + get_sfnt_table( FT_Face face, /* TT_Face */ FT_Sfnt_Tag tag ) { + TT_Face ttface = (TT_Face)face; + void* table; switch ( tag ) { case FT_SFNT_HEAD: - table = &face->header; + table = &ttface->header; break; case FT_SFNT_HHEA: - table = &face->horizontal; + table = &ttface->horizontal; break; case FT_SFNT_VHEA: - table = face->vertical_info ? &face->vertical : NULL; + table = ttface->vertical_info ? &ttface->vertical : NULL; break; case FT_SFNT_OS2: - table = ( face->os2.version == 0xFFFFU ) ? NULL : &face->os2; + table = ( ttface->os2.version == 0xFFFFU ) ? NULL : &ttface->os2; break; case FT_SFNT_POST: - table = &face->postscript; + table = &ttface->postscript; break; case FT_SFNT_MAXP: - table = &face->max_profile; + table = &ttface->max_profile; break; case FT_SFNT_PCLT: - table = face->pclt.Version ? &face->pclt : NULL; + table = ttface->pclt.Version ? &ttface->pclt : NULL; break; default: @@ -124,26 +140,29 @@ } - static FT_Error - sfnt_table_info( TT_Face face, + FT_CALLBACK_DEF( FT_Error ) + sfnt_table_info( FT_Face face, /* TT_Face */ FT_UInt idx, FT_ULong *tag, FT_ULong *offset, FT_ULong *length ) { + TT_Face ttface = (TT_Face)face; + + if ( !offset || !length ) return FT_THROW( Invalid_Argument ); if ( !tag ) - *length = face->num_tables; + *length = ttface->num_tables; else { - if ( idx >= face->num_tables ) + if ( idx >= ttface->num_tables ) return FT_THROW( Table_Missing ); - *tag = face->dir_tables[idx].Tag; - *offset = face->dir_tables[idx].Offset; - *length = face->dir_tables[idx].Length; + *tag = ttface->dir_tables[idx].Tag; + *offset = ttface->dir_tables[idx].Offset; + *length = ttface->dir_tables[idx].Length; } return FT_Err_Ok; @@ -153,7 +172,7 @@ FT_DEFINE_SERVICE_SFNT_TABLEREC( sfnt_service_sfnt_table, - (FT_SFNT_TableLoadFunc)tt_face_load_any, /* load_table */ + (FT_SFNT_TableLoadFunc)sfnt_load_table, /* load_table */ (FT_SFNT_TableGetFunc) get_sfnt_table, /* get_table */ (FT_SFNT_TableInfoFunc)sfnt_table_info /* table_info */ ) @@ -166,7 +185,7 @@ * */ - static FT_Error + FT_CALLBACK_DEF( FT_Error ) sfnt_get_glyph_name( FT_Face face, FT_UInt glyph_index, FT_Pointer buffer, @@ -184,7 +203,7 @@ } - static FT_UInt + FT_CALLBACK_DEF( FT_UInt ) sfnt_get_name_index( FT_Face face, const FT_String* glyph_name ) { @@ -600,7 +619,7 @@ } - static FT_Bool + FT_CALLBACK_DEF( FT_Bool ) sfnt_get_name_id( TT_Face face, FT_UShort id, FT_Int *win, @@ -1043,47 +1062,49 @@ #endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ - static const char* - sfnt_get_ps_name( TT_Face face ) + FT_CALLBACK_DEF( const char* ) + sfnt_get_ps_name( FT_Face face ) /* TT_Face */ { + TT_Face ttface = (TT_Face)face; + FT_Int found, win, apple; const char* result = NULL; - if ( face->postscript_name ) - return face->postscript_name; + if ( ttface->postscript_name ) + return ttface->postscript_name; #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - if ( face->blend && - ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) || - FT_IS_VARIATION( FT_FACE( face ) ) ) ) + if ( ttface->blend && + ( FT_IS_NAMED_INSTANCE( face ) || + FT_IS_VARIATION( face ) ) ) { - face->postscript_name = sfnt_get_var_ps_name( face ); - return face->postscript_name; + ttface->postscript_name = sfnt_get_var_ps_name( ttface ); + return ttface->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 ); + found = sfnt_get_name_id( ttface, 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, + result = get_win_string( FT_FACE_MEMORY( face ), + ttface->name_table.stream, + ttface->name_table.names + win, sfnt_is_postscript, 1 ); if ( !result && apple != -1 ) - result = get_apple_string( face->root.memory, - face->name_table.stream, - face->name_table.names + apple, + result = get_apple_string( FT_FACE_MEMORY( face ), + ttface->name_table.stream, + ttface->name_table.names + apple, sfnt_is_postscript, 1 ); - face->postscript_name = result; + ttface->postscript_name = result; return result; } @@ -1109,7 +1130,7 @@ #ifdef TT_CONFIG_OPTION_BDF static FT_Error - sfnt_get_charset_id( TT_Face face, + sfnt_get_charset_id( FT_Face face, const char* *acharset_encoding, const char* *acharset_registry ) { diff --git a/src/sfnt/ttbdf.c b/src/sfnt/ttbdf.c index c4d0035ea..536fa7467 100644 --- a/src/sfnt/ttbdf.c +++ b/src/sfnt/ttbdf.c @@ -136,13 +136,14 @@ FT_LOCAL_DEF( FT_Error ) - tt_face_find_bdf_prop( TT_Face face, + tt_face_find_bdf_prop( FT_Face face, /* TT_Face */ const char* property_name, BDF_PropertyRec *aprop ) { - TT_BDF bdf = &face->bdf; - FT_Size size = FT_FACE( face )->size; - FT_Error error = FT_Err_Ok; + TT_Face ttface = (TT_Face)face; + TT_BDF bdf = &ttface->bdf; + FT_Size size = FT_FACE_SIZE( face ); + FT_Error error = FT_Err_Ok; FT_Byte* p; FT_UInt count; FT_Byte* strike; @@ -153,7 +154,7 @@ if ( bdf->loaded == 0 ) { - error = tt_face_load_bdf_props( face, FT_FACE( face )->stream ); + error = tt_face_load_bdf_props( ttface, FT_FACE_STREAM( face ) ); if ( error ) goto Exit; } diff --git a/src/sfnt/ttbdf.h b/src/sfnt/ttbdf.h index 595aeb76c..0d7a0acec 100644 --- a/src/sfnt/ttbdf.h +++ b/src/sfnt/ttbdf.h @@ -34,7 +34,7 @@ FT_BEGIN_HEADER FT_LOCAL( FT_Error ) - tt_face_find_bdf_prop( TT_Face face, + tt_face_find_bdf_prop( FT_Face face, const char* property_name, BDF_PropertyRec *aprop ); -- cgit v1.2.3 From 3a85bf0b3f1da3b902b8f7643a309c64ebe019ad Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 7 May 2023 06:43:21 +0200 Subject: * src/truetype/*: Clean up interface. Ensure that all driver functions use the signature of the service or driver. This avoids pointer mismatches, which are technically undefined behaviour. Recent compilers are more picky in catching them as part of Control Flow Integrity tests. --- src/truetype/ttdriver.c | 58 +++++------ src/truetype/ttgload.c | 8 +- src/truetype/ttgxvar.c | 267 +++++++++++++++++++++++++----------------------- src/truetype/ttgxvar.h | 36 +++---- src/truetype/ttobjs.c | 6 +- src/truetype/ttpload.c | 37 +++---- src/truetype/ttpload.h | 6 +- 7 files changed, 220 insertions(+), 198 deletions(-) diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c index 8bde30fbf..ffebcc744 100644 --- a/src/truetype/ttdriver.c +++ b/src/truetype/ttdriver.c @@ -57,7 +57,7 @@ * PROPERTY SERVICE * */ - static FT_Error + FT_CALLBACK_DEF( FT_Error ) tt_property_set( FT_Module module, /* TT_Driver */ const char* property_name, const void* value, @@ -124,10 +124,10 @@ } - static FT_Error + FT_CALLBACK_DEF( FT_Error ) tt_property_get( FT_Module module, /* TT_Driver */ const char* property_name, - const void* value ) + void* value ) { FT_Error error = FT_Err_Ok; TT_Driver driver = (TT_Driver)module; @@ -208,35 +208,35 @@ * * They can be implemented by format-specific interfaces. */ - static FT_Error - tt_get_kerning( FT_Face ttface, /* TT_Face */ + FT_CALLBACK_DEF( FT_Error ) + tt_get_kerning( FT_Face face, /* TT_Face */ FT_UInt left_glyph, FT_UInt right_glyph, FT_Vector* kerning ) { - TT_Face face = (TT_Face)ttface; - SFNT_Service sfnt = (SFNT_Service)face->sfnt; + TT_Face ttface = (TT_Face)face; + SFNT_Service sfnt = (SFNT_Service)ttface->sfnt; kerning->x = 0; kerning->y = 0; if ( sfnt ) - kerning->x = sfnt->get_kerning( face, left_glyph, right_glyph ); + kerning->x = sfnt->get_kerning( ttface, left_glyph, right_glyph ); return 0; } - static FT_Error - tt_get_advances( FT_Face ttface, + FT_CALLBACK_DEF( FT_Error ) + tt_get_advances( FT_Face face, /* TT_Face */ FT_UInt start, FT_UInt count, FT_Int32 flags, FT_Fixed *advances ) { FT_UInt nn; - TT_Face face = (TT_Face)ttface; + TT_Face ttface = (TT_Face)face; /* XXX: TODO: check for sbits */ @@ -245,8 +245,8 @@ { #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT /* no fast retrieval for blended MM fonts without VVAR table */ - if ( ( FT_IS_NAMED_INSTANCE( ttface ) || FT_IS_VARIATION( ttface ) ) && - !( face->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 @@ -257,7 +257,7 @@ /* since we don't need `tsb', we use zero for `yMax' parameter */ - TT_Get_VMetrics( face, start + nn, 0, &tsb, &ah ); + TT_Get_VMetrics( ttface, start + nn, 0, &tsb, &ah ); advances[nn] = ah; } } @@ -265,8 +265,8 @@ { #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT /* no fast retrieval for blended MM fonts without HVAR table */ - if ( ( FT_IS_NAMED_INSTANCE( ttface ) || FT_IS_VARIATION( ttface ) ) && - !( face->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 @@ -276,7 +276,7 @@ FT_UShort aw; - TT_Get_HMetrics( face, start + nn, &lsb, &aw ); + TT_Get_HMetrics( ttface, start + nn, &lsb, &aw ); advances[nn] = aw; } } @@ -300,7 +300,7 @@ #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS - static FT_Error + FT_CALLBACK_DEF( FT_Error ) tt_size_select( FT_Size size, FT_ULong strike_index ) { @@ -337,7 +337,7 @@ #endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */ - static FT_Error + FT_CALLBACK_DEF( FT_Error ) tt_size_request( FT_Size size, FT_Size_Request req ) { @@ -436,15 +436,15 @@ * @Return: * FreeType error code. 0 means success. */ - static FT_Error - tt_glyph_load( FT_GlyphSlot ttslot, /* TT_GlyphSlot */ - FT_Size ttsize, /* TT_Size */ + FT_CALLBACK_DEF( FT_Error ) + tt_glyph_load( FT_GlyphSlot slot, /* TT_GlyphSlot */ + FT_Size size, /* TT_Size */ FT_UInt glyph_index, FT_Int32 load_flags ) { - TT_GlyphSlot slot = (TT_GlyphSlot)ttslot; - TT_Size size = (TT_Size)ttsize; - FT_Face face = ttslot->face; + TT_GlyphSlot ttslot = (TT_GlyphSlot)slot; + TT_Size ttsize = (TT_Size)size; + FT_Face face = ttslot->face; FT_Error error; @@ -486,12 +486,12 @@ } /* use hinted metrics only if we load a glyph with hinting */ - size->metrics = ( load_flags & FT_LOAD_NO_HINTING ) - ? &ttsize->metrics - : &size->hinted_metrics; + ttsize->metrics = ( load_flags & FT_LOAD_NO_HINTING ) + ? &size->metrics + : &ttsize->hinted_metrics; /* now fill in the glyph slot with outline/bitmap/layered */ - error = TT_Load_Glyph( size, slot, glyph_index, load_flags ); + error = TT_Load_Glyph( ttsize, ttslot, glyph_index, load_flags ); /* force drop-out mode to 2 - irrelevant now */ /* slot->outline.dropout_mode = 2; */ diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index 534026a7c..b56db1740 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -1612,8 +1612,14 @@ else #endif /* FT_CONFIG_OPTION_INCREMENTAL */ + { + FT_ULong len; + - offset = tt_face_get_location( face, glyph_index, &loader->byte_len ); + offset = tt_face_get_location( FT_FACE( face ), glyph_index, &len ); + + loader->byte_len = (FT_UInt)len; + } if ( loader->byte_len > 0 ) { diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 249ef316a..04caff7b0 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -466,7 +466,7 @@ if ( store_offset ) { error = tt_var_load_item_variation_store( - face, + FT_FACE( face ), table_offset + store_offset, &table->itemStore ); if ( error ) @@ -476,7 +476,7 @@ if ( axisMap_offset ) { error = tt_var_load_delta_set_index_mapping( - face, + FT_FACE( face ), table_offset + axisMap_offset, &table->axisMap, &table->itemStore, @@ -493,10 +493,11 @@ FT_LOCAL_DEF( FT_Error ) - tt_var_load_item_variation_store( TT_Face face, + tt_var_load_item_variation_store( FT_Face face, /* TT_Face */ FT_ULong offset, GX_ItemVarStore itemStore ) { + TT_Face ttface = (TT_Face)face; FT_Stream stream = FT_FACE_STREAM( face ); FT_Memory memory = stream->memory; @@ -511,7 +512,7 @@ FT_UInt i, j, k; FT_Bool long_words; - GX_Blend blend = face->blend; + GX_Blend blend = ttface->blend; FT_ULong* dataOffsetArray = NULL; @@ -715,7 +716,7 @@ FT_LOCAL_DEF( FT_Error ) - tt_var_load_delta_set_index_mapping( TT_Face face, + tt_var_load_delta_set_index_mapping( FT_Face face, /* TT_Face */ FT_ULong offset, GX_DeltaSetIdxMap map, GX_ItemVarStore itemStore, @@ -942,7 +943,7 @@ } error = tt_var_load_item_variation_store( - face, + FT_FACE( face ), table_offset + store_offset, &table->itemStore ); if ( error ) @@ -951,7 +952,7 @@ if ( widthMap_offset ) { error = tt_var_load_delta_set_index_mapping( - face, + FT_FACE( face ), table_offset + widthMap_offset, &table->widthMap, &table->itemStore, @@ -993,11 +994,12 @@ FT_LOCAL_DEF( FT_ItemVarDelta ) - tt_var_get_item_delta( TT_Face face, + tt_var_get_item_delta( FT_Face face, /* TT_Face */ GX_ItemVarStore itemStore, FT_UInt outerIndex, FT_UInt innerIndex ) { + TT_Face ttface = (TT_Face)face; FT_Stream stream = FT_FACE_STREAM( face ); FT_Memory memory = stream->memory; FT_Error error = FT_Err_Ok; @@ -1010,7 +1012,7 @@ FT_ItemVarDelta returnValue; - if ( !face->blend || !face->blend->normalizedcoords ) + if ( !ttface->blend || !ttface->blend->normalizedcoords ) return 0; /* OpenType 1.8.4+: No variation data for this item */ @@ -1061,27 +1063,27 @@ else if ( axis->peakCoord == 0 ) continue; - else if ( face->blend->normalizedcoords[j] == axis->peakCoord ) + else if ( ttface->blend->normalizedcoords[j] == axis->peakCoord ) continue; /* ignore this region if coords are out of range */ - else if ( face->blend->normalizedcoords[j] <= axis->startCoord || - face->blend->normalizedcoords[j] >= axis->endCoord ) + else if ( ttface->blend->normalizedcoords[j] <= axis->startCoord || + ttface->blend->normalizedcoords[j] >= axis->endCoord ) { scalar = 0; break; } /* cumulative product of all the axis scalars */ - else if ( face->blend->normalizedcoords[j] < axis->peakCoord ) + else if ( ttface->blend->normalizedcoords[j] < axis->peakCoord ) scalar = FT_MulDiv( scalar, - face->blend->normalizedcoords[j] - axis->startCoord, + ttface->blend->normalizedcoords[j] - axis->startCoord, axis->peakCoord - axis->startCoord ); else scalar = FT_MulDiv( scalar, - axis->endCoord - face->blend->normalizedcoords[j], + axis->endCoord - ttface->blend->normalizedcoords[j], axis->endCoord - axis->peakCoord ); } /* per-axis loop */ @@ -1207,7 +1209,7 @@ innerIndex = gindex; } - delta = tt_var_get_item_delta( face, + delta = tt_var_get_item_delta( FT_FACE( face ), &table->itemStore, outerIndex, innerIndex ); @@ -1230,20 +1232,20 @@ FT_LOCAL_DEF( FT_Error ) - tt_hadvance_adjust( TT_Face face, + tt_hadvance_adjust( FT_Face face, /* TT_Face */ FT_UInt gindex, FT_Int *avalue ) { - return tt_hvadvance_adjust( face, gindex, avalue, 0 ); + return tt_hvadvance_adjust( (TT_Face)face, gindex, avalue, 0 ); } FT_LOCAL_DEF( FT_Error ) - tt_vadvance_adjust( TT_Face face, + tt_vadvance_adjust( FT_Face face, /* TT_Face */ FT_UInt gindex, FT_Int *avalue ) { - return tt_hvadvance_adjust( face, gindex, avalue, 1 ); + return tt_hvadvance_adjust( (TT_Face)face, gindex, avalue, 1 ); } @@ -1390,7 +1392,7 @@ records_offset = FT_STREAM_POS(); error = tt_var_load_item_variation_store( - face, + FT_FACE( face ), table_offset + store_offset, &blend->mvar_table->itemStore ); if ( error ) @@ -1489,16 +1491,19 @@ * The font face. */ FT_LOCAL_DEF( void ) - tt_apply_mvar( TT_Face face ) + tt_apply_mvar( FT_Face face ) /* TT_Face */ { - GX_Blend blend = face->blend; + TT_Face ttface = (TT_Face)face; + + GX_Blend blend = ttface->blend; GX_Value value, limit; + FT_Short mvar_hasc_delta = 0; FT_Short mvar_hdsc_delta = 0; FT_Short mvar_hlgp_delta = 0; - if ( !( face->variation_support & TT_FACE_FLAG_VAR_MVAR ) ) + if ( !( ttface->variation_support & TT_FACE_FLAG_VAR_MVAR ) ) return; value = blend->mvar_table->values; @@ -1506,7 +1511,7 @@ for ( ; value < limit; value++ ) { - FT_Short* p = ft_var_get_value_pointer( face, value->tag ); + FT_Short* p = ft_var_get_value_pointer( ttface, value->tag ); FT_Int delta; @@ -1544,9 +1549,7 @@ /* adjust all derived values */ { FT_Service_MetricsVariations var = - (FT_Service_MetricsVariations)face->face_var; - - FT_Face root = &face->root; + (FT_Service_MetricsVariations)ttface->face_var; /* * Apply the deltas of hasc, hdsc and hlgp to the FT_Face's ascender, @@ -1574,23 +1577,23 @@ * whether they were actually changed or the font had the OS/2 table's * fsSelection's bit 7 (USE_TYPO_METRICS) set. */ - FT_Short current_line_gap = root->height - root->ascender + - root->descender; + FT_Short current_line_gap = face->height - face->ascender + + face->descender; - root->ascender = root->ascender + mvar_hasc_delta; - root->descender = root->descender + mvar_hdsc_delta; - root->height = root->ascender - root->descender + + face->ascender = face->ascender + mvar_hasc_delta; + face->descender = face->descender + mvar_hdsc_delta; + face->height = face->ascender - face->descender + current_line_gap + mvar_hlgp_delta; - root->underline_position = face->postscript.underlinePosition - - face->postscript.underlineThickness / 2; - root->underline_thickness = face->postscript.underlineThickness; + face->underline_position = ttface->postscript.underlinePosition - + ttface->postscript.underlineThickness / 2; + face->underline_thickness = ttface->postscript.underlineThickness; /* iterate over all FT_Size objects and call `var->size_reset' */ /* to propagate the metrics changes */ if ( var && var->size_reset ) - FT_List_Iterate( &root->sizes_list, + FT_List_Iterate( &face->sizes_list, ft_size_reset_iterator, (void*)var ); } @@ -2103,7 +2106,7 @@ innerIndex = table->axisMap.innerIndex[idx]; } - delta = tt_var_get_item_delta( face, + delta = tt_var_get_item_delta( FT_FACE( face ), &table->itemStore, outerIndex, innerIndex ); @@ -2265,11 +2268,12 @@ * FreeType error code. 0 means success. */ FT_LOCAL_DEF( FT_Error ) - TT_Get_MM_Var( TT_Face face, + TT_Get_MM_Var( FT_Face face, /* TT_Face */ FT_MM_Var* *master ) { - FT_Stream stream = face->root.stream; - FT_Memory memory = face->root.memory; + TT_Face ttface = (TT_Face)face; + FT_Stream stream = FT_FACE_STREAM( face ); + FT_Memory memory = FT_FACE_MEMORY( face ); FT_ULong table_len; FT_Error error = FT_Err_Ok; FT_ULong fvar_start = 0; @@ -2333,19 +2337,19 @@ /* the default instance, which might be missing in the table of named */ /* instances (in 'fvar'). This value is validated in `sfobjs.c` and */ /* may be reset to 0 if consistency checks fail. */ - num_instances = (FT_UInt)face->root.style_flags >> 16; + num_instances = (FT_UInt)face->style_flags >> 16; /* read the font data and set up the internal representation */ /* if not already done */ - need_init = !face->blend; + need_init = !ttface->blend; if ( need_init ) { FT_TRACE2(( "FVAR " )); - if ( FT_SET_ERROR( face->goto_table( face, TTAG_fvar, - stream, &table_len ) ) ) + if ( FT_SET_ERROR( ttface->goto_table( ttface, TTAG_fvar, + stream, &table_len ) ) ) { FT_TRACE1(( "is missing\n" )); goto Exit; @@ -2378,14 +2382,14 @@ fvar_head.axisCount, fvar_head.axisCount == 1 ? "is" : "es" )); - if ( FT_NEW( face->blend ) ) + if ( FT_NEW( ttface->blend ) ) goto Exit; - num_axes = fvar_head.axisCount; - face->blend->num_axis = num_axes; + num_axes = fvar_head.axisCount; + ttface->blend->num_axis = num_axes; } else - num_axes = face->blend->num_axis; + num_axes = ttface->blend->num_axis; /* prepare storage area for MM data; this cannot overflow */ /* 32-bit arithmetic because of the size limits used in the */ @@ -2414,16 +2418,16 @@ if ( need_init ) { - 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 ) ) + ttface->blend->mmvar_len = mmvar_size + + axis_flags_size + + axis_size + + namedstyle_size + + next_coords_size + + next_name_size; + + if ( FT_ALLOC( mmvar, ttface->blend->mmvar_len ) ) goto Exit; - face->blend->mmvar = mmvar; + ttface->blend->mmvar = mmvar; /* set up pointers and offsets into the `mmvar' array; */ /* the data gets filled in later on */ @@ -2529,16 +2533,16 @@ /* 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, + if ( FT_NEW_ARRAY( ttface->blend->normalized_stylecoords, num_axes * num_instances ) ) goto Exit; - if ( fvar_head.instanceCount && !face->blend->avar_loaded ) + if ( fvar_head.instanceCount && !ttface->blend->avar_loaded ) { FT_ULong offset = FT_STREAM_POS(); - ft_var_load_avar( face ); + ft_var_load_avar( ttface ); if ( FT_STREAM_SEEK( offset ) ) goto Exit; @@ -2549,7 +2553,7 @@ fvar_head.instanceCount == 1 ? "" : "s" )); ns = mmvar->namedstyle; - nsc = face->blend->normalized_stylecoords; + nsc = ttface->blend->normalized_stylecoords; for ( i = 0; i < fvar_head.instanceCount; i++, ns++ ) { /* PostScript names add 2 bytes to the instance record size */ @@ -2572,7 +2576,7 @@ #ifdef FT_DEBUG_LEVEL_TRACE { - SFNT_Service sfnt = (SFNT_Service)face->sfnt; + SFNT_Service sfnt = (SFNT_Service)ttface->sfnt; FT_String* strname = NULL; FT_String* psname = NULL; @@ -2584,7 +2588,7 @@ if ( ns->strid != 0xFFFF ) { - (void)sfnt->get_name( face, + (void)sfnt->get_name( ttface, (FT_UShort)ns->strid, &strname ); if ( strname && !ft_strcmp( strname, ".notdef" ) ) @@ -2593,7 +2597,7 @@ if ( ns->psid != 0xFFFF ) { - (void)sfnt->get_name( face, + (void)sfnt->get_name( ttface, (FT_UShort)ns->psid, &psname ); if ( psname && !ft_strcmp( psname, ".notdef" ) ) @@ -2616,7 +2620,7 @@ } #endif /* FT_DEBUG_LEVEL_TRACE */ - ft_var_to_normalized( face, num_axes, ns->coords, nsc ); + ft_var_to_normalized( ttface, num_axes, ns->coords, nsc ); nsc += num_axes; FT_FRAME_EXIT(); @@ -2624,7 +2628,7 @@ if ( num_instances != fvar_head.instanceCount ) { - SFNT_Service sfnt = (SFNT_Service)face->sfnt; + SFNT_Service sfnt = (SFNT_Service)ttface->sfnt; FT_Int found, dummy1, dummy2; FT_UInt strid = ~0U; @@ -2634,7 +2638,7 @@ /* of named instances; try to synthesize an entry. */ /* If this fails, `default_named_instance` remains */ /* at value zero, which doesn't do any harm. */ - found = sfnt->get_name_id( face, + found = sfnt->get_name_id( ttface, TT_NAME_ID_TYPOGRAPHIC_SUBFAMILY, &dummy1, &dummy2 ); @@ -2642,7 +2646,7 @@ strid = TT_NAME_ID_TYPOGRAPHIC_SUBFAMILY; else { - found = sfnt->get_name_id( face, + found = sfnt->get_name_id( ttface, TT_NAME_ID_FONT_SUBFAMILY, &dummy1, &dummy2 ); @@ -2652,7 +2656,7 @@ if ( found ) { - found = sfnt->get_name_id( face, + found = sfnt->get_name_id( ttface, TT_NAME_ID_PS_NAME, &dummy1, &dummy2 ); @@ -2662,7 +2666,7 @@ " Adding default instance to named instances\n" )); /* named instance indices start with value 1 */ - face->var_default_named_instance = num_instances; + ttface->var_default_named_instance = num_instances; ns = &mmvar->namedstyle[fvar_head.instanceCount]; @@ -2677,7 +2681,7 @@ } } - ft_var_load_mvar( face ); + ft_var_load_mvar( ttface ); } /* fill the output array if requested */ @@ -2687,9 +2691,9 @@ FT_UInt n; - if ( FT_ALLOC( mmvar, face->blend->mmvar_len ) ) + if ( FT_ALLOC( mmvar, ttface->blend->mmvar_len ) ) goto Exit; - FT_MEM_COPY( mmvar, face->blend->mmvar, face->blend->mmvar_len ); + FT_MEM_COPY( mmvar, ttface->blend->mmvar, ttface->blend->mmvar_len ); axis_flags = (FT_UShort*)( (char*)mmvar + mmvar_size ); @@ -2765,7 +2769,7 @@ if ( !face->blend ) { - if ( FT_SET_ERROR( TT_Get_MM_Var( face, NULL ) ) ) + if ( FT_SET_ERROR( TT_Get_MM_Var( FT_FACE( face ), NULL ) ) ) goto Exit; } @@ -2971,11 +2975,11 @@ * axis values. */ FT_LOCAL_DEF( FT_Error ) - TT_Set_MM_Blend( TT_Face face, + TT_Set_MM_Blend( FT_Face face, /* TT_Face */ FT_UInt num_coords, FT_Fixed* coords ) { - return tt_set_mm_blend( face, num_coords, coords, 1 ); + return tt_set_mm_blend( (TT_Face)face, num_coords, coords, 1 ); } @@ -3007,28 +3011,30 @@ * axis values. */ FT_LOCAL_DEF( FT_Error ) - TT_Get_MM_Blend( TT_Face face, + TT_Get_MM_Blend( FT_Face face, /* TT_Face */ FT_UInt num_coords, FT_Fixed* coords ) { + TT_Face ttface = (TT_Face)face; + FT_Error error = FT_Err_Ok; GX_Blend blend; FT_UInt i, nc; - if ( !face->blend ) + if ( !ttface->blend ) { if ( FT_SET_ERROR( TT_Get_MM_Var( face, NULL ) ) ) return error; } - blend = face->blend; + blend = ttface->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 ) ) ) + if ( FT_SET_ERROR( tt_set_mm_blend( ttface, 0, NULL, 1 ) ) ) return error; } @@ -3041,7 +3047,7 @@ nc = blend->num_axis; } - if ( face->doblend ) + if ( ttface->doblend ) { for ( i = 0; i < nc; i++ ) coords[i] = blend->normalizedcoords[i]; @@ -3088,15 +3094,16 @@ * FreeType error code. 0 means success. */ FT_LOCAL_DEF( FT_Error ) - TT_Set_Var_Design( TT_Face face, + TT_Set_Var_Design( FT_Face face, /* TT_Face */ FT_UInt num_coords, FT_Fixed* coords ) { + TT_Face ttface = (TT_Face)face; FT_Error error = FT_Err_Ok; GX_Blend blend; FT_MM_Var* mmvar; FT_UInt i; - FT_Memory memory = face->root.memory; + FT_Memory memory = FT_FACE_MEMORY( face ); FT_Fixed* c; FT_Fixed* n; @@ -3105,13 +3112,13 @@ FT_Bool have_diff = 0; - if ( !face->blend ) + if ( !ttface->blend ) { if ( FT_SET_ERROR( TT_Get_MM_Var( face, NULL ) ) ) goto Exit; } - blend = face->blend; + blend = ttface->blend; mmvar = blend->mmvar; if ( num_coords > mmvar->num_axis ) @@ -3139,13 +3146,13 @@ } } - if ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) ) + if ( FT_IS_NAMED_INSTANCE( face ) ) { FT_UInt instance_index; FT_Var_Named_Style* named_style; - instance_index = (FT_UInt)face->root.face_index >> 16; + instance_index = (FT_UInt)face->face_index >> 16; named_style = mmvar->namedstyle + instance_index - 1; n = named_style->coords + num_coords; @@ -3182,14 +3189,14 @@ if ( FT_NEW_ARRAY( normalized, mmvar->num_axis ) ) goto Exit; - if ( !face->blend->avar_loaded ) - ft_var_load_avar( face ); + if ( !ttface->blend->avar_loaded ) + ft_var_load_avar( ttface ); FT_TRACE5(( "TT_Set_Var_Design:\n" )); FT_TRACE5(( " normalized design coordinates:\n" )); - ft_var_to_normalized( face, num_coords, blend->coords, normalized ); + ft_var_to_normalized( ttface, num_coords, blend->coords, normalized ); - error = tt_set_mm_blend( face, mmvar->num_axis, normalized, 0 ); + error = tt_set_mm_blend( ttface, mmvar->num_axis, normalized, 0 ); if ( error ) goto Exit; @@ -3225,28 +3232,29 @@ * FreeType error code. 0~means success. */ FT_LOCAL_DEF( FT_Error ) - TT_Get_Var_Design( TT_Face face, + TT_Get_Var_Design( FT_Face face, /* TT_Face */ FT_UInt num_coords, FT_Fixed* coords ) { - FT_Error error = FT_Err_Ok; + TT_Face ttface = (TT_Face)face; + FT_Error error = FT_Err_Ok; GX_Blend blend; FT_UInt i, nc; - if ( !face->blend ) + if ( !ttface->blend ) { if ( FT_SET_ERROR( TT_Get_MM_Var( face, NULL ) ) ) return error; } - blend = face->blend; + blend = ttface->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 ) ) ) + if ( FT_SET_ERROR( tt_set_mm_blend( ttface, 0, NULL, 1 ) ) ) return error; } @@ -3259,7 +3267,7 @@ nc = blend->num_axis; } - if ( face->doblend ) + if ( ttface->doblend ) { for ( i = 0; i < nc; i++ ) coords[i] = blend->coords[i]; @@ -3299,28 +3307,29 @@ * axis values. */ FT_LOCAL_DEF( FT_Error ) - TT_Set_Named_Instance( TT_Face face, + TT_Set_Named_Instance( FT_Face face, /* TT_Face */ FT_UInt instance_index ) { + TT_Face ttface = (TT_Face)face; FT_Error error; GX_Blend blend; FT_MM_Var* mmvar; - FT_Memory memory = face->root.memory; + FT_Memory memory = FT_FACE_MEMORY( face ); FT_UInt num_instances; - if ( !face->blend ) + if ( !ttface->blend ) { if ( FT_SET_ERROR( TT_Get_MM_Var( face, NULL ) ) ) goto Exit; } - blend = face->blend; + blend = ttface->blend; mmvar = blend->mmvar; - num_instances = (FT_UInt)face->root.style_flags >> 16; + num_instances = (FT_UInt)face->style_flags >> 16; /* `instance_index' starts with value 1, thus `>' */ if ( instance_index > num_instances ) @@ -3331,7 +3340,7 @@ if ( instance_index > 0 ) { - SFNT_Service sfnt = (SFNT_Service)face->sfnt; + SFNT_Service sfnt = (SFNT_Service)ttface->sfnt; FT_Var_Named_Style* named_style; FT_String* style_name; @@ -3339,15 +3348,15 @@ named_style = mmvar->namedstyle + instance_index - 1; - error = sfnt->get_name( face, + error = sfnt->get_name( ttface, (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; + FT_FREE( face->style_name ); + face->style_name = style_name; /* finally, select the named instance */ error = TT_Set_Var_Design( face, @@ -3357,8 +3366,8 @@ else { /* restore non-VF style name */ - FT_FREE( face->root.style_name ); - if ( FT_STRDUP( face->root.style_name, face->non_var_style_name ) ) + FT_FREE( face->style_name ); + if ( FT_STRDUP( face->style_name, ttface->non_var_style_name ) ) goto Exit; error = TT_Set_Var_Design( face, 0, NULL ); } @@ -3388,19 +3397,20 @@ * FreeType error code. 0~means success. */ FT_LOCAL_DEF( FT_Error ) - TT_Get_Default_Named_Instance( TT_Face face, + TT_Get_Default_Named_Instance( FT_Face face, FT_UInt *instance_index ) { - FT_Error error = FT_Err_Ok; + TT_Face ttface = (TT_Face)face; + FT_Error error = FT_Err_Ok; - if ( !face->blend ) + if ( !ttface->blend ) { if ( FT_SET_ERROR( TT_Get_MM_Var( face, NULL ) ) ) goto Exit; } - *instance_index = face->var_default_named_instance; + *instance_index = ttface->var_default_named_instance; Exit: return error; @@ -3411,12 +3421,13 @@ /* field in `TT_Face`. */ FT_LOCAL_DEF( void ) - tt_construct_ps_name( TT_Face face ) + tt_construct_ps_name( FT_Face face ) { - FT_Memory memory = face->root.memory; + TT_Face ttface = (TT_Face)face; + FT_Memory memory = FT_FACE_MEMORY( face ); - FT_FREE( face->postscript_name ); + FT_FREE( ttface->postscript_name ); } @@ -4452,22 +4463,25 @@ * the MM machinery in case it isn't loaded yet. */ FT_LOCAL_DEF( FT_Error ) - tt_get_var_blend( TT_Face face, + tt_get_var_blend( FT_Face face, /* TT_Face */ FT_UInt *num_coords, FT_Fixed* *coords, FT_Fixed* *normalizedcoords, FT_MM_Var* *mm_var ) { - if ( face->blend ) + TT_Face ttface = (TT_Face)face; + + + if ( ttface->blend ) { if ( num_coords ) - *num_coords = face->blend->num_axis; + *num_coords = ttface->blend->num_axis; if ( coords ) - *coords = face->blend->coords; + *coords = ttface->blend->coords; if ( normalizedcoords ) - *normalizedcoords = face->blend->normalizedcoords; + *normalizedcoords = ttface->blend->normalizedcoords; if ( mm_var ) - *mm_var = face->blend->mmvar; + *mm_var = ttface->blend->mmvar; } else { @@ -4484,7 +4498,7 @@ FT_LOCAL_DEF( void ) - tt_var_done_item_variation_store( TT_Face face, + tt_var_done_item_variation_store( FT_Face face, GX_ItemVarStore itemStore ) { FT_Memory memory = FT_FACE_MEMORY( face ); @@ -4513,7 +4527,7 @@ FT_LOCAL_DEF( void ) - tt_var_done_delta_set_index_map( TT_Face face, + tt_var_done_delta_set_index_map( FT_Face face, GX_DeltaSetIdxMap deltaSetIdxMap ) { FT_Memory memory = FT_FACE_MEMORY( face ); @@ -4533,10 +4547,11 @@ * Free the blend internal data structure. */ FT_LOCAL_DEF( void ) - tt_done_blend( TT_Face face ) + tt_done_blend( FT_Face face ) { + TT_Face ttface = (TT_Face)face; FT_Memory memory = FT_FACE_MEMORY( face ); - GX_Blend blend = face->blend; + GX_Blend blend = ttface->blend; if ( blend ) diff --git a/src/truetype/ttgxvar.h b/src/truetype/ttgxvar.h index 4de772c87..e3da6d170 100644 --- a/src/truetype/ttgxvar.h +++ b/src/truetype/ttgxvar.h @@ -347,39 +347,39 @@ FT_BEGIN_HEADER FT_LOCAL( FT_Error ) - TT_Set_MM_Blend( TT_Face face, + TT_Set_MM_Blend( FT_Face face, FT_UInt num_coords, FT_Fixed* coords ); FT_LOCAL( FT_Error ) - TT_Get_MM_Blend( TT_Face face, + TT_Get_MM_Blend( FT_Face face, FT_UInt num_coords, FT_Fixed* coords ); FT_LOCAL( FT_Error ) - TT_Set_Var_Design( TT_Face face, + TT_Set_Var_Design( FT_Face face, FT_UInt num_coords, FT_Fixed* coords ); FT_LOCAL( FT_Error ) - TT_Get_MM_Var( TT_Face face, + TT_Get_MM_Var( FT_Face face, FT_MM_Var* *master ); FT_LOCAL( FT_Error ) - TT_Get_Var_Design( TT_Face face, + TT_Get_Var_Design( FT_Face face, FT_UInt num_coords, FT_Fixed* coords ); FT_LOCAL( FT_Error ) - TT_Set_Named_Instance( TT_Face face, + TT_Set_Named_Instance( FT_Face face, FT_UInt instance_index ); FT_LOCAL( FT_Error ) - TT_Get_Default_Named_Instance( TT_Face face, + TT_Get_Default_Named_Instance( FT_Face face, FT_UInt *instance_index ); FT_LOCAL( void ) - tt_construct_ps_name( TT_Face face ); + tt_construct_ps_name( FT_Face face ); FT_LOCAL( FT_Error ) tt_face_vary_cvt( TT_Face face, @@ -392,54 +392,54 @@ FT_BEGIN_HEADER FT_Vector* unrounded ); FT_LOCAL( FT_Error ) - tt_hadvance_adjust( TT_Face face, + tt_hadvance_adjust( FT_Face face, FT_UInt gindex, FT_Int *adelta ); FT_LOCAL( FT_Error ) - tt_vadvance_adjust( TT_Face face, + tt_vadvance_adjust( FT_Face face, FT_UInt gindex, FT_Int *adelta ); FT_LOCAL( void ) - tt_apply_mvar( TT_Face face ); + tt_apply_mvar( FT_Face face ); FT_LOCAL( FT_Error ) - tt_var_load_item_variation_store( TT_Face face, + tt_var_load_item_variation_store( FT_Face face, FT_ULong offset, GX_ItemVarStore itemStore ); FT_LOCAL( FT_Error ) - tt_var_load_delta_set_index_mapping( TT_Face face, + tt_var_load_delta_set_index_mapping( FT_Face face, FT_ULong offset, GX_DeltaSetIdxMap map, GX_ItemVarStore itemStore, FT_ULong table_len ); FT_LOCAL( FT_ItemVarDelta ) - tt_var_get_item_delta( TT_Face face, + tt_var_get_item_delta( FT_Face face, GX_ItemVarStore itemStore, FT_UInt outerIndex, FT_UInt innerIndex ); FT_LOCAL( void ) - tt_var_done_item_variation_store( TT_Face face, + tt_var_done_item_variation_store( FT_Face face, GX_ItemVarStore itemStore ); FT_LOCAL( void ) - tt_var_done_delta_set_index_map( TT_Face face, + tt_var_done_delta_set_index_map( FT_Face face, GX_DeltaSetIdxMap deltaSetIdxMap ); FT_LOCAL( FT_Error ) - tt_get_var_blend( TT_Face face, + tt_get_var_blend( FT_Face face, FT_UInt *num_coords, FT_Fixed* *coords, FT_Fixed* *normalizedcoords, FT_MM_Var* *mm_var ); FT_LOCAL( void ) - tt_done_blend( TT_Face face ); + tt_done_blend( FT_Face face ); #endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c index 29d41da07..ce956c02c 100644 --- a/src/truetype/ttobjs.c +++ b/src/truetype/ttobjs.c @@ -581,7 +581,7 @@ FT_Bool result = FALSE; TT_Face face = (TT_Face)ttface; - FT_UInt asize; + FT_ULong asize; FT_ULong i; FT_ULong glyph_index = 0; FT_UInt count = 0; @@ -589,7 +589,7 @@ for( i = 0; i < face->num_locations; i++ ) { - tt_face_get_location( face, i, &asize ); + tt_face_get_location( ttface, i, &asize ); if ( asize > 0 ) { count += 1; @@ -854,7 +854,7 @@ face->cvt_program_size = 0; #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT - tt_done_blend( face ); + tt_done_blend( ttface ); face->blend = NULL; #endif } diff --git a/src/truetype/ttpload.c b/src/truetype/ttpload.c index e08bf309e..54a64c7b4 100644 --- a/src/truetype/ttpload.c +++ b/src/truetype/ttpload.c @@ -180,10 +180,11 @@ FT_LOCAL_DEF( FT_ULong ) - tt_face_get_location( TT_Face face, - FT_UInt gindex, - FT_UInt *asize ) + tt_face_get_location( FT_Face face, /* TT_Face */ + FT_UInt gindex, + FT_ULong *asize ) { + TT_Face ttface = (TT_Face)face; FT_ULong pos1, pos2; FT_Byte* p; FT_Byte* p_limit; @@ -191,12 +192,12 @@ pos1 = pos2 = 0; - if ( gindex < face->num_locations ) + if ( gindex < ttface->num_locations ) { - if ( face->header.Index_To_Loc_Format != 0 ) + if ( ttface->header.Index_To_Loc_Format != 0 ) { - p = face->glyph_locations + gindex * 4; - p_limit = face->glyph_locations + face->num_locations * 4; + p = ttface->glyph_locations + gindex * 4; + p_limit = ttface->glyph_locations + ttface->num_locations * 4; pos1 = FT_NEXT_ULONG( p ); pos2 = pos1; @@ -206,8 +207,8 @@ } else { - p = face->glyph_locations + gindex * 2; - p_limit = face->glyph_locations + face->num_locations * 2; + p = ttface->glyph_locations + gindex * 2; + p_limit = ttface->glyph_locations + ttface->num_locations * 2; pos1 = FT_NEXT_USHORT( p ); pos2 = pos1; @@ -221,30 +222,30 @@ } /* Check broken location data. */ - if ( pos1 > face->glyf_len ) + if ( pos1 > ttface->glyf_len ) { FT_TRACE1(( "tt_face_get_location:" " too large offset (0x%08lx) found for glyph index %d,\n", pos1, gindex )); FT_TRACE1(( " " " exceeding the end of `glyf' table (0x%08lx)\n", - face->glyf_len )); + ttface->glyf_len )); *asize = 0; return 0; } - if ( pos2 > face->glyf_len ) + if ( pos2 > ttface->glyf_len ) { /* We try to sanitize the last `loca' entry. */ - if ( gindex == face->num_locations - 2 ) + if ( gindex == ttface->num_locations - 2 ) { FT_TRACE1(( "tt_face_get_location:" " too large size (%ld bytes) found for glyph index %d,\n", pos2 - pos1, gindex )); FT_TRACE1(( " " " truncating at the end of `glyf' table to %ld bytes\n", - face->glyf_len - pos1 )); - pos2 = face->glyf_len; + ttface->glyf_len - pos1 )); + pos2 = ttface->glyf_len; } else { @@ -253,7 +254,7 @@ pos2, gindex + 1 )); FT_TRACE1(( " " " exceeding the end of `glyf' table (0x%08lx)\n", - face->glyf_len )); + ttface->glyf_len )); *asize = 0; return 0; } @@ -268,9 +269,9 @@ /* We get (intentionally) a wrong, non-zero result in case the */ /* `glyf' table is missing. */ if ( pos2 >= pos1 ) - *asize = (FT_UInt)( pos2 - pos1 ); + *asize = (FT_ULong)( pos2 - pos1 ); else - *asize = (FT_UInt)( face->glyf_len - pos1 ); + *asize = (FT_ULong)( ttface->glyf_len - pos1 ); return pos1; } diff --git a/src/truetype/ttpload.h b/src/truetype/ttpload.h index 939e02fe4..ed229fa46 100644 --- a/src/truetype/ttpload.h +++ b/src/truetype/ttpload.h @@ -31,9 +31,9 @@ FT_BEGIN_HEADER FT_Stream stream ); FT_LOCAL( FT_ULong ) - tt_face_get_location( TT_Face face, - FT_UInt gindex, - FT_UInt *asize ); + tt_face_get_location( FT_Face face, + FT_UInt gindex, + FT_ULong *asize ); FT_LOCAL( void ) tt_face_done_loca( TT_Face face ); -- cgit v1.2.3 From 7cc5dfa297fed532fde2c058f044e4dbb6122744 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 7 May 2023 07:10:23 +0200 Subject: * src/type1/*: Clean up interface. Ensure that all driver functions use the signature of the service or driver. This avoids pointer mismatches, which are technically undefined behaviour. Recent compilers are more picky in catching them as part of Control Flow Integrity tests. --- src/type1/t1driver.c | 27 +++++++++++++-------- src/type1/t1load.c | 68 +++++++++++++++++++++++++++++----------------------- src/type1/t1load.h | 22 ++++++++--------- src/type1/t1objs.c | 2 +- 4 files changed, 67 insertions(+), 52 deletions(-) diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c index 4abcef173..4d5f083fd 100644 --- a/src/type1/t1driver.c +++ b/src/type1/t1driver.c @@ -56,28 +56,32 @@ * */ - static FT_Error - t1_get_glyph_name( T1_Face face, + FT_CALLBACK_DEF( FT_Error ) + t1_get_glyph_name( FT_Face face, /* T1_Face */ FT_UInt glyph_index, FT_Pointer buffer, FT_UInt buffer_max ) { - FT_STRCPYN( buffer, face->type1.glyph_names[glyph_index], buffer_max ); + T1_Face t1face = (T1_Face)face; + + + FT_STRCPYN( buffer, t1face->type1.glyph_names[glyph_index], buffer_max ); return FT_Err_Ok; } - static FT_UInt - t1_get_name_index( T1_Face face, + FT_CALLBACK_DEF( FT_UInt ) + t1_get_name_index( FT_Face face, /* T1_Face */ const FT_String* glyph_name ) { - FT_Int i; + T1_Face t1face = (T1_Face)face; + FT_Int i; - for ( i = 0; i < face->type1.num_glyphs; i++ ) + for ( i = 0; i < t1face->type1.num_glyphs; i++ ) { - FT_String* gname = face->type1.glyph_names[i]; + FT_String* gname = t1face->type1.glyph_names[i]; if ( !ft_strcmp( glyph_name, gname ) ) @@ -101,9 +105,12 @@ */ static const char* - t1_get_ps_name( T1_Face face ) + t1_get_ps_name( FT_Face face ) /* T1_Face */ { - return (const char*) face->type1.font_name; + T1_Face t1face = (T1_Face)face; + + + return (const char*) t1face->type1.font_name; } diff --git a/src/type1/t1load.c b/src/type1/t1load.c index ee52bf276..96adba4ab 100644 --- a/src/type1/t1load.c +++ b/src/type1/t1load.c @@ -174,10 +174,11 @@ FT_LOCAL_DEF( FT_Error ) - T1_Get_Multi_Master( T1_Face face, + T1_Get_Multi_Master( FT_Face face, /* T1_Face */ FT_Multi_Master* master ) { - PS_Blend blend = face->blend; + T1_Face t1face = (T1_Face)face; + PS_Blend blend = t1face->blend; FT_UInt n; FT_Error error; @@ -285,16 +286,17 @@ * arguments needed by the GX var distortable fonts. */ FT_LOCAL_DEF( FT_Error ) - T1_Get_MM_Var( T1_Face face, + T1_Get_MM_Var( FT_Face face, /* T1_Face */ FT_MM_Var* *master ) { - FT_Memory memory = face->root.memory; - FT_MM_Var *mmvar = NULL; + T1_Face t1face = (T1_Face)face; + FT_Memory memory = FT_FACE_MEMORY( face ); + FT_MM_Var *mmvar = NULL; FT_Multi_Master mmaster; FT_Error error; FT_UInt i; FT_Fixed axiscoords[T1_MAX_MM_AXIS]; - PS_Blend blend = face->blend; + PS_Blend blend = t1face->blend; FT_UShort* axis_flags; FT_Offset mmvar_size; @@ -438,20 +440,21 @@ FT_LOCAL_DEF( FT_Error ) - T1_Set_MM_Blend( T1_Face face, + T1_Set_MM_Blend( FT_Face face, /* T1_Face */ FT_UInt num_coords, FT_Fixed* coords ) { - return t1_set_mm_blend( face, num_coords, coords ); + return t1_set_mm_blend( (T1_Face)face, num_coords, coords ); } FT_LOCAL_DEF( FT_Error ) - T1_Get_MM_Blend( T1_Face face, + T1_Get_MM_Blend( FT_Face face, /* T1_Face */ FT_UInt num_coords, FT_Fixed* coords ) { - PS_Blend blend = face->blend; + T1_Face t1face = (T1_Face)face; + PS_Blend blend = t1face->blend; FT_Fixed axiscoords[4]; FT_UInt i, nc; @@ -482,11 +485,12 @@ FT_LOCAL_DEF( FT_Error ) - T1_Set_MM_WeightVector( T1_Face face, + T1_Set_MM_WeightVector( FT_Face face, /* T1_Face */ FT_UInt len, FT_Fixed* weightvector ) { - PS_Blend blend = face->blend; + T1_Face t1face = (T1_Face)face; + PS_Blend blend = t1face->blend; FT_UInt i, n; @@ -517,11 +521,12 @@ FT_LOCAL_DEF( FT_Error ) - T1_Get_MM_WeightVector( T1_Face face, + T1_Get_MM_WeightVector( FT_Face face, /* T1_Face */ FT_UInt* len, FT_Fixed* weightvector ) { - PS_Blend blend = face->blend; + T1_Face t1face = (T1_Face)face; + PS_Blend blend = t1face->blend; FT_UInt i; @@ -546,12 +551,13 @@ FT_LOCAL_DEF( FT_Error ) - T1_Set_MM_Design( T1_Face face, + T1_Set_MM_Design( FT_Face face, /* T1_Face */ FT_UInt num_coords, FT_Long* coords ) { + T1_Face t1face = (T1_Face)face; FT_Error error; - PS_Blend blend = face->blend; + PS_Blend blend = t1face->blend; FT_UInt n; FT_Fixed final_blends[T1_MAX_MM_DESIGNS]; @@ -617,7 +623,7 @@ final_blends[n] = the_blend; } - error = t1_set_mm_blend( face, blend->num_axis, final_blends ); + error = t1_set_mm_blend( t1face, blend->num_axis, final_blends ); if ( error ) return error; @@ -628,7 +634,7 @@ /* 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, + T1_Reset_MM_Blend( FT_Face face, FT_UInt instance_index ) { FT_UNUSED( instance_index ); @@ -643,7 +649,7 @@ * arguments needed by the GX var distortable fonts. */ FT_LOCAL_DEF( FT_Error ) - T1_Set_Var_Design( T1_Face face, + T1_Set_Var_Design( FT_Face face, /* T1_Face */ FT_UInt num_coords, FT_Fixed* coords ) { @@ -662,11 +668,12 @@ FT_LOCAL_DEF( FT_Error ) - T1_Get_Var_Design( T1_Face face, + T1_Get_Var_Design( FT_Face face, /* T1_Face */ FT_UInt num_coords, FT_Fixed* coords ) { - PS_Blend blend = face->blend; + T1_Face t1face = (T1_Face)face; + PS_Blend blend = t1face->blend; FT_Fixed axiscoords[4]; FT_UInt i, nc; @@ -698,10 +705,11 @@ FT_LOCAL_DEF( void ) - T1_Done_Blend( T1_Face face ) + T1_Done_Blend( FT_Face face ) /* T1_Face */ { - FT_Memory memory = face->root.memory; - PS_Blend blend = face->blend; + T1_Face t1face = (T1_Face)face; + FT_Memory memory = FT_FACE_MEMORY( face ); + PS_Blend blend = t1face->blend; if ( blend ) @@ -746,7 +754,7 @@ dmap->num_points = 0; } - FT_FREE( face->blend ); + FT_FREE( t1face->blend ); } } @@ -2548,7 +2556,7 @@ { FT_ERROR(( "T1_Open_Face:" " number-of-designs != 2 ^^ number-of-axes\n" )); - T1_Done_Blend( face ); + T1_Done_Blend( FT_FACE( face ) ); } if ( face->blend && @@ -2568,15 +2576,15 @@ /* font as a normal PS font */ if ( face->blend && ( !face->blend->num_designs || !face->blend->num_axis ) ) - T1_Done_Blend( face ); + T1_Done_Blend( FT_FACE( face ) ); /* the font may have no valid WeightVector */ if ( face->blend && !face->blend->weight_vector ) - T1_Done_Blend( face ); + T1_Done_Blend( FT_FACE( face ) ); /* the font may have no valid BlendDesignPositions */ if ( face->blend && !face->blend->design_pos[0] ) - T1_Done_Blend( face ); + T1_Done_Blend( FT_FACE( face ) ); /* the font may have no valid BlendDesignMap */ if ( face->blend ) @@ -2587,7 +2595,7 @@ for ( i = 0; i < face->blend->num_axis; i++ ) if ( !face->blend->design_map[i].num_points ) { - T1_Done_Blend( face ); + T1_Done_Blend( FT_FACE( face ) ); break; } } diff --git a/src/type1/t1load.h b/src/type1/t1load.h index f8511cccf..d8c9d2d8a 100644 --- a/src/type1/t1load.h +++ b/src/type1/t1load.h @@ -66,52 +66,52 @@ FT_BEGIN_HEADER #ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT FT_LOCAL( FT_Error ) - T1_Get_Multi_Master( T1_Face face, + T1_Get_Multi_Master( FT_Face face, FT_Multi_Master* master ); FT_LOCAL( FT_Error ) - T1_Get_MM_Var( T1_Face face, + T1_Get_MM_Var( FT_Face face, FT_MM_Var* *master ); FT_LOCAL( FT_Error ) - T1_Set_MM_Blend( T1_Face face, + T1_Set_MM_Blend( FT_Face face, FT_UInt num_coords, FT_Fixed* coords ); FT_LOCAL( FT_Error ) - T1_Get_MM_Blend( T1_Face face, + T1_Get_MM_Blend( FT_Face face, FT_UInt num_coords, FT_Fixed* coords ); FT_LOCAL( FT_Error ) - T1_Set_MM_Design( T1_Face face, + T1_Set_MM_Design( FT_Face face, FT_UInt num_coords, FT_Long* coords ); FT_LOCAL( FT_Error ) - T1_Reset_MM_Blend( T1_Face face, + T1_Reset_MM_Blend( FT_Face face, FT_UInt instance_index ); FT_LOCAL( FT_Error ) - T1_Get_Var_Design( T1_Face face, + T1_Get_Var_Design( FT_Face face, FT_UInt num_coords, FT_Fixed* coords ); FT_LOCAL( FT_Error ) - T1_Set_Var_Design( T1_Face face, + T1_Set_Var_Design( FT_Face face, FT_UInt num_coords, FT_Fixed* coords ); FT_LOCAL( void ) - T1_Done_Blend( T1_Face face ); + T1_Done_Blend( FT_Face face ); FT_LOCAL( FT_Error ) - T1_Set_MM_WeightVector( T1_Face face, + T1_Set_MM_WeightVector( FT_Face face, FT_UInt len, FT_Fixed* weightvector ); FT_LOCAL( FT_Error ) - T1_Get_MM_WeightVector( T1_Face face, + T1_Get_MM_WeightVector( FT_Face face, FT_UInt* len, FT_Fixed* weightvector ); diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c index 4a39da563..e8486f562 100644 --- a/src/type1/t1objs.c +++ b/src/type1/t1objs.c @@ -226,7 +226,7 @@ face->len_buildchar = 0; } - T1_Done_Blend( face ); + T1_Done_Blend( t1face ); face->blend = NULL; #endif -- cgit v1.2.3 From ff0ef828c98d8fab816de3a22de288be4f249304 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 7 May 2023 07:19:44 +0200 Subject: * src/type42/t42drivr.c: Clean up interface. Ensure that all driver functions use the signature of the service or driver. This avoids pointer mismatches, which are technically undefined behaviour. Recent compilers are more picky in catching them as part of Control Flow Integrity tests. --- src/type42/t42drivr.c | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/src/type42/t42drivr.c b/src/type42/t42drivr.c index ce1528e5d..ee5fd44a9 100644 --- a/src/type42/t42drivr.c +++ b/src/type42/t42drivr.c @@ -56,33 +56,41 @@ * */ - static FT_Error - t42_get_glyph_name( T42_Face face, + FT_CALLBACK_DEF( FT_Error ) + t42_get_glyph_name( FT_Face face, /* T42_Face */ FT_UInt glyph_index, FT_Pointer buffer, FT_UInt buffer_max ) { - FT_STRCPYN( buffer, face->type1.glyph_names[glyph_index], buffer_max ); + T42_Face t42face = (T42_Face)face; + + + FT_STRCPYN( buffer, + t42face->type1.glyph_names[glyph_index], + buffer_max ); return FT_Err_Ok; } - static FT_UInt - t42_get_name_index( T42_Face face, + FT_CALLBACK_DEF( FT_UInt ) + t42_get_name_index( FT_Face face, /* T42_Face */ const FT_String* glyph_name ) { - FT_Int i; + T42_Face t42face = (T42_Face)face; + FT_Int i; - for ( i = 0; i < face->type1.num_glyphs; i++ ) + for ( i = 0; i < t42face->type1.num_glyphs; i++ ) { - FT_String* gname = face->type1.glyph_names[i]; + FT_String* gname = t42face->type1.glyph_names[i]; if ( glyph_name[0] == gname[0] && !ft_strcmp( glyph_name, gname ) ) - return (FT_UInt)ft_strtol( (const char *)face->type1.charstrings[i], - NULL, 10 ); + return (FT_UInt)ft_strtol( + (const char *)t42face->type1.charstrings[i], + NULL, + 10 ); } return 0; @@ -102,10 +110,13 @@ * */ - static const char* - t42_get_ps_font_name( T42_Face face ) + FT_CALLBACK_DEF( const char* ) + t42_get_ps_font_name( FT_Face face ) /* T42_Face */ { - return (const char*)face->type1.font_name; + T42_Face t42face = (T42_Face)face; + + + return (const char*)t42face->type1.font_name; } @@ -121,7 +132,7 @@ * */ - static FT_Error + FT_CALLBACK_DEF( FT_Error ) t42_ps_get_font_info( FT_Face face, PS_FontInfoRec* afont_info ) { @@ -131,7 +142,7 @@ } - static FT_Error + FT_CALLBACK_DEF( FT_Error ) t42_ps_get_font_extra( FT_Face face, PS_FontExtraRec* afont_extra ) { @@ -141,7 +152,7 @@ } - static FT_Int + FT_CALLBACK_DEF( FT_Int ) t42_ps_has_glyph_names( FT_Face face ) { FT_UNUSED( face ); -- cgit v1.2.3 From e05c056220972e84558c9bc712a9836ced870015 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 7 May 2023 08:29:15 +0200 Subject: [base] Signature fixes. --- src/base/ftbbox.c | 42 +++++++++++++++++++++++++++--------------- src/base/ftobjs.c | 20 +++++++++++++------- 2 files changed, 40 insertions(+), 22 deletions(-) diff --git a/src/base/ftbbox.c b/src/base/ftbbox.c index 7dd71882e..385fea404 100644 --- a/src/base/ftbbox.c +++ b/src/base/ftbbox.c @@ -82,10 +82,13 @@ * @Return: * Always 0. Needed for the interface only. */ - static int - BBox_Move_To( FT_Vector* to, - TBBox_Rec* user ) + FT_CALLBACK_DEF( int ) + BBox_Move_To( const FT_Vector* to, + void* user_ ) { + TBBox_Rec* user = (TBBox_Rec*)user_; + + FT_UPDATE_BBOX( to, user->bbox ); user->last = *to; @@ -116,10 +119,13 @@ * @Return: * Always 0. Needed for the interface only. */ - static int - BBox_Line_To( FT_Vector* to, - TBBox_Rec* user ) + FT_CALLBACK_DEF( int ) + BBox_Line_To( const FT_Vector* to, + void* user_ ) { + TBBox_Rec* user = (TBBox_Rec*)user_; + + user->last = *to; return 0; @@ -205,11 +211,14 @@ * In the case of a non-monotonous arc, we compute directly the * extremum coordinates, as it is sufficiently fast. */ - static int - BBox_Conic_To( FT_Vector* control, - FT_Vector* to, - TBBox_Rec* user ) + FT_CALLBACK_DEF( int ) + BBox_Conic_To( const FT_Vector* control, + const FT_Vector* to, + void* user_ ) { + TBBox_Rec* user = (TBBox_Rec*)user_; + + /* in case `to' is implicit and not included in bbox yet */ FT_UPDATE_BBOX( to, user->bbox ); @@ -410,12 +419,15 @@ * In the case of a non-monotonous arc, we don't compute directly * extremum coordinates, we subdivide instead. */ - static int - BBox_Cubic_To( FT_Vector* control1, - FT_Vector* control2, - FT_Vector* to, - TBBox_Rec* user ) + FT_CALLBACK_DEF( int ) + BBox_Cubic_To( const FT_Vector* control1, + const FT_Vector* control2, + const FT_Vector* to, + void* user_ ) { + TBBox_Rec* user = (TBBox_Rec*)user_; + + /* We don't need to check `to' since it is always an on-point, */ /* thus within the bbox. Only segments with an off-point outside */ /* the bbox can possibly reach new extreme values. */ diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index ad6ef0ae1..b7e89540e 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -1245,9 +1245,13 @@ /* destructor for sizes list */ static void destroy_size( FT_Memory memory, - FT_Size size, - FT_Driver driver ) + void* size_, + void* driver_ ) { + FT_Size size = (FT_Size)size_; + FT_Driver driver = (FT_Driver)driver_; + + /* finalize client-specific data */ if ( size->generic.finalizer ) size->generic.finalizer( size ); @@ -1293,10 +1297,12 @@ /* destructor for faces list */ static void destroy_face( FT_Memory memory, - FT_Face face, - FT_Driver driver ) + void* face_, + void* driver_ ) { - FT_Driver_Class clazz = driver->clazz; + FT_Face face = (FT_Face)face_; + FT_Driver driver = (FT_Driver)driver_; + FT_Driver_Class clazz = driver->clazz; /* discard auto-hinting data */ @@ -1310,7 +1316,7 @@ /* discard all sizes for this face */ FT_List_Finalize( &face->sizes_list, - (FT_List_Destructor)destroy_size, + destroy_size, memory, driver ); face->size = NULL; @@ -1346,7 +1352,7 @@ Destroy_Driver( FT_Driver driver ) { FT_List_Finalize( &driver->faces_list, - (FT_List_Destructor)destroy_face, + destroy_face, driver->root.memory, driver ); } -- cgit v1.2.3 From 95d635eab1b08a0051de07b6c33067d2c1984848 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 7 May 2023 08:34:32 +0200 Subject: [truetype] Signature fixes. --- src/truetype/ttinterp.c | 4 +++- src/truetype/ttinterp.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index 3b7b21cca..0ac0f9e12 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -7670,8 +7670,10 @@ /* documentation is in ttinterp.h */ FT_EXPORT_DEF( FT_Error ) - TT_RunIns( TT_ExecContext exc ) + TT_RunIns( void* exec ) { + TT_ExecContext exc = (TT_ExecContext)exec; + FT_ULong ins_counter = 0; /* executed instructions counter */ FT_ULong num_twilight_points; FT_UShort i; diff --git a/src/truetype/ttinterp.h b/src/truetype/ttinterp.h index 891e2123c..48d493af8 100644 --- a/src/truetype/ttinterp.h +++ b/src/truetype/ttinterp.h @@ -528,7 +528,7 @@ FT_BEGIN_HEADER * invoked by the TrueType debugger. */ FT_EXPORT( FT_Error ) - TT_RunIns( TT_ExecContext exec ); + TT_RunIns( void* exec ); FT_END_HEADER -- cgit v1.2.3 From 563f401127774940d2c5b2f32fd28ea9cbed7f2f Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 7 May 2023 08:50:44 +0200 Subject: * src/type1/t1load.c: Signature fixes. --- src/type1/t1load.c | 146 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 85 insertions(+), 61 deletions(-) diff --git a/src/type1/t1load.c b/src/type1/t1load.c index 96adba4ab..b292a3cc0 100644 --- a/src/type1/t1load.c +++ b/src/type1/t1load.c @@ -73,7 +73,8 @@ #ifdef FT_CONFIG_OPTION_INCREMENTAL -#define IS_INCREMENTAL FT_BOOL( face->root.internal->incremental_interface ) +#define IS_INCREMENTAL \ + FT_BOOL( FT_FACE( face )->internal->incremental_interface ) #else #define IS_INCREMENTAL 0 #endif @@ -760,14 +761,16 @@ static void - parse_blend_axis_types( T1_Face face, - T1_Loader loader ) + parse_blend_axis_types( FT_Face face, /* T1_Face */ + void* loader_ ) { + T1_Face t1face = (T1_Face)face; + T1_Loader loader = (T1_Loader)loader_; T1_TokenRec axis_tokens[T1_MAX_MM_AXIS]; FT_Int n, num_axis; - FT_Error error = FT_Err_Ok; + FT_Error error = FT_Err_Ok; PS_Blend blend; - FT_Memory memory; + FT_Memory memory = FT_FACE_MEMORY( face ); /* take an array of objects */ @@ -787,14 +790,13 @@ } /* allocate blend if necessary */ - error = t1_allocate_blend( face, 0, (FT_UInt)num_axis ); + error = t1_allocate_blend( t1face, 0, (FT_UInt)num_axis ); if ( error ) goto Exit; FT_TRACE4(( " [" )); - blend = face->blend; - memory = face->root.memory; + blend = t1face->blend; /* each token is an immediate containing the name of the axis */ for ( n = 0; n < num_axis; n++ ) @@ -842,14 +844,16 @@ static void - parse_blend_design_positions( T1_Face face, - T1_Loader loader ) + parse_blend_design_positions( FT_Face face, /* T1_Face */ + void* loader_ ) { + T1_Face t1face = (T1_Face)face; + T1_Loader loader = (T1_Loader)loader_; T1_TokenRec design_tokens[T1_MAX_MM_DESIGNS]; FT_Int num_designs; FT_Int num_axis = 0; /* make compiler happy */ T1_Parser parser = &loader->parser; - FT_Memory memory = face->root.memory; + FT_Memory memory = FT_FACE_MEMORY( face ); FT_Error error = FT_Err_Ok; FT_Fixed* design_pos[T1_MAX_MM_DESIGNS]; @@ -907,7 +911,7 @@ } num_axis = n_axis; - error = t1_allocate_blend( face, + error = t1_allocate_blend( t1face, (FT_UInt)num_designs, (FT_UInt)num_axis ); if ( error ) @@ -948,7 +952,7 @@ loader->parser.root.limit = old_limit; /* a valid BlendDesignPosition has been parsed */ - blend = face->blend; + blend = t1face->blend; if ( blend->design_pos[0] ) FT_FREE( blend->design_pos[0] ); @@ -966,9 +970,11 @@ static void - parse_blend_design_map( T1_Face face, - T1_Loader loader ) + parse_blend_design_map( FT_Face face, /* T1_Face */ + void* loader_ ) { + T1_Face t1face = (T1_Face)face; + T1_Loader loader = (T1_Loader)loader_; FT_Error error = FT_Err_Ok; T1_Parser parser = &loader->parser; PS_Blend blend; @@ -976,7 +982,7 @@ FT_Int n, num_axis; FT_Byte* old_cursor; FT_Byte* old_limit; - FT_Memory memory = face->root.memory; + FT_Memory memory = FT_FACE_MEMORY( face ); T1_ToTokenArray( parser, axis_tokens, @@ -997,10 +1003,10 @@ old_cursor = parser->root.cursor; old_limit = parser->root.limit; - error = t1_allocate_blend( face, 0, (FT_UInt)num_axis ); + error = t1_allocate_blend( t1face, 0, (FT_UInt)num_axis ); if ( error ) goto Exit; - blend = face->blend; + blend = t1face->blend; FT_TRACE4(( " [" )); @@ -1075,15 +1081,17 @@ static void - parse_weight_vector( T1_Face face, - T1_Loader loader ) + parse_weight_vector( FT_Face face, /* T1_Face */ + void* loader_ ) { + T1_Face t1face = (T1_Face)face; + T1_Loader loader = (T1_Loader)loader_; T1_TokenRec design_tokens[T1_MAX_MM_DESIGNS]; FT_Int num_designs; FT_Error error = FT_Err_Ok; - FT_Memory memory = face->root.memory; + FT_Memory memory = FT_FACE_MEMORY( face ); T1_Parser parser = &loader->parser; - PS_Blend blend = face->blend; + PS_Blend blend = t1face->blend; T1_Token token; FT_Int n; FT_Byte* old_cursor; @@ -1108,10 +1116,10 @@ if ( !blend || !blend->num_designs ) { - error = t1_allocate_blend( face, (FT_UInt)num_designs, 0 ); + error = t1_allocate_blend( t1face, (FT_UInt)num_designs, 0 ); if ( error ) goto Exit; - blend = face->blend; + blend = t1face->blend; } else if ( blend->num_designs != (FT_UInt)num_designs ) { @@ -1159,11 +1167,15 @@ /* e.g., /BuildCharArray [0 0 0 0 0 0 0 0] def */ /* we're only interested in the number of array elements */ static void - parse_buildchar( T1_Face face, - T1_Loader loader ) + parse_buildchar( FT_Face face, /* T1_Face */ + void* loader_ ) { - face->len_buildchar = (FT_UInt)T1_ToFixedArray( &loader->parser, - 0, NULL, 0 ); + T1_Face t1face = (T1_Face)face; + T1_Loader loader = (T1_Loader)loader_; + + + t1face->len_buildchar = (FT_UInt)T1_ToFixedArray( &loader->parser, + 0, NULL, 0 ); #ifdef FT_DEBUG_LEVEL_TRACE { @@ -1171,7 +1183,7 @@ FT_TRACE4(( " [" )); - for ( i = 0; i < face->len_buildchar; i++ ) + for ( i = 0; i < t1face->len_buildchar; i++ ) FT_TRACE4(( " 0" )); FT_TRACE4(( "]\n" )); @@ -1321,9 +1333,10 @@ static void - parse_private( T1_Face face, - T1_Loader loader ) + parse_private( FT_Face face, + void* loader_ ) { + T1_Loader loader = (T1_Loader)loader_; FT_UNUSED( face ); loader->keywords_encountered |= T1_PRIVATE; @@ -1387,13 +1400,14 @@ /* and `/CharStrings' dictionaries. */ static void - t1_parse_font_matrix( T1_Face face, - T1_Loader loader ) + t1_parse_font_matrix( FT_Face face, /* T1_Face */ + void* loader_ ) { + T1_Face t1face = (T1_Face)face; + T1_Loader loader = (T1_Loader)loader_; T1_Parser parser = &loader->parser; - FT_Matrix* matrix = &face->type1.font_matrix; - FT_Vector* offset = &face->type1.font_offset; - FT_Face root = (FT_Face)&face->root; + FT_Matrix* matrix = &t1face->type1.font_matrix; + FT_Vector* offset = &t1face->type1.font_offset; FT_Fixed temp[6]; FT_Fixed temp_scale; FT_Int result; @@ -1429,7 +1443,7 @@ if ( temp_scale != 0x10000L ) { /* set units per EM based on FontMatrix values */ - root->units_per_EM = (FT_UShort)FT_DivFix( 1000, temp_scale ); + face->units_per_EM = (FT_UShort)FT_DivFix( 1000, temp_scale ); temp[0] = FT_DivFix( temp[0], temp_scale ); temp[1] = FT_DivFix( temp[1], temp_scale ); @@ -1457,14 +1471,16 @@ static void - parse_encoding( T1_Face face, - T1_Loader loader ) + parse_encoding( FT_Face face, /* T1_Face */ + void* loader_ ) { + T1_Face t1face = (T1_Face)face; + T1_Loader loader = (T1_Loader)loader_; T1_Parser parser = &loader->parser; FT_Byte* cur; FT_Byte* limit = parser->root.limit; - PSAux_Service psaux = (PSAux_Service)face->psaux; + PSAux_Service psaux = (PSAux_Service)t1face->psaux; T1_Skip_Spaces( parser ); @@ -1480,7 +1496,7 @@ /* and we must load it now */ if ( ft_isdigit( *cur ) || *cur == '[' ) { - T1_Encoding encode = &face->type1.encoding; + T1_Encoding encode = &t1face->type1.encoding; FT_Int count, array_size, n; PS_Table char_table = &loader->encoding_table; FT_Memory memory = parser->root.memory; @@ -1662,7 +1678,7 @@ FT_TRACE4(( "]\n" )); #endif - face->type1.encoding_type = T1_ENCODING_TYPE_ARRAY; + t1face->type1.encoding_type = T1_ENCODING_TYPE_ARRAY; parser->root.cursor = cur; } @@ -1673,21 +1689,21 @@ if ( cur + 17 < limit && ft_strncmp( (const char*)cur, "StandardEncoding", 16 ) == 0 ) { - face->type1.encoding_type = T1_ENCODING_TYPE_STANDARD; + t1face->type1.encoding_type = T1_ENCODING_TYPE_STANDARD; FT_TRACE4(( " StandardEncoding\n" )); } else if ( cur + 15 < limit && ft_strncmp( (const char*)cur, "ExpertEncoding", 14 ) == 0 ) { - face->type1.encoding_type = T1_ENCODING_TYPE_EXPERT; + t1face->type1.encoding_type = T1_ENCODING_TYPE_EXPERT; FT_TRACE4(( " ExpertEncoding\n" )); } else if ( cur + 18 < limit && ft_strncmp( (const char*)cur, "ISOLatin1Encoding", 17 ) == 0 ) { - face->type1.encoding_type = T1_ENCODING_TYPE_ISOLATIN1; + t1face->type1.encoding_type = T1_ENCODING_TYPE_ISOLATIN1; FT_TRACE4(( " ISOLatin1Encoding\n" )); } @@ -1701,9 +1717,11 @@ static void - parse_subrs( T1_Face face, - T1_Loader loader ) + parse_subrs( FT_Face face, /* T1_Face */ + void* loader_ ) { + T1_Face t1face = (T1_Face)face; + T1_Loader loader = (T1_Loader)loader_; T1_Parser parser = &loader->parser; PS_Table table = &loader->subrs; FT_Memory memory = parser->root.memory; @@ -1711,7 +1729,7 @@ FT_Int num_subrs; FT_UInt count; - PSAux_Service psaux = (PSAux_Service)face->psaux; + PSAux_Service psaux = (PSAux_Service)t1face->psaux; T1_Skip_Spaces( parser ); @@ -1843,7 +1861,7 @@ /* */ /* thanks to Tom Kacvinsky for pointing this out */ /* */ - if ( face->type1.private_dict.lenIV >= 0 ) + if ( t1face->type1.private_dict.lenIV >= 0 ) { FT_Byte* temp = NULL; @@ -1851,7 +1869,7 @@ /* some fonts define empty subr records -- this is not totally */ /* compliant to the specification (which says they should at */ /* least contain a `return'), but we support them anyway */ - if ( size < (FT_ULong)face->type1.private_dict.lenIV ) + if ( size < (FT_ULong)t1face->type1.private_dict.lenIV ) { error = FT_THROW( Invalid_File_Format ); goto Fail; @@ -1862,9 +1880,11 @@ goto Fail; FT_MEM_COPY( temp, base, size ); psaux->t1_decrypt( temp, size, 4330 ); - size -= (FT_ULong)face->type1.private_dict.lenIV; - error = T1_Add_Table( table, (FT_Int)idx, - temp + face->type1.private_dict.lenIV, size ); + size -= (FT_ULong)t1face->type1.private_dict.lenIV; + error = T1_Add_Table( table, + (FT_Int)idx, + temp + t1face->type1.private_dict.lenIV, + size ); FT_FREE( temp ); } else @@ -1896,9 +1916,11 @@ static void - parse_charstrings( T1_Face face, - T1_Loader loader ) + parse_charstrings( FT_Face face, /* T1_Face */ + void* loader_ ) { + T1_Face t1face = (T1_Face)face; + T1_Loader loader = (T1_Loader)loader_; T1_Parser parser = &loader->parser; PS_Table code_table = &loader->charstrings; PS_Table name_table = &loader->glyph_names; @@ -1906,7 +1928,7 @@ FT_Memory memory = parser->root.memory; FT_Error error; - PSAux_Service psaux = (PSAux_Service)face->psaux; + PSAux_Service psaux = (PSAux_Service)t1face->psaux; FT_Byte* cur = parser->root.cursor; FT_Byte* limit = parser->root.limit; @@ -2055,13 +2077,13 @@ notdef_found = 1; } - if ( face->type1.private_dict.lenIV >= 0 && + if ( t1face->type1.private_dict.lenIV >= 0 && n < num_glyphs + TABLE_EXTEND ) { FT_Byte* temp = NULL; - if ( size <= (FT_ULong)face->type1.private_dict.lenIV ) + if ( size <= (FT_ULong)t1face->type1.private_dict.lenIV ) { error = FT_THROW( Invalid_File_Format ); goto Fail; @@ -2072,9 +2094,11 @@ goto Fail; FT_MEM_COPY( temp, base, size ); psaux->t1_decrypt( temp, size, 4330 ); - size -= (FT_ULong)face->type1.private_dict.lenIV; - error = T1_Add_Table( code_table, n, - temp + face->type1.private_dict.lenIV, size ); + size -= (FT_ULong)t1face->type1.private_dict.lenIV; + error = T1_Add_Table( code_table, + n, + temp + t1face->type1.private_dict.lenIV, + size ); FT_FREE( temp ); } else -- cgit v1.2.3 From 4a28ff3db8182bb6e4bcd0e58966ca89f295b8db Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 7 May 2023 09:14:27 +0200 Subject: * src/cff/cffcmap.c: Signature fixes. --- src/cff/cffcmap.c | 81 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 46 insertions(+), 35 deletions(-) diff --git a/src/cff/cffcmap.c b/src/cff/cffcmap.c index 94077c596..10d287bc8 100644 --- a/src/cff/cffcmap.c +++ b/src/cff/cffcmap.c @@ -32,9 +32,10 @@ /*************************************************************************/ FT_CALLBACK_DEF( FT_Error ) - cff_cmap_encoding_init( CFF_CMapStd cmap, - FT_Pointer pointer ) + cff_cmap_encoding_init( FT_CMap cmap, + FT_Pointer pointer ) { + CFF_CMapStd cffcmap = (CFF_CMapStd)cmap; TT_Face face = (TT_Face)FT_CMAP_FACE( cmap ); CFF_Font cff = (CFF_Font)face->extra.data; CFF_Encoding encoding = &cff->encoding; @@ -42,44 +43,49 @@ FT_UNUSED( pointer ); - cmap->gids = encoding->codes; + cffcmap->gids = encoding->codes; return 0; } FT_CALLBACK_DEF( void ) - cff_cmap_encoding_done( CFF_CMapStd cmap ) + cff_cmap_encoding_done( FT_CMap cmap ) { - cmap->gids = NULL; + CFF_CMapStd cffcmap = (CFF_CMapStd)cmap; + + + cffcmap->gids = NULL; } FT_CALLBACK_DEF( FT_UInt ) - cff_cmap_encoding_char_index( CFF_CMapStd cmap, - FT_UInt32 char_code ) + cff_cmap_encoding_char_index( FT_CMap cmap, + FT_UInt32 char_code ) { - FT_UInt result = 0; + CFF_CMapStd cffcmap = (CFF_CMapStd)cmap; + FT_UInt result = 0; if ( char_code < 256 ) - result = cmap->gids[char_code]; + result = cffcmap->gids[char_code]; return result; } FT_CALLBACK_DEF( FT_UInt ) - cff_cmap_encoding_char_next( CFF_CMapStd cmap, - FT_UInt32 *pchar_code ) + cff_cmap_encoding_char_next( FT_CMap cmap, + FT_UInt32 *pchar_code ) { - FT_UInt result = 0; - FT_UInt32 char_code = *pchar_code; + CFF_CMapStd cffcmap = (CFF_CMapStd)cmap; + FT_UInt result = 0; + FT_UInt32 char_code = *pchar_code; while ( char_code < 255 ) { - result = cmap->gids[++char_code]; + result = cffcmap->gids[++char_code]; if ( result ) { *pchar_code = char_code; @@ -118,9 +124,10 @@ /*************************************************************************/ FT_CALLBACK_DEF( const char* ) - cff_sid_to_glyph_name( TT_Face face, + cff_sid_to_glyph_name( void* face_, /* TT_Face */ FT_UInt idx ) { + TT_Face face = (TT_Face)face_; CFF_Font cff = (CFF_Font)face->extra.data; CFF_Charset charset = &cff->charset; FT_UInt sid = charset->sids[idx]; @@ -131,14 +138,15 @@ FT_CALLBACK_DEF( FT_Error ) - cff_cmap_unicode_init( PS_Unicodes unicodes, + cff_cmap_unicode_init( FT_CMap cmap, /* PS_Unicodes */ FT_Pointer pointer ) { - TT_Face face = (TT_Face)FT_CMAP_FACE( unicodes ); - FT_Memory memory = FT_FACE_MEMORY( face ); - CFF_Font cff = (CFF_Font)face->extra.data; - CFF_Charset charset = &cff->charset; - FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)cff->psnames; + PS_Unicodes unicodes = (PS_Unicodes)cmap; + TT_Face face = (TT_Face)FT_CMAP_FACE( cmap ); + FT_Memory memory = FT_FACE_MEMORY( face ); + CFF_Font cff = (CFF_Font)face->extra.data; + CFF_Charset charset = &cff->charset; + FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)cff->psnames; FT_UNUSED( pointer ); @@ -154,17 +162,18 @@ return psnames->unicodes_init( memory, unicodes, cff->num_glyphs, - (PS_GetGlyphNameFunc)&cff_sid_to_glyph_name, + &cff_sid_to_glyph_name, (PS_FreeGlyphNameFunc)NULL, (FT_Pointer)face ); } FT_CALLBACK_DEF( void ) - cff_cmap_unicode_done( PS_Unicodes unicodes ) + cff_cmap_unicode_done( FT_CMap cmap ) /* PS_Unicodes */ { - FT_Face face = FT_CMAP_FACE( unicodes ); - FT_Memory memory = FT_FACE_MEMORY( face ); + PS_Unicodes unicodes = (PS_Unicodes)cmap; + FT_Face face = FT_CMAP_FACE( cmap ); + FT_Memory memory = FT_FACE_MEMORY( face ); FT_FREE( unicodes->maps ); @@ -173,12 +182,13 @@ FT_CALLBACK_DEF( FT_UInt ) - cff_cmap_unicode_char_index( PS_Unicodes unicodes, - FT_UInt32 char_code ) + cff_cmap_unicode_char_index( FT_CMap cmap, /* PS_Unicodes */ + FT_UInt32 char_code ) { - TT_Face face = (TT_Face)FT_CMAP_FACE( unicodes ); - CFF_Font cff = (CFF_Font)face->extra.data; - FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)cff->psnames; + PS_Unicodes unicodes = (PS_Unicodes)cmap; + TT_Face face = (TT_Face)FT_CMAP_FACE( cmap ); + CFF_Font cff = (CFF_Font)face->extra.data; + FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)cff->psnames; return psnames->unicodes_char_index( unicodes, char_code ); @@ -186,12 +196,13 @@ FT_CALLBACK_DEF( FT_UInt ) - cff_cmap_unicode_char_next( PS_Unicodes unicodes, - FT_UInt32 *pchar_code ) + cff_cmap_unicode_char_next( FT_CMap cmap, /* PS_Unicodes */ + FT_UInt32 *pchar_code ) { - TT_Face face = (TT_Face)FT_CMAP_FACE( unicodes ); - CFF_Font cff = (CFF_Font)face->extra.data; - FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)cff->psnames; + PS_Unicodes unicodes = (PS_Unicodes)cmap; + TT_Face face = (TT_Face)FT_CMAP_FACE( cmap ); + CFF_Font cff = (CFF_Font)face->extra.data; + FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)cff->psnames; return psnames->unicodes_char_next( unicodes, pchar_code ); -- cgit v1.2.3 From 3297a7a9e0d06996d566029bd3aaa69c2eeff353 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 7 May 2023 15:23:46 +0200 Subject: * src/cid/cidload.c: Signature fixes. --- src/cid/cidload.c | 51 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/src/cid/cidload.c b/src/cid/cidload.c index 26daa5da7..a7da8ea39 100644 --- a/src/cid/cidload.c +++ b/src/cid/cidload.c @@ -155,23 +155,24 @@ FT_CALLBACK_DEF( void ) - cid_parse_font_matrix( CID_Face face, - CID_Parser* parser ) + cid_parse_font_matrix( FT_Face face, /* CID_Face */ + void* parser_ ) { + CID_Face cidface = (CID_Face)face; + CID_Parser* parser = (CID_Parser*)parser_; CID_FaceDict dict; - FT_Face root = (FT_Face)&face->root; FT_Fixed temp[6]; FT_Fixed temp_scale; - if ( parser->num_dict < face->cid.num_dicts ) + if ( parser->num_dict < cidface->cid.num_dicts ) { FT_Matrix* matrix; FT_Vector* offset; FT_Int result; - dict = face->cid.font_dicts + parser->num_dict; + dict = cidface->cid.font_dicts + parser->num_dict; matrix = &dict->font_matrix; offset = &dict->font_offset; @@ -204,7 +205,7 @@ if ( temp_scale != 0x10000L ) { /* set units per EM based on FontMatrix values */ - root->units_per_EM = (FT_UShort)FT_DivFix( 1000, temp_scale ); + face->units_per_EM = (FT_UShort)FT_DivFix( 1000, temp_scale ); temp[0] = FT_DivFix( temp[0], temp_scale ); temp[1] = FT_DivFix( temp[1], temp_scale ); @@ -237,13 +238,15 @@ FT_CALLBACK_DEF( void ) - parse_fd_array( CID_Face face, - CID_Parser* parser ) + parse_fd_array( FT_Face face, /* CID_Face */ + void* parser_ ) { - CID_FaceInfo cid = &face->cid; - FT_Memory memory = face->root.memory; - FT_Stream stream = parser->stream; - FT_Error error = FT_Err_Ok; + CID_Face cidface = (CID_Face)face; + CID_Parser* parser = (CID_Parser*)parser_; + CID_FaceInfo cid = &cidface->cid; + FT_Memory memory = FT_FACE_MEMORY( face ); + FT_Stream stream = parser->stream; + FT_Error error = FT_Err_Ok; FT_Long num_dicts, max_dicts; @@ -313,18 +316,20 @@ /* By mistake, `expansion_factor' appears both in PS_PrivateRec */ /* and CID_FaceDictRec (both are public header files and can't */ - /* changed). We simply copy the value. */ + /* be thus changed). We simply copy the value. */ FT_CALLBACK_DEF( void ) - parse_expansion_factor( CID_Face face, - CID_Parser* parser ) + parse_expansion_factor( FT_Face face, /* CID_Face */ + void* parser_ ) { + CID_Face cidface = (CID_Face)face; + CID_Parser* parser = (CID_Parser*)parser_; CID_FaceDict dict; - if ( parser->num_dict < face->cid.num_dicts ) + if ( parser->num_dict < cidface->cid.num_dicts ) { - dict = face->cid.font_dicts + parser->num_dict; + dict = cidface->cid.font_dicts + parser->num_dict; dict->expansion_factor = cid_parser_to_fixed( parser, 0 ); dict->private_dict.expansion_factor = dict->expansion_factor; @@ -341,11 +346,15 @@ /* to catch it for producing better trace output. */ FT_CALLBACK_DEF( void ) - parse_font_name( CID_Face face, - CID_Parser* parser ) + parse_font_name( FT_Face face, /* CID_Face */ + void* parser_ ) { #ifdef FT_DEBUG_LEVEL_TRACE - if ( parser->num_dict < face->cid.num_dicts ) + CID_Face cidface = (CID_Face)face; + CID_Parser* parser = (CID_Parser*)parser_; + + + if ( parser->num_dict < cidface->cid.num_dicts ) { T1_TokenRec token; FT_UInt len; @@ -361,7 +370,7 @@ } #else FT_UNUSED( face ); - FT_UNUSED( parser ); + FT_UNUSED( parser_ ); #endif return; -- cgit v1.2.3 From 19aca9666e3cbb56e5e32e6857273cc46a7e9aa5 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 7 May 2023 15:57:06 +0200 Subject: [pfr] Signature fixes. --- src/pfr/pfrcmap.c | 46 +++++++++++++++++++++++------------------- src/pfr/pfrload.c | 60 +++++++++++++++++++++++++++++-------------------------- 2 files changed, 58 insertions(+), 48 deletions(-) diff --git a/src/pfr/pfrcmap.c b/src/pfr/pfrcmap.c index b49873694..08fe41d54 100644 --- a/src/pfr/pfrcmap.c +++ b/src/pfr/pfrcmap.c @@ -24,17 +24,18 @@ FT_CALLBACK_DEF( FT_Error ) - pfr_cmap_init( PFR_CMap cmap, + pfr_cmap_init( FT_CMap cmap, /* PFR_CMap */ FT_Pointer pointer ) { - FT_Error error = FT_Err_Ok; - PFR_Face face = (PFR_Face)FT_CMAP_FACE( cmap ); + PFR_CMap pfrcmap = (PFR_CMap)cmap; + FT_Error error = FT_Err_Ok; + PFR_Face face = (PFR_Face)FT_CMAP_FACE( cmap ); FT_UNUSED( pointer ); - cmap->num_chars = face->phy_font.num_chars; - cmap->chars = face->phy_font.chars; + pfrcmap->num_chars = face->phy_font.num_chars; + pfrcmap->chars = face->phy_font.chars; /* just for safety, check that the character entries are correctly */ /* sorted in increasing character code order */ @@ -42,9 +43,9 @@ FT_UInt n; - for ( n = 1; n < cmap->num_chars; n++ ) + for ( n = 1; n < pfrcmap->num_chars; n++ ) { - if ( cmap->chars[n - 1].char_code >= cmap->chars[n].char_code ) + if ( pfrcmap->chars[n - 1].char_code >= pfrcmap->chars[n].char_code ) { error = FT_THROW( Invalid_Table ); goto Exit; @@ -58,26 +59,30 @@ FT_CALLBACK_DEF( void ) - pfr_cmap_done( PFR_CMap cmap ) + pfr_cmap_done( FT_CMap cmap ) /* PFR_CMap */ { - cmap->chars = NULL; - cmap->num_chars = 0; + PFR_CMap pfrcmap = (PFR_CMap)cmap; + + + pfrcmap->chars = NULL; + pfrcmap->num_chars = 0; } FT_CALLBACK_DEF( FT_UInt ) - pfr_cmap_char_index( PFR_CMap cmap, + pfr_cmap_char_index( FT_CMap cmap, /* PFR_CMap */ FT_UInt32 char_code ) { - FT_UInt min = 0; - FT_UInt max = cmap->num_chars; - FT_UInt mid = min + ( max - min ) / 2; + PFR_CMap pfrcmap = (PFR_CMap)cmap; + FT_UInt min = 0; + FT_UInt max = pfrcmap->num_chars; + FT_UInt mid = min + ( max - min ) / 2; PFR_Char gchar; while ( min < max ) { - gchar = cmap->chars + mid; + gchar = pfrcmap->chars + mid; if ( gchar->char_code == char_code ) return mid + 1; @@ -97,9 +102,10 @@ FT_CALLBACK_DEF( FT_UInt ) - pfr_cmap_char_next( PFR_CMap cmap, + pfr_cmap_char_next( FT_CMap cmap, /* PFR_CMap */ FT_UInt32 *pchar_code ) { + PFR_CMap pfrcmap = (PFR_CMap)cmap; FT_UInt result = 0; FT_UInt32 char_code = *pchar_code + 1; @@ -107,14 +113,14 @@ Restart: { FT_UInt min = 0; - FT_UInt max = cmap->num_chars; + FT_UInt max = pfrcmap->num_chars; FT_UInt mid = min + ( max - min ) / 2; PFR_Char gchar; while ( min < max ) { - gchar = cmap->chars + mid; + gchar = pfrcmap->chars + mid; if ( gchar->char_code == char_code ) { @@ -143,9 +149,9 @@ /* we didn't find it, but we have a pair just above it */ char_code = 0; - if ( min < cmap->num_chars ) + if ( min < pfrcmap->num_chars ) { - gchar = cmap->chars + min; + gchar = pfrcmap->chars + min; result = min; if ( result != 0 ) { diff --git a/src/pfr/pfrload.c b/src/pfr/pfrload.c index de85ee6aa..856a5942f 100644 --- a/src/pfr/pfrload.c +++ b/src/pfr/pfrload.c @@ -449,15 +449,16 @@ /* load bitmap strikes lists */ FT_CALLBACK_DEF( FT_Error ) - pfr_extra_item_load_bitmap_info( FT_Byte* p, - FT_Byte* limit, - PFR_PhyFont phy_font ) + pfr_extra_item_load_bitmap_info( FT_Byte* p, + FT_Byte* limit, + void* phy_font_ ) { - FT_Memory memory = phy_font->memory; - PFR_Strike strike; - FT_UInt flags0; - FT_UInt n, count, size1; - FT_Error error = FT_Err_Ok; + PFR_PhyFont phy_font = (PFR_PhyFont)phy_font_; + FT_Memory memory = phy_font->memory; + PFR_Strike strike; + FT_UInt flags0; + FT_UInt n, count, size1; + FT_Error error = FT_Err_Ok; PFR_CHECK( 5 ); @@ -549,13 +550,14 @@ * family. */ FT_CALLBACK_DEF( FT_Error ) - pfr_extra_item_load_font_id( FT_Byte* p, - FT_Byte* limit, - PFR_PhyFont phy_font ) + pfr_extra_item_load_font_id( FT_Byte* p, + FT_Byte* limit, + void* phy_font_ ) { - FT_Error error = FT_Err_Ok; - FT_Memory memory = phy_font->memory; - FT_UInt len = (FT_UInt)( limit - p ); + PFR_PhyFont phy_font = (PFR_PhyFont)phy_font_; + FT_Error error = FT_Err_Ok; + FT_Memory memory = phy_font->memory; + FT_UInt len = (FT_UInt)( limit - p ); if ( phy_font->font_id ) @@ -575,14 +577,15 @@ /* load stem snap tables */ FT_CALLBACK_DEF( FT_Error ) - pfr_extra_item_load_stem_snaps( FT_Byte* p, - FT_Byte* limit, - PFR_PhyFont phy_font ) + pfr_extra_item_load_stem_snaps( FT_Byte* p, + FT_Byte* limit, + void* phy_font_ ) { - FT_UInt count, num_vert, num_horz; - FT_Int* snaps = NULL; - FT_Error error = FT_Err_Ok; - FT_Memory memory = phy_font->memory; + PFR_PhyFont phy_font = (PFR_PhyFont)phy_font_; + FT_UInt count, num_vert, num_horz; + FT_Int* snaps = NULL; + FT_Error error = FT_Err_Ok; + FT_Memory memory = phy_font->memory; if ( phy_font->vertical.stem_snaps ) @@ -619,10 +622,11 @@ /* load kerning pair data */ FT_CALLBACK_DEF( FT_Error ) - pfr_extra_item_load_kerning_pairs( FT_Byte* p, - FT_Byte* limit, - PFR_PhyFont phy_font ) + pfr_extra_item_load_kerning_pairs( FT_Byte* p, + FT_Byte* limit, + void* phy_font_ ) { + PFR_PhyFont phy_font = (PFR_PhyFont)phy_font_; PFR_KernItem item = NULL; FT_Error error = FT_Err_Ok; FT_Memory memory = phy_font->memory; @@ -715,10 +719,10 @@ static const PFR_ExtraItemRec pfr_phy_font_extra_items[] = { - { 1, (PFR_ExtraItem_ParseFunc)pfr_extra_item_load_bitmap_info }, - { 2, (PFR_ExtraItem_ParseFunc)pfr_extra_item_load_font_id }, - { 3, (PFR_ExtraItem_ParseFunc)pfr_extra_item_load_stem_snaps }, - { 4, (PFR_ExtraItem_ParseFunc)pfr_extra_item_load_kerning_pairs }, + { 1, pfr_extra_item_load_bitmap_info }, + { 2, pfr_extra_item_load_font_id }, + { 3, pfr_extra_item_load_stem_snaps }, + { 4, pfr_extra_item_load_kerning_pairs }, { 0, NULL } }; -- cgit v1.2.3 From 394c4de988aaf0332769db23ec45e0d3e724a60f Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 7 May 2023 16:25:37 +0200 Subject: * src/type42/t42parse.c: Signature fixes. --- src/type42/t42parse.c | 92 ++++++++++++++++++++++++++++----------------------- 1 file changed, 50 insertions(+), 42 deletions(-) diff --git a/src/type42/t42parse.c b/src/type42/t42parse.c index 6d765c8c1..764bbd4c4 100644 --- a/src/type42/t42parse.c +++ b/src/type42/t42parse.c @@ -34,19 +34,19 @@ static void - t42_parse_font_matrix( T42_Face face, - T42_Loader loader ); + t42_parse_font_matrix( FT_Face face, + void* loader_ ); static void - t42_parse_encoding( T42_Face face, - T42_Loader loader ); + t42_parse_encoding( FT_Face face, + void* loader_ ); static void - t42_parse_charstrings( T42_Face face, - T42_Loader loader ); + t42_parse_charstrings( FT_Face face, + void* loader_ ); static void - t42_parse_sfnts( T42_Face face, - T42_Loader loader ); + t42_parse_sfnts( FT_Face face, + void* loader_ ); /* as Type42 fonts have no Private dict, */ @@ -241,12 +241,14 @@ static void - t42_parse_font_matrix( T42_Face face, - T42_Loader loader ) + t42_parse_font_matrix( FT_Face face, /* T42_Face */ + void* loader_ ) { - T42_Parser parser = &loader->parser; - FT_Matrix* matrix = &face->type1.font_matrix; - FT_Vector* offset = &face->type1.font_offset; + T42_Face t42face = (T42_Face)face; + T42_Loader loader = (T42_Loader)loader_; + T42_Parser parser = &loader->parser; + FT_Matrix* matrix = &t42face->type1.font_matrix; + FT_Vector* offset = &t42face->type1.font_offset; FT_Fixed temp[6]; FT_Fixed temp_scale; FT_Int result; @@ -299,14 +301,16 @@ static void - t42_parse_encoding( T42_Face face, - T42_Loader loader ) + t42_parse_encoding( FT_Face face, + void* loader_ ) { - T42_Parser parser = &loader->parser; + T42_Face t42face = (T42_Face)face; + T42_Loader loader = (T42_Loader)loader_; + T42_Parser parser = &loader->parser; FT_Byte* cur; - FT_Byte* limit = parser->root.limit; + FT_Byte* limit = parser->root.limit; - PSAux_Service psaux = (PSAux_Service)face->psaux; + PSAux_Service psaux = (PSAux_Service)t42face->psaux; T1_Skip_Spaces( parser ); @@ -322,7 +326,7 @@ /* and we must load it now */ if ( ft_isdigit( *cur ) || *cur == '[' ) { - T1_Encoding encode = &face->type1.encoding; + T1_Encoding encode = &t42face->type1.encoding; FT_Int count, n; PS_Table char_table = &loader->encoding_table; FT_Memory memory = parser->root.memory; @@ -493,8 +497,8 @@ T1_Skip_Spaces( parser ); } - face->type1.encoding_type = T1_ENCODING_TYPE_ARRAY; - parser->root.cursor = cur; + t42face->type1.encoding_type = T1_ENCODING_TYPE_ARRAY; + parser->root.cursor = cur; } /* Otherwise, we should have either `StandardEncoding', */ @@ -503,15 +507,15 @@ { if ( cur + 17 < limit && ft_strncmp( (const char*)cur, "StandardEncoding", 16 ) == 0 ) - face->type1.encoding_type = T1_ENCODING_TYPE_STANDARD; + t42face->type1.encoding_type = T1_ENCODING_TYPE_STANDARD; else if ( cur + 15 < limit && ft_strncmp( (const char*)cur, "ExpertEncoding", 14 ) == 0 ) - face->type1.encoding_type = T1_ENCODING_TYPE_EXPERT; + t42face->type1.encoding_type = T1_ENCODING_TYPE_EXPERT; else if ( cur + 18 < limit && ft_strncmp( (const char*)cur, "ISOLatin1Encoding", 17 ) == 0 ) - face->type1.encoding_type = T1_ENCODING_TYPE_ISOLATIN1; + t42face->type1.encoding_type = T1_ENCODING_TYPE_ISOLATIN1; else parser->root.error = FT_ERR( Ignore ); @@ -529,9 +533,11 @@ static void - t42_parse_sfnts( T42_Face face, - T42_Loader loader ) + t42_parse_sfnts( FT_Face face, + void* loader_ ) { + T42_Face t42face = (T42_Face)face; + T42_Loader loader = (T42_Loader)loader_; T42_Parser parser = &loader->parser; FT_Memory memory = parser->root.memory; FT_Byte* cur; @@ -548,8 +554,8 @@ T42_Load_Status status; /** There should only be one sfnts array, but free any previous. */ - FT_FREE( face->ttf_data ); - face->ttf_size = 0; + FT_FREE( t42face->ttf_data ); + t42face->ttf_size = 0; /* The format is */ /* */ @@ -580,7 +586,7 @@ old_string_size = 0; ttf_count = 0; ttf_reserved = 12; - if ( FT_QALLOC( face->ttf_data, ttf_reserved ) ) + if ( FT_QALLOC( t42face->ttf_data, ttf_reserved ) ) goto Fail; FT_TRACE2(( "\n" )); @@ -596,7 +602,7 @@ if ( *cur == ']' ) { parser->root.cursor++; - face->ttf_size = ttf_count; + t42face->ttf_size = ttf_count; goto Exit; } @@ -707,7 +713,7 @@ /* load offset table, 12 bytes */ if ( ttf_count < 12 ) { - face->ttf_data[ttf_count++] = string_buf[n]; + t42face->ttf_data[ttf_count++] = string_buf[n]; continue; } else @@ -715,7 +721,7 @@ FT_Long ttf_reserved_prev = ttf_reserved; - num_tables = 16 * face->ttf_data[4] + face->ttf_data[5]; + num_tables = 16 * t42face->ttf_data[4] + t42face->ttf_data[5]; status = BEFORE_TABLE_DIR; ttf_reserved = 12 + 16 * num_tables; @@ -729,7 +735,7 @@ goto Fail; } - if ( FT_QREALLOC( face->ttf_data, ttf_reserved_prev, + if ( FT_QREALLOC( t42face->ttf_data, ttf_reserved_prev, ttf_reserved ) ) goto Fail; } @@ -739,7 +745,7 @@ /* the offset table is read; read the table directory */ if ( ttf_count < ttf_reserved ) { - face->ttf_data[ttf_count++] = string_buf[n]; + t42face->ttf_data[ttf_count++] = string_buf[n]; continue; } else @@ -755,7 +761,7 @@ for ( i = 0; i < num_tables; i++ ) { - FT_Byte* p = face->ttf_data + 12 + 16 * i + 12; + FT_Byte* p = t42face->ttf_data + 12 + 16 * i + 12; len = FT_PEEK_ULONG( p ); @@ -781,7 +787,7 @@ FT_TRACE2(( " allocating %ld bytes\n", ttf_reserved )); FT_TRACE2(( "\n" )); - if ( FT_QREALLOC( face->ttf_data, ttf_reserved_prev, + if ( FT_QREALLOC( t42face->ttf_data, ttf_reserved_prev, ttf_reserved ) ) goto Fail; } @@ -795,7 +801,7 @@ error = FT_THROW( Invalid_File_Format ); goto Fail; } - face->ttf_data[ttf_count++] = string_buf[n]; + t42face->ttf_data[ttf_count++] = string_buf[n]; } } @@ -811,8 +817,8 @@ Exit: if ( parser->root.error ) { - FT_FREE( face->ttf_data ); - face->ttf_size = 0; + FT_FREE( t42face->ttf_data ); + t42face->ttf_size = 0; } if ( allocated ) FT_FREE( string_buf ); @@ -820,9 +826,11 @@ static void - t42_parse_charstrings( T42_Face face, - T42_Loader loader ) + t42_parse_charstrings( FT_Face face, /* T42_Face */ + void* loader_ ) { + T42_Face t42face = (T42_Face)face; + T42_Loader loader = (T42_Loader)loader_; T42_Parser parser = &loader->parser; PS_Table code_table = &loader->charstrings; PS_Table name_table = &loader->glyph_names; @@ -830,7 +838,7 @@ FT_Memory memory = parser->root.memory; FT_Error error; - PSAux_Service psaux = (PSAux_Service)face->psaux; + PSAux_Service psaux = (PSAux_Service)t42face->psaux; FT_Byte* cur; FT_Byte* limit = parser->root.limit; -- cgit v1.2.3 From 5f7a26fd319879575c233acea1b8e6f27807f1a5 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 7 May 2023 16:30:21 +0200 Subject: * src/winfonts/winfnt.c: Signature fixes. --- src/winfonts/winfnt.c | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c index 261540f25..1160e4ef3 100644 --- a/src/winfonts/winfnt.c +++ b/src/winfonts/winfnt.c @@ -624,31 +624,34 @@ static FT_Error - fnt_cmap_init( FNT_CMap cmap, + fnt_cmap_init( FT_CMap cmap, /* FNT_CMap */ FT_Pointer pointer ) { - FNT_Face face = (FNT_Face)FT_CMAP_FACE( cmap ); - FNT_Font font = face->font; + FNT_CMap fntcmap = (FNT_CMap)cmap; + FNT_Face face = (FNT_Face)FT_CMAP_FACE( cmap ); + FNT_Font font = face->font; FT_UNUSED( pointer ); - cmap->first = (FT_UInt32) font->header.first_char; - cmap->count = (FT_UInt32)( font->header.last_char - cmap->first + 1 ); + fntcmap->first = (FT_UInt32)font->header.first_char; + fntcmap->count = (FT_UInt32)( font->header.last_char - + fntcmap->first + 1 ); return 0; } static FT_UInt - fnt_cmap_char_index( FNT_CMap cmap, + fnt_cmap_char_index( FT_CMap cmap, /* FNT_CMap */ FT_UInt32 char_code ) { - FT_UInt gindex = 0; + FNT_CMap fntcmap = (FNT_CMap)cmap; + FT_UInt gindex = 0; - char_code -= cmap->first; - if ( char_code < cmap->count ) + char_code -= fntcmap->first; + if ( char_code < fntcmap->count ) /* we artificially increase the glyph index; */ /* FNT_Load_Glyph reverts to the right one */ gindex = (FT_UInt)( char_code + 1 ); @@ -657,25 +660,26 @@ static FT_UInt - fnt_cmap_char_next( FNT_CMap cmap, + fnt_cmap_char_next( FT_CMap cmap, /* FNT_CMap */ FT_UInt32 *pchar_code ) { - FT_UInt gindex = 0; - FT_UInt32 result = 0; + FNT_CMap fntcmap = (FNT_CMap)cmap; + FT_UInt gindex = 0; + FT_UInt32 result = 0; FT_UInt32 char_code = *pchar_code + 1; - if ( char_code <= cmap->first ) + if ( char_code <= fntcmap->first ) { - result = cmap->first; + result = fntcmap->first; gindex = 1; } else { - char_code -= cmap->first; - if ( char_code < cmap->count ) + char_code -= fntcmap->first; + if ( char_code < fntcmap->count ) { - result = cmap->first + char_code; + result = fntcmap->first + char_code; gindex = (FT_UInt)( char_code + 1 ); } } -- cgit v1.2.3 From 60c11919e0fa5c8ae316b57e1565a3c1ecd19f3c Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 7 May 2023 16:42:01 +0200 Subject: * src/pcf/pcfdrivr.c: Signature fix. --- src/pcf/pcfdrivr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pcf/pcfdrivr.c b/src/pcf/pcfdrivr.c index ad481b3b1..f1dba0240 100644 --- a/src/pcf/pcfdrivr.c +++ b/src/pcf/pcfdrivr.c @@ -702,7 +702,7 @@ THE SOFTWARE. FT_CALLBACK_DEF( FT_Error ) pcf_property_get( FT_Module module, /* PCF_Driver */ const char* property_name, - const void* value ) + void* value ) { #ifdef PCF_CONFIG_OPTION_LONG_FAMILY_NAMES -- cgit v1.2.3 From 365eb10dd4a26634d7feb6ebb2e4b188b14aca7a Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 7 May 2023 19:16:38 +0200 Subject: * src/sfnt/ttcmap: Signature fixes. --- src/sfnt/ttcmap.c | 421 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 239 insertions(+), 182 deletions(-) diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c index e5ea6f1e8..9ba25dcbc 100644 --- a/src/sfnt/ttcmap.c +++ b/src/sfnt/ttcmap.c @@ -59,10 +59,14 @@ FT_CALLBACK_DEF( FT_Error ) - tt_cmap_init( TT_CMap cmap, - FT_Byte* table ) + tt_cmap_init( FT_CMap cmap, /* TT_CMap */ + void* table_ ) { - cmap->data = table; + TT_CMap ttcmap = (TT_CMap)cmap; + FT_Byte* table = (FT_Byte*)table_; + + + ttcmap->data = table; return FT_Err_Ok; } @@ -128,10 +132,11 @@ FT_CALLBACK_DEF( FT_UInt ) - tt_cmap0_char_index( TT_CMap cmap, + tt_cmap0_char_index( FT_CMap cmap, /* TT_CMap */ FT_UInt32 char_code ) { - FT_Byte* table = cmap->data; + TT_CMap ttcmap = (TT_CMap)cmap; + FT_Byte* table = ttcmap->data; return char_code < 256 ? table[6 + char_code] : 0; @@ -139,10 +144,11 @@ FT_CALLBACK_DEF( FT_UInt ) - tt_cmap0_char_next( TT_CMap cmap, + tt_cmap0_char_next( FT_CMap cmap, /* TT_CMap */ FT_UInt32 *pchar_code ) { - FT_Byte* table = cmap->data; + TT_CMap ttcmap = (TT_CMap)cmap; + FT_Byte* table = ttcmap->data; FT_UInt32 charcode = *pchar_code; FT_UInt32 result = 0; FT_UInt gindex = 0; @@ -165,10 +171,11 @@ FT_CALLBACK_DEF( FT_Error ) - tt_cmap0_get_info( TT_CMap cmap, + tt_cmap0_get_info( FT_CharMap cmap, /* TT_CMap */ TT_CMapInfo *cmap_info ) { - FT_Byte* p = cmap->data + 4; + TT_CMap ttcmap = (TT_CMap)cmap; + FT_Byte* p = ttcmap->data + 4; cmap_info->format = 0; @@ -453,10 +460,11 @@ FT_CALLBACK_DEF( FT_UInt ) - tt_cmap2_char_index( TT_CMap cmap, + tt_cmap2_char_index( FT_CMap cmap, /* TT_CMap */ FT_UInt32 char_code ) { - FT_Byte* table = cmap->data; + TT_CMap ttcmap = (TT_CMap)cmap; + FT_Byte* table = ttcmap->data; FT_UInt result = 0; FT_Byte* subheader; @@ -492,10 +500,11 @@ FT_CALLBACK_DEF( FT_UInt ) - tt_cmap2_char_next( TT_CMap cmap, + tt_cmap2_char_next( FT_CMap cmap, /* TT_CMap */ FT_UInt32 *pcharcode ) { - FT_Byte* table = cmap->data; + TT_CMap ttcmap = (TT_CMap)cmap; + FT_Byte* table = ttcmap->data; FT_UInt gindex = 0; FT_UInt32 result = 0; FT_UInt32 charcode = *pcharcode + 1; @@ -579,10 +588,11 @@ FT_CALLBACK_DEF( FT_Error ) - tt_cmap2_get_info( TT_CMap cmap, + tt_cmap2_get_info( FT_CharMap cmap, /* TT_CMap */ TT_CMapInfo *cmap_info ) { - FT_Byte* p = cmap->data + 4; + TT_CMap ttcmap = (TT_CMap)cmap; + FT_Byte* p = ttcmap->data + 4; cmap_info->format = 2; @@ -706,18 +716,20 @@ FT_CALLBACK_DEF( FT_Error ) - tt_cmap4_init( TT_CMap4 cmap, - FT_Byte* table ) + tt_cmap4_init( FT_CMap cmap, /* TT_CMap4 */ + void* table_ ) { + TT_CMap4 ttcmap = (TT_CMap4)cmap; + FT_Byte* table = (FT_Byte*)table_; FT_Byte* p; - cmap->cmap.data = table; + ttcmap->cmap.data = table; - p = table + 6; - cmap->num_ranges = FT_PEEK_USHORT( p ) >> 1; - cmap->cur_charcode = (FT_UInt32)0xFFFFFFFFUL; - cmap->cur_gindex = 0; + p = table + 6; + ttcmap->num_ranges = FT_PEEK_USHORT( p ) >> 1; + ttcmap->cur_charcode = (FT_UInt32)0xFFFFFFFFUL; + ttcmap->cur_gindex = 0; return FT_Err_Ok; } @@ -755,7 +767,7 @@ cmap->cur_start == 0xFFFFU && cmap->cur_end == 0xFFFFU ) { - TT_Face face = (TT_Face)cmap->cmap.cmap.charmap.face; + TT_Face face = (TT_Face)FT_CMAP_FACE( cmap ); FT_Byte* limit = face->cmap_table + face->cmap_size; @@ -788,7 +800,7 @@ static void tt_cmap4_next( TT_CMap4 cmap ) { - TT_Face face = (TT_Face)cmap->cmap.cmap.charmap.face; + TT_Face face = (TT_Face)FT_CMAP_FACE( cmap ); FT_Byte* limit = face->cmap_table + face->cmap_size; FT_UInt charcode; @@ -1093,7 +1105,7 @@ FT_UInt32* pcharcode, FT_Bool next ) { - TT_Face face = (TT_Face)cmap->cmap.charmap.face; + TT_Face face = (TT_Face)FT_CMAP_FACE( cmap ); FT_Byte* limit = face->cmap_table + face->cmap_size; @@ -1222,7 +1234,7 @@ FT_UInt32* pcharcode, FT_Bool next ) { - TT_Face face = (TT_Face)cmap->cmap.charmap.face; + TT_Face face = (TT_Face)FT_CMAP_FACE( cmap ); FT_Byte* limit = face->cmap_table + face->cmap_size; FT_UInt num_segs2, start, end, offset; @@ -1468,31 +1480,35 @@ FT_CALLBACK_DEF( FT_UInt ) - tt_cmap4_char_index( TT_CMap cmap, + tt_cmap4_char_index( FT_CMap cmap, /* TT_CMap */ FT_UInt32 char_code ) { + TT_CMap ttcmap = (TT_CMap)cmap; + + if ( char_code >= 0x10000UL ) return 0; - if ( cmap->flags & TT_CMAP_FLAG_UNSORTED ) - return tt_cmap4_char_map_linear( cmap, &char_code, 0 ); + if ( ttcmap->flags & TT_CMAP_FLAG_UNSORTED ) + return tt_cmap4_char_map_linear( ttcmap, &char_code, 0 ); else - return tt_cmap4_char_map_binary( cmap, &char_code, 0 ); + return tt_cmap4_char_map_binary( ttcmap, &char_code, 0 ); } FT_CALLBACK_DEF( FT_UInt ) - tt_cmap4_char_next( TT_CMap cmap, + tt_cmap4_char_next( FT_CMap cmap, /* TT_CMap */ FT_UInt32 *pchar_code ) { + TT_CMap ttcmap = (TT_CMap)cmap; FT_UInt gindex; if ( *pchar_code >= 0xFFFFU ) return 0; - if ( cmap->flags & TT_CMAP_FLAG_UNSORTED ) - gindex = tt_cmap4_char_map_linear( cmap, pchar_code, 1 ); + if ( ttcmap->flags & TT_CMAP_FLAG_UNSORTED ) + gindex = tt_cmap4_char_map_linear( ttcmap, pchar_code, 1 ); else { TT_CMap4 cmap4 = (TT_CMap4)cmap; @@ -1507,7 +1523,7 @@ *pchar_code = cmap4->cur_charcode; } else - gindex = tt_cmap4_char_map_binary( cmap, pchar_code, 1 ); + gindex = tt_cmap4_char_map_binary( ttcmap, pchar_code, 1 ); } return gindex; @@ -1515,10 +1531,11 @@ FT_CALLBACK_DEF( FT_Error ) - tt_cmap4_get_info( TT_CMap cmap, + tt_cmap4_get_info( FT_CharMap cmap, /* TT_CMap */ TT_CMapInfo *cmap_info ) { - FT_Byte* p = cmap->data + 4; + TT_CMap ttcmap = (TT_CMap)cmap; + FT_Byte* p = ttcmap->data + 4; cmap_info->format = 4; @@ -1619,10 +1636,11 @@ FT_CALLBACK_DEF( FT_UInt ) - tt_cmap6_char_index( TT_CMap cmap, + tt_cmap6_char_index( FT_CMap cmap, /* TT_CMap */ FT_UInt32 char_code ) { - FT_Byte* table = cmap->data; + TT_CMap ttcmap = (TT_CMap)cmap; + FT_Byte* table = ttcmap->data; FT_UInt result = 0; FT_Byte* p = table + 6; FT_UInt start = TT_NEXT_USHORT( p ); @@ -1641,10 +1659,11 @@ FT_CALLBACK_DEF( FT_UInt ) - tt_cmap6_char_next( TT_CMap cmap, + tt_cmap6_char_next( FT_CMap cmap, /* TT_CMap */ FT_UInt32 *pchar_code ) { - FT_Byte* table = cmap->data; + TT_CMap ttcmap = (TT_CMap)cmap; + FT_Byte* table = ttcmap->data; FT_UInt32 result = 0; FT_UInt32 char_code = *pchar_code + 1; FT_UInt gindex = 0; @@ -1685,10 +1704,11 @@ FT_CALLBACK_DEF( FT_Error ) - tt_cmap6_get_info( TT_CMap cmap, + tt_cmap6_get_info( FT_CharMap cmap, /* TT_CMap */ TT_CMapInfo *cmap_info ) { - FT_Byte* p = cmap->data + 4; + TT_CMap ttcmap = (TT_CMap)cmap; + FT_Byte* p = ttcmap->data + 4; cmap_info->format = 6; @@ -1879,10 +1899,11 @@ FT_CALLBACK_DEF( FT_UInt ) - tt_cmap8_char_index( TT_CMap cmap, + tt_cmap8_char_index( FT_CMap cmap, /* TT_CMap */ FT_UInt32 char_code ) { - FT_Byte* table = cmap->data; + TT_CMap ttcmap = (TT_CMap)cmap; + FT_Byte* table = ttcmap->data; FT_UInt result = 0; FT_Byte* p = table + 8204; FT_UInt32 num_groups = TT_NEXT_ULONG( p ); @@ -1912,14 +1933,15 @@ FT_CALLBACK_DEF( FT_UInt ) - tt_cmap8_char_next( TT_CMap cmap, + tt_cmap8_char_next( FT_CMap cmap, /* TT_CMap */ FT_UInt32 *pchar_code ) { - FT_Face face = cmap->cmap.charmap.face; + TT_CMap ttcmap = (TT_CMap)cmap; + FT_Face face = FT_CMAP_FACE( cmap ); FT_UInt32 result = 0; FT_UInt32 char_code; FT_UInt gindex = 0; - FT_Byte* table = cmap->data; + FT_Byte* table = ttcmap->data; FT_Byte* p = table + 8204; FT_UInt32 num_groups = TT_NEXT_ULONG( p ); FT_UInt32 start, end, start_id; @@ -1979,10 +2001,11 @@ FT_CALLBACK_DEF( FT_Error ) - tt_cmap8_get_info( TT_CMap cmap, + tt_cmap8_get_info( FT_CharMap cmap, /* TT_CMap */ TT_CMapInfo *cmap_info ) { - FT_Byte* p = cmap->data + 8; + TT_CMap ttcmap = (TT_CMap)cmap; + FT_Byte* p = ttcmap->data + 8; cmap_info->format = 8; @@ -2083,10 +2106,11 @@ FT_CALLBACK_DEF( FT_UInt ) - tt_cmap10_char_index( TT_CMap cmap, + tt_cmap10_char_index( FT_CMap cmap, /* TT_CMap */ FT_UInt32 char_code ) { - FT_Byte* table = cmap->data; + TT_CMap ttcmap = (TT_CMap)cmap; + FT_Byte* table = ttcmap->data; FT_UInt result = 0; FT_Byte* p = table + 12; FT_UInt32 start = TT_NEXT_ULONG( p ); @@ -2110,10 +2134,11 @@ FT_CALLBACK_DEF( FT_UInt ) - tt_cmap10_char_next( TT_CMap cmap, + tt_cmap10_char_next( FT_CMap cmap, /* TT_CMap */ FT_UInt32 *pchar_code ) { - FT_Byte* table = cmap->data; + TT_CMap ttcmap = (TT_CMap)cmap; + FT_Byte* table = ttcmap->data; FT_UInt32 char_code; FT_UInt gindex = 0; FT_Byte* p = table + 12; @@ -2151,10 +2176,11 @@ FT_CALLBACK_DEF( FT_Error ) - tt_cmap10_get_info( TT_CMap cmap, + tt_cmap10_get_info( FT_CharMap cmap, /* TT_CMap */ TT_CMapInfo *cmap_info ) { - FT_Byte* p = cmap->data + 8; + TT_CMap ttcmap = (TT_CMap)cmap; + FT_Byte* p = ttcmap->data + 8; cmap_info->format = 10; @@ -2232,15 +2258,19 @@ FT_CALLBACK_DEF( FT_Error ) - tt_cmap12_init( TT_CMap12 cmap, - FT_Byte* table ) + tt_cmap12_init( FT_CMap cmap, /* TT_CMap12 */ + void* table_ ) { - cmap->cmap.data = table; + TT_CMap12 ttcmap = (TT_CMap12)cmap; + FT_Byte* table = (FT_Byte*)table_; - table += 12; - cmap->num_groups = FT_PEEK_ULONG( table ); - cmap->valid = 0; + ttcmap->cmap.data = table; + + table += 12; + ttcmap->num_groups = FT_PEEK_ULONG( table ); + + ttcmap->valid = 0; return FT_Err_Ok; } @@ -2310,20 +2340,21 @@ /* cmap->cur_group should be set up properly by caller */ /* */ static void - tt_cmap12_next( TT_CMap12 cmap ) + tt_cmap12_next( FT_CMap cmap ) /* TT_CMap12 */ { - FT_Face face = cmap->cmap.cmap.charmap.face; - FT_Byte* p; - FT_ULong start, end, start_id, char_code; - FT_ULong n; - FT_UInt gindex; + TT_CMap12 ttcmap = (TT_CMap12)cmap; + FT_Face face = FT_CMAP_FACE( cmap ); + FT_Byte* p; + FT_ULong start, end, start_id, char_code; + FT_ULong n; + FT_UInt gindex; - char_code = cmap->cur_charcode + 1; + char_code = ttcmap->cur_charcode + 1; - for ( n = cmap->cur_group; n < cmap->num_groups; n++ ) + for ( n = ttcmap->cur_group; n < ttcmap->num_groups; n++ ) { - p = cmap->cmap.data + 16 + 12 * n; + p = ttcmap->cmap.data + 16 + 12 * n; start = TT_NEXT_ULONG( p ); end = TT_NEXT_ULONG( p ); start_id = TT_PEEK_ULONG( p ); @@ -2355,16 +2386,16 @@ if ( gindex >= (FT_UInt)face->num_glyphs ) continue; - cmap->cur_charcode = char_code; - cmap->cur_gindex = gindex; - cmap->cur_group = n; + ttcmap->cur_charcode = char_code; + ttcmap->cur_gindex = gindex; + ttcmap->cur_group = n; return; } } Fail: - cmap->valid = 0; + ttcmap->valid = 0; } @@ -2416,7 +2447,7 @@ if ( next ) { - FT_Face face = cmap->cmap.charmap.face; + FT_Face face = FT_CMAP_FACE( cmap ); TT_CMap12 cmap12 = (TT_CMap12)cmap; @@ -2435,7 +2466,7 @@ if ( !gindex ) { - tt_cmap12_next( cmap12 ); + tt_cmap12_next( FT_CMAP( cmap12 ) ); if ( cmap12->valid ) gindex = cmap12->cur_gindex; @@ -2451,15 +2482,15 @@ FT_CALLBACK_DEF( FT_UInt ) - tt_cmap12_char_index( TT_CMap cmap, + tt_cmap12_char_index( FT_CMap cmap, /* TT_CMap */ FT_UInt32 char_code ) { - return tt_cmap12_char_map_binary( cmap, &char_code, 0 ); + return tt_cmap12_char_map_binary( (TT_CMap)cmap, &char_code, 0 ); } FT_CALLBACK_DEF( FT_UInt ) - tt_cmap12_char_next( TT_CMap cmap, + tt_cmap12_char_next( FT_CMap cmap, /* TT_CMap12 */ FT_UInt32 *pchar_code ) { TT_CMap12 cmap12 = (TT_CMap12)cmap; @@ -2472,7 +2503,7 @@ /* no need to search */ if ( cmap12->valid && cmap12->cur_charcode == *pchar_code ) { - tt_cmap12_next( cmap12 ); + tt_cmap12_next( FT_CMAP( cmap12 ) ); if ( cmap12->valid ) { gindex = cmap12->cur_gindex; @@ -2482,17 +2513,18 @@ gindex = 0; } else - gindex = tt_cmap12_char_map_binary( cmap, pchar_code, 1 ); + gindex = tt_cmap12_char_map_binary( (TT_CMap)cmap, pchar_code, 1 ); return gindex; } FT_CALLBACK_DEF( FT_Error ) - tt_cmap12_get_info( TT_CMap cmap, + tt_cmap12_get_info( FT_CharMap cmap, /* TT_CMap */ TT_CMapInfo *cmap_info ) { - FT_Byte* p = cmap->data + 8; + TT_CMap ttcmap = (TT_CMap)cmap; + FT_Byte* p = ttcmap->data + 8; cmap_info->format = 12; @@ -2570,15 +2602,19 @@ FT_CALLBACK_DEF( FT_Error ) - tt_cmap13_init( TT_CMap13 cmap, - FT_Byte* table ) + tt_cmap13_init( FT_CMap cmap, /* TT_CMap13 */ + void* table_ ) { - cmap->cmap.data = table; + TT_CMap13 ttcmap = (TT_CMap13)cmap; + FT_Byte* table = (FT_Byte*)table_; - table += 12; - cmap->num_groups = FT_PEEK_ULONG( table ); - cmap->valid = 0; + ttcmap->cmap.data = table; + + table += 12; + ttcmap->num_groups = FT_PEEK_ULONG( table ); + + ttcmap->valid = 0; return FT_Err_Ok; } @@ -2643,20 +2679,21 @@ /* cmap->cur_group should be set up properly by caller */ /* */ static void - tt_cmap13_next( TT_CMap13 cmap ) + tt_cmap13_next( FT_CMap cmap ) /* TT_CMap13 */ { - FT_Face face = cmap->cmap.cmap.charmap.face; - FT_Byte* p; - FT_ULong start, end, glyph_id, char_code; - FT_ULong n; - FT_UInt gindex; + TT_CMap13 ttcmap = (TT_CMap13)cmap; + FT_Face face = FT_CMAP_FACE( cmap ); + FT_Byte* p; + FT_ULong start, end, glyph_id, char_code; + FT_ULong n; + FT_UInt gindex; - char_code = cmap->cur_charcode + 1; + char_code = ttcmap->cur_charcode + 1; - for ( n = cmap->cur_group; n < cmap->num_groups; n++ ) + for ( n = ttcmap->cur_group; n < ttcmap->num_groups; n++ ) { - p = cmap->cmap.data + 16 + 12 * n; + p = ttcmap->cmap.data + 16 + 12 * n; start = TT_NEXT_ULONG( p ); end = TT_NEXT_ULONG( p ); glyph_id = TT_PEEK_ULONG( p ); @@ -2670,16 +2707,16 @@ if ( gindex && gindex < (FT_UInt)face->num_glyphs ) { - cmap->cur_charcode = char_code; - cmap->cur_gindex = gindex; - cmap->cur_group = n; + ttcmap->cur_charcode = char_code; + ttcmap->cur_gindex = gindex; + ttcmap->cur_group = n; return; } } } - cmap->valid = 0; + ttcmap->valid = 0; } @@ -2745,7 +2782,7 @@ if ( !gindex ) { - tt_cmap13_next( cmap13 ); + tt_cmap13_next( FT_CMAP( cmap13 ) ); if ( cmap13->valid ) gindex = cmap13->cur_gindex; @@ -2761,15 +2798,15 @@ FT_CALLBACK_DEF( FT_UInt ) - tt_cmap13_char_index( TT_CMap cmap, + tt_cmap13_char_index( FT_CMap cmap, /* TT_CMap */ FT_UInt32 char_code ) { - return tt_cmap13_char_map_binary( cmap, &char_code, 0 ); + return tt_cmap13_char_map_binary( (TT_CMap)cmap, &char_code, 0 ); } FT_CALLBACK_DEF( FT_UInt ) - tt_cmap13_char_next( TT_CMap cmap, + tt_cmap13_char_next( FT_CMap cmap, /* TT_CMap13 */ FT_UInt32 *pchar_code ) { TT_CMap13 cmap13 = (TT_CMap13)cmap; @@ -2782,7 +2819,7 @@ /* no need to search */ if ( cmap13->valid && cmap13->cur_charcode == *pchar_code ) { - tt_cmap13_next( cmap13 ); + tt_cmap13_next( FT_CMAP( cmap13 ) ); if ( cmap13->valid ) { gindex = cmap13->cur_gindex; @@ -2792,17 +2829,18 @@ gindex = 0; } else - gindex = tt_cmap13_char_map_binary( cmap, pchar_code, 1 ); + gindex = tt_cmap13_char_map_binary( (TT_CMap)cmap, pchar_code, 1 ); return gindex; } FT_CALLBACK_DEF( FT_Error ) - tt_cmap13_get_info( TT_CMap cmap, + tt_cmap13_get_info( FT_CharMap cmap, /* TT_CMap */ TT_CMapInfo *cmap_info ) { - FT_Byte* p = cmap->data + 8; + TT_CMap ttcmap = (TT_CMap)cmap; + FT_Byte* p = ttcmap->data + 8; cmap_info->format = 13; @@ -2917,14 +2955,15 @@ FT_CALLBACK_DEF( void ) - tt_cmap14_done( TT_CMap14 cmap ) + tt_cmap14_done( FT_CMap cmap ) /* TT_CMap14 */ { - FT_Memory memory = cmap->memory; + TT_CMap14 ttcmap = (TT_CMap14)cmap; + FT_Memory memory = ttcmap->memory; - cmap->max_results = 0; - if ( memory && cmap->results ) - FT_FREE( cmap->results ); + ttcmap->max_results = 0; + if ( memory && ttcmap->results ) + FT_FREE( ttcmap->results ); } @@ -2952,15 +2991,19 @@ FT_CALLBACK_DEF( FT_Error ) - tt_cmap14_init( TT_CMap14 cmap, - FT_Byte* table ) + tt_cmap14_init( FT_CMap cmap, /* TT_CMap14 */ + void* table_ ) { - cmap->cmap.data = table; + TT_CMap14 ttcmap = (TT_CMap14)cmap; + FT_Byte* table = (FT_Byte*)table_; + - table += 6; - cmap->num_selectors = FT_PEEK_ULONG( table ); - cmap->max_results = 0; - cmap->results = NULL; + ttcmap->cmap.data = table; + + table += 6; + ttcmap->num_selectors = FT_PEEK_ULONG( table ); + ttcmap->max_results = 0; + ttcmap->results = NULL; return FT_Err_Ok; } @@ -3090,7 +3133,7 @@ FT_CALLBACK_DEF( FT_UInt ) - tt_cmap14_char_index( TT_CMap cmap, + tt_cmap14_char_index( FT_CMap cmap, FT_UInt32 char_code ) { FT_UNUSED( cmap ); @@ -3102,7 +3145,7 @@ FT_CALLBACK_DEF( FT_UInt ) - tt_cmap14_char_next( TT_CMap cmap, + tt_cmap14_char_next( FT_CMap cmap, FT_UInt32 *pchar_code ) { FT_UNUSED( cmap ); @@ -3114,7 +3157,7 @@ FT_CALLBACK_DEF( FT_Error ) - tt_cmap14_get_info( TT_CMap cmap, + tt_cmap14_get_info( FT_CharMap cmap, TT_CMapInfo *cmap_info ) { FT_UNUSED( cmap ); @@ -3228,12 +3271,16 @@ FT_CALLBACK_DEF( FT_UInt ) - tt_cmap14_char_var_index( TT_CMap cmap, - TT_CMap ucmap, + tt_cmap14_char_var_index( FT_CMap cmap, /* TT_CMap */ + FT_CMap ucmap, /* TT_CMap */ FT_UInt32 charcode, FT_UInt32 variantSelector ) { - FT_Byte* p = tt_cmap14_find_variant( cmap->data + 6, variantSelector ); + TT_CMap ttcmap = (TT_CMap)cmap; + TT_CMap ttucmap = (TT_CMap)ucmap; + + FT_Byte* p = tt_cmap14_find_variant( ttcmap->data + 6, + variantSelector ); FT_ULong defOff; FT_ULong nondefOff; @@ -3244,16 +3291,16 @@ defOff = TT_NEXT_ULONG( p ); nondefOff = TT_PEEK_ULONG( p ); - if ( defOff != 0 && - tt_cmap14_char_map_def_binary( cmap->data + defOff, charcode ) ) + if ( defOff != 0 && + tt_cmap14_char_map_def_binary( ttcmap->data + defOff, charcode ) ) { /* This is the default variant of this charcode. GID not stored */ /* here; stored in the normal Unicode charmap instead. */ - return ucmap->cmap.clazz->char_index( &ucmap->cmap, charcode ); + return ttucmap->cmap.clazz->char_index( &ttucmap->cmap, charcode ); } if ( nondefOff != 0 ) - return tt_cmap14_char_map_nondef_binary( cmap->data + nondefOff, + return tt_cmap14_char_map_nondef_binary( ttcmap->data + nondefOff, charcode ); return 0; @@ -3261,11 +3308,13 @@ FT_CALLBACK_DEF( FT_Int ) - tt_cmap14_char_var_isdefault( TT_CMap cmap, + tt_cmap14_char_var_isdefault( FT_CMap cmap, /* TT_CMap */ FT_UInt32 charcode, FT_UInt32 variantSelector ) { - FT_Byte* p = tt_cmap14_find_variant( cmap->data + 6, variantSelector ); + TT_CMap ttcmap = (TT_CMap)cmap; + FT_Byte* p = tt_cmap14_find_variant( ttcmap->data + 6, + variantSelector ); FT_ULong defOff; FT_ULong nondefOff; @@ -3276,13 +3325,13 @@ defOff = TT_NEXT_ULONG( p ); nondefOff = TT_NEXT_ULONG( p ); - if ( defOff != 0 && - tt_cmap14_char_map_def_binary( cmap->data + defOff, charcode ) ) + if ( defOff != 0 && + tt_cmap14_char_map_def_binary( ttcmap->data + defOff, charcode ) ) return 1; - if ( nondefOff != 0 && - tt_cmap14_char_map_nondef_binary( cmap->data + nondefOff, - charcode ) != 0 ) + if ( nondefOff != 0 && + tt_cmap14_char_map_nondef_binary( ttcmap->data + nondefOff, + charcode ) != 0 ) return 0; return -1; @@ -3290,12 +3339,13 @@ FT_CALLBACK_DEF( FT_UInt32* ) - tt_cmap14_variants( TT_CMap cmap, + tt_cmap14_variants( FT_CMap cmap, /* TT_CMap14 */ FT_Memory memory ) { + TT_CMap ttcmap = (TT_CMap)cmap; TT_CMap14 cmap14 = (TT_CMap14)cmap; FT_UInt32 count = cmap14->num_selectors; - FT_Byte* p = cmap->data + 10; + FT_Byte* p = ttcmap->data + 10; FT_UInt32* result; FT_UInt32 i; @@ -3316,13 +3366,14 @@ FT_CALLBACK_DEF( FT_UInt32 * ) - tt_cmap14_char_variants( TT_CMap cmap, + tt_cmap14_char_variants( FT_CMap cmap, /* TT_CMap14 */ FT_Memory memory, FT_UInt32 charCode ) { - TT_CMap14 cmap14 = (TT_CMap14) cmap; + TT_CMap ttcmap = (TT_CMap)cmap; + TT_CMap14 cmap14 = (TT_CMap14)cmap; FT_UInt32 count = cmap14->num_selectors; - FT_Byte* p = cmap->data + 10; + FT_Byte* p = ttcmap->data + 10; FT_UInt32* q; @@ -3336,12 +3387,12 @@ FT_ULong nondefOff = TT_NEXT_ULONG( p ); - if ( ( defOff != 0 && - tt_cmap14_char_map_def_binary( cmap->data + defOff, - charCode ) ) || - ( nondefOff != 0 && - tt_cmap14_char_map_nondef_binary( cmap->data + nondefOff, - charCode ) != 0 ) ) + if ( ( defOff != 0 && + tt_cmap14_char_map_def_binary( ttcmap->data + defOff, + charCode ) ) || + ( nondefOff != 0 && + tt_cmap14_char_map_nondef_binary( ttcmap->data + nondefOff, + charCode ) != 0 ) ) { q[0] = varSel; q++; @@ -3437,15 +3488,16 @@ FT_CALLBACK_DEF( FT_UInt32 * ) - tt_cmap14_variant_chars( TT_CMap cmap, + tt_cmap14_variant_chars( FT_CMap cmap, /* TT_CMap */ FT_Memory memory, FT_UInt32 variantSelector ) { - FT_Byte *p = tt_cmap14_find_variant( cmap->data + 6, - variantSelector ); - FT_Int i; - FT_ULong defOff; - FT_ULong nondefOff; + TT_CMap ttcmap = (TT_CMap)cmap; + FT_Byte *p = tt_cmap14_find_variant( ttcmap->data + 6, + variantSelector ); + FT_Int i; + FT_ULong defOff; + FT_ULong nondefOff; if ( !p ) @@ -3458,16 +3510,16 @@ return NULL; if ( defOff == 0 ) - return tt_cmap14_get_nondef_chars( cmap, cmap->data + nondefOff, + return tt_cmap14_get_nondef_chars( ttcmap, ttcmap->data + nondefOff, memory ); else if ( nondefOff == 0 ) - return tt_cmap14_get_def_chars( cmap, cmap->data + defOff, + return tt_cmap14_get_def_chars( ttcmap, ttcmap->data + defOff, memory ); else { /* Both a default and a non-default glyph set? That's probably not */ /* good font design, but the spec allows for it... */ - TT_CMap14 cmap14 = (TT_CMap14) cmap; + TT_CMap14 cmap14 = (TT_CMap14)cmap; FT_UInt32 numRanges; FT_UInt32 numMappings; FT_UInt32 duni; @@ -3479,18 +3531,18 @@ FT_UInt32 *ret; - p = cmap->data + nondefOff; - dp = cmap->data + defOff; + p = ttcmap->data + nondefOff; + dp = ttcmap->data + defOff; numMappings = (FT_UInt32)TT_NEXT_ULONG( p ); dcnt = tt_cmap14_def_char_count( dp ); numRanges = (FT_UInt32)TT_NEXT_ULONG( dp ); if ( numMappings == 0 ) - return tt_cmap14_get_def_chars( cmap, cmap->data + defOff, + return tt_cmap14_get_def_chars( ttcmap, ttcmap->data + defOff, memory ); if ( dcnt == 0 ) - return tt_cmap14_get_nondef_chars( cmap, cmap->data + nondefOff, + return tt_cmap14_get_nondef_chars( ttcmap, ttcmap->data + nondefOff, memory ); if ( tt_cmap14_ensure( cmap14, ( dcnt + numMappings + 1 ), memory ) ) @@ -3612,9 +3664,10 @@ #ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES FT_CALLBACK_DEF( const char * ) - tt_get_glyph_name( TT_Face face, + tt_get_glyph_name( void* face_, /* TT_Face */ FT_UInt idx ) { + TT_Face face = (TT_Face)face_; FT_String* PSname = NULL; @@ -3625,12 +3678,13 @@ FT_CALLBACK_DEF( FT_Error ) - tt_cmap_unicode_init( PS_Unicodes unicodes, - FT_Pointer pointer ) + tt_cmap_unicode_init( FT_CMap cmap, /* PS_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; + PS_Unicodes unicodes = (PS_Unicodes)cmap; + TT_Face face = (TT_Face)FT_CMAP_FACE( cmap ); + FT_Memory memory = FT_FACE_MEMORY( face ); + FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames; FT_UNUSED( pointer ); @@ -3641,17 +3695,18 @@ return psnames->unicodes_init( memory, unicodes, face->root.num_glyphs, - (PS_GetGlyphNameFunc)&tt_get_glyph_name, + &tt_get_glyph_name, (PS_FreeGlyphNameFunc)NULL, (FT_Pointer)face ); } FT_CALLBACK_DEF( void ) - tt_cmap_unicode_done( PS_Unicodes unicodes ) + tt_cmap_unicode_done( FT_CMap cmap ) /* PS_Unicodes */ { - FT_Face face = FT_CMAP_FACE( unicodes ); - FT_Memory memory = FT_FACE_MEMORY( face ); + PS_Unicodes unicodes = (PS_Unicodes)cmap; + FT_Face face = FT_CMAP_FACE( cmap ); + FT_Memory memory = FT_FACE_MEMORY( face ); FT_FREE( unicodes->maps ); @@ -3660,11 +3715,12 @@ FT_CALLBACK_DEF( FT_UInt ) - tt_cmap_unicode_char_index( PS_Unicodes unicodes, - FT_UInt32 char_code ) + tt_cmap_unicode_char_index( FT_CMap cmap, /* PS_Unicodes */ + FT_UInt32 char_code ) { - TT_Face face = (TT_Face)FT_CMAP_FACE( unicodes ); - FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames; + PS_Unicodes unicodes = (PS_Unicodes)cmap; + TT_Face face = (TT_Face)FT_CMAP_FACE( cmap ); + FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames; return psnames->unicodes_char_index( unicodes, char_code ); @@ -3672,11 +3728,12 @@ FT_CALLBACK_DEF( FT_UInt ) - tt_cmap_unicode_char_next( PS_Unicodes unicodes, - FT_UInt32 *pchar_code ) + tt_cmap_unicode_char_next( FT_CMap cmap, /* PS_Unicodes */ + FT_UInt32 *pchar_code ) { - TT_Face face = (TT_Face)FT_CMAP_FACE( unicodes ); - FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames; + PS_Unicodes unicodes = (PS_Unicodes)cmap; + TT_Face face = (TT_Face)FT_CMAP_FACE( cmap ); + FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames; return psnames->unicodes_char_next( unicodes, pchar_code ); @@ -3831,7 +3888,7 @@ tt_get_cmap_info( FT_CharMap charmap, TT_CMapInfo *cmap_info ) { - FT_CMap cmap = (FT_CMap)charmap; + FT_CMap cmap = FT_CMAP( charmap ); TT_CMap_Class clazz = (TT_CMap_Class)cmap->clazz; -- cgit v1.2.3 From 274e0dd5b5f4144956b9967c1c0e861053805984 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 7 May 2023 19:54:46 +0200 Subject: [autofit] Signature fixes. --- src/autofit/afcjk.c | 38 ++++++++++++++++++++++++-------------- src/autofit/afcjk.h | 20 ++++++++++---------- src/autofit/afglobal.c | 5 ++++- src/autofit/afglobal.h | 2 +- src/autofit/afindic.c | 32 +++++++++++++++++++------------- src/autofit/aflatin.c | 22 +++++++++++++++++----- src/autofit/aflatin.h | 4 ++-- src/autofit/afloader.c | 6 ++---- src/autofit/afmodule.c | 18 +++++++++--------- 9 files changed, 88 insertions(+), 59 deletions(-) diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c index 7734d4e77..fdb8e8f6d 100644 --- a/src/autofit/afcjk.c +++ b/src/autofit/afcjk.c @@ -633,10 +633,11 @@ /* Initialize global metrics. */ FT_LOCAL_DEF( FT_Error ) - af_cjk_metrics_init( AF_CJKMetrics metrics, - FT_Face face ) + af_cjk_metrics_init( AF_StyleMetrics metrics_, /* AF_CJKMetrics */ + FT_Face face ) { - FT_CharMap oldmap = face->charmap; + AF_CJKMetrics metrics = (AF_CJKMetrics)metrics_; + FT_CharMap oldmap = face->charmap; metrics->units_per_em = face->units_per_EM; @@ -754,9 +755,12 @@ /* Scale global values in both directions. */ FT_LOCAL_DEF( void ) - af_cjk_metrics_scale( AF_CJKMetrics metrics, - AF_Scaler scaler ) + af_cjk_metrics_scale( AF_StyleMetrics metrics_, /* AF_CJKMetrics */ + AF_Scaler scaler ) { + AF_CJKMetrics metrics = (AF_CJKMetrics)metrics_; + + /* we copy the whole structure since the x and y scaling values */ /* are not modified, contrary to e.g. the `latin' auto-hinter */ metrics->root.scaler = *scaler; @@ -770,10 +774,13 @@ /* metrics class. */ FT_LOCAL_DEF( void ) - af_cjk_get_standard_widths( AF_CJKMetrics metrics, - FT_Pos* stdHW, - FT_Pos* stdVW ) + af_cjk_get_standard_widths( AF_StyleMetrics metrics_, /* AF_CJKMetrics */ + FT_Pos* stdHW, + FT_Pos* stdVW ) { + AF_CJKMetrics metrics = (AF_CJKMetrics)metrics_; + + if ( stdHW ) *stdHW = metrics->axis[AF_DIMENSION_VERT].standard_width; @@ -1374,9 +1381,10 @@ /* Initalize hinting engine. */ FT_LOCAL_DEF( FT_Error ) - af_cjk_hints_init( AF_GlyphHints hints, - AF_CJKMetrics metrics ) + af_cjk_hints_init( AF_GlyphHints hints, + AF_StyleMetrics metrics_ ) /* AF_CJKMetrics */ { + AF_CJKMetrics metrics = (AF_CJKMetrics)metrics_; FT_Render_Mode mode; FT_UInt32 scaler_flags, other_flags; @@ -2266,11 +2274,13 @@ /* Apply the complete hinting algorithm to a CJK glyph. */ FT_LOCAL_DEF( FT_Error ) - af_cjk_hints_apply( FT_UInt glyph_index, - AF_GlyphHints hints, - FT_Outline* outline, - AF_CJKMetrics metrics ) + af_cjk_hints_apply( FT_UInt glyph_index, + AF_GlyphHints hints, + FT_Outline* outline, + AF_StyleMetrics metrics_ ) /* AF_CJKMetrics */ { + AF_CJKMetrics metrics = (AF_CJKMetrics)metrics_; + FT_Error error; int dim; diff --git a/src/autofit/afcjk.h b/src/autofit/afcjk.h index bd7b81b3e..f380ef6e0 100644 --- a/src/autofit/afcjk.h +++ b/src/autofit/afcjk.h @@ -103,22 +103,22 @@ FT_BEGIN_HEADER #ifdef AF_CONFIG_OPTION_CJK FT_LOCAL( FT_Error ) - af_cjk_metrics_init( AF_CJKMetrics metrics, - FT_Face face ); + af_cjk_metrics_init( AF_StyleMetrics metrics, + FT_Face face ); FT_LOCAL( void ) - af_cjk_metrics_scale( AF_CJKMetrics metrics, - AF_Scaler scaler ); + af_cjk_metrics_scale( AF_StyleMetrics metrics, + AF_Scaler scaler ); FT_LOCAL( FT_Error ) - af_cjk_hints_init( AF_GlyphHints hints, - AF_CJKMetrics metrics ); + af_cjk_hints_init( AF_GlyphHints hints, + AF_StyleMetrics metrics ); FT_LOCAL( FT_Error ) - af_cjk_hints_apply( FT_UInt glyph_index, - AF_GlyphHints hints, - FT_Outline* outline, - AF_CJKMetrics metrics ); + af_cjk_hints_apply( FT_UInt glyph_index, + AF_GlyphHints hints, + FT_Outline* outline, + AF_StyleMetrics metrics ); /* shared; called from afindic.c */ FT_LOCAL( void ) diff --git a/src/autofit/afglobal.c b/src/autofit/afglobal.c index ede27eb16..b1957570f 100644 --- a/src/autofit/afglobal.c +++ b/src/autofit/afglobal.c @@ -376,8 +376,11 @@ FT_LOCAL_DEF( void ) - af_face_globals_free( AF_FaceGlobals globals ) + af_face_globals_free( void* globals_ ) { + AF_FaceGlobals globals = (AF_FaceGlobals)globals_; + + if ( globals ) { FT_Memory memory = globals->face->memory; diff --git a/src/autofit/afglobal.h b/src/autofit/afglobal.h index 83a7c2ff1..66170e419 100644 --- a/src/autofit/afglobal.h +++ b/src/autofit/afglobal.h @@ -156,7 +156,7 @@ FT_BEGIN_HEADER AF_StyleMetrics *ametrics ); FT_LOCAL( void ) - af_face_globals_free( AF_FaceGlobals globals ); + af_face_globals_free( void* globals ); FT_LOCAL( FT_Bool ) af_face_globals_is_digit( AF_FaceGlobals globals, diff --git a/src/autofit/afindic.c b/src/autofit/afindic.c index 289a09d71..7fb12c63d 100644 --- a/src/autofit/afindic.c +++ b/src/autofit/afindic.c @@ -28,9 +28,12 @@ static FT_Error - af_indic_metrics_init( AF_CJKMetrics metrics, - FT_Face face ) + af_indic_metrics_init( AF_StyleMetrics metrics_, /* AF_CJKMetrics */ + FT_Face face ) { + AF_CJKMetrics metrics = (AF_CJKMetrics)metrics_; + + /* skip blue zone init in CJK routines */ FT_CharMap oldmap = face->charmap; @@ -55,8 +58,8 @@ static void - af_indic_metrics_scale( AF_CJKMetrics metrics, - AF_Scaler scaler ) + af_indic_metrics_scale( AF_StyleMetrics metrics, + AF_Scaler scaler ) { /* use CJK routines */ af_cjk_metrics_scale( metrics, scaler ); @@ -64,8 +67,8 @@ static FT_Error - af_indic_hints_init( AF_GlyphHints hints, - AF_CJKMetrics metrics ) + af_indic_hints_init( AF_GlyphHints hints, + AF_StyleMetrics metrics ) { /* use CJK routines */ return af_cjk_hints_init( hints, metrics ); @@ -73,10 +76,10 @@ static FT_Error - af_indic_hints_apply( FT_UInt glyph_index, - AF_GlyphHints hints, - FT_Outline* outline, - AF_CJKMetrics metrics ) + af_indic_hints_apply( FT_UInt glyph_index, + AF_GlyphHints hints, + FT_Outline* outline, + AF_StyleMetrics metrics ) { /* use CJK routines */ return af_cjk_hints_apply( glyph_index, hints, outline, metrics ); @@ -87,10 +90,13 @@ /* metrics class. */ static void - af_indic_get_standard_widths( AF_CJKMetrics metrics, - FT_Pos* stdHW, - FT_Pos* stdVW ) + af_indic_get_standard_widths( AF_StyleMetrics metrics_, /* AF_CJKMetrics */ + FT_Pos* stdHW, + FT_Pos* stdVW ) { + AF_CJKMetrics metrics = (AF_CJKMetrics)metrics_; + + if ( stdHW ) *stdHW = metrics->axis[AF_DIMENSION_VERT].standard_width; diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c index d84579238..e98861c3a 100644 --- a/src/autofit/aflatin.c +++ b/src/autofit/aflatin.c @@ -1131,9 +1131,11 @@ /* Initialize global metrics. */ FT_LOCAL_DEF( FT_Error ) - af_latin_metrics_init( AF_LatinMetrics metrics, + af_latin_metrics_init( AF_StyleMetrics metrics_, /* AF_LatinMetrics */ FT_Face face ) { + AF_LatinMetrics metrics = (AF_LatinMetrics)metrics_; + FT_Error error = FT_Err_Ok; FT_CharMap oldmap = face->charmap; @@ -1486,9 +1488,12 @@ /* Scale global values in both directions. */ FT_LOCAL_DEF( void ) - af_latin_metrics_scale( AF_LatinMetrics metrics, + af_latin_metrics_scale( AF_StyleMetrics metrics_, /* AF_LatinMetrics */ AF_Scaler scaler ) { + AF_LatinMetrics metrics = (AF_LatinMetrics)metrics_; + + metrics->root.scaler.render_mode = scaler->render_mode; metrics->root.scaler.face = scaler->face; metrics->root.scaler.flags = scaler->flags; @@ -1502,10 +1507,13 @@ /* metrics class. */ FT_LOCAL_DEF( void ) - af_latin_get_standard_widths( AF_LatinMetrics metrics, + af_latin_get_standard_widths( AF_StyleMetrics metrics_, /* AF_LatinMetrics */ FT_Pos* stdHW, FT_Pos* stdVW ) { + AF_LatinMetrics metrics = (AF_LatinMetrics)metrics_; + + if ( stdHW ) *stdHW = metrics->axis[AF_DIMENSION_VERT].standard_width; @@ -2607,8 +2615,10 @@ static FT_Error af_latin_hints_init( AF_GlyphHints hints, - AF_LatinMetrics metrics ) + AF_StyleMetrics metrics_ ) /* AF_LatinMetrics */ { + AF_LatinMetrics metrics = (AF_LatinMetrics)metrics_; + FT_Render_Mode mode; FT_UInt32 scaler_flags, other_flags; FT_Face face = metrics->root.scaler.face; @@ -3544,8 +3554,10 @@ af_latin_hints_apply( FT_UInt glyph_index, AF_GlyphHints hints, FT_Outline* outline, - AF_LatinMetrics metrics ) + AF_StyleMetrics metrics_ ) /* AF_LatinMetrics */ { + AF_LatinMetrics metrics = (AF_LatinMetrics)metrics_; + FT_Error error; int dim; diff --git a/src/autofit/aflatin.h b/src/autofit/aflatin.h index 3c6a7ee4f..31aa91d3b 100644 --- a/src/autofit/aflatin.h +++ b/src/autofit/aflatin.h @@ -116,11 +116,11 @@ FT_BEGIN_HEADER FT_LOCAL( FT_Error ) - af_latin_metrics_init( AF_LatinMetrics metrics, + af_latin_metrics_init( AF_StyleMetrics metrics, FT_Face face ); FT_LOCAL( void ) - af_latin_metrics_scale( AF_LatinMetrics metrics, + af_latin_metrics_scale( AF_StyleMetrics metrics, AF_Scaler scaler ); FT_LOCAL( void ) diff --git a/src/autofit/afloader.c b/src/autofit/afloader.c index c8082796f..7c47d562a 100644 --- a/src/autofit/afloader.c +++ b/src/autofit/afloader.c @@ -55,10 +55,8 @@ error = af_face_globals_new( face, &loader->globals, module ); if ( !error ) { - face->autohint.data = - (FT_Pointer)loader->globals; - face->autohint.finalizer = - (FT_Generic_Finalizer)af_face_globals_free; + face->autohint.data = (FT_Pointer)loader->globals; + face->autohint.finalizer = af_face_globals_free; } } diff --git a/src/autofit/afmodule.c b/src/autofit/afmodule.c index 92e5156ab..e3c62b867 100644 --- a/src/autofit/afmodule.c +++ b/src/autofit/afmodule.c @@ -89,10 +89,8 @@ error = af_face_globals_new( face, &globals, module ); if ( !error ) { - face->autohint.data = - (FT_Pointer)globals; - face->autohint.finalizer = - (FT_Generic_Finalizer)af_face_globals_free; + face->autohint.data = (FT_Pointer)globals; + face->autohint.finalizer = af_face_globals_free; } } @@ -430,12 +428,14 @@ FT_CALLBACK_DEF( FT_Error ) - af_autofitter_load_glyph( AF_Module module, - FT_GlyphSlot slot, - FT_Size size, - FT_UInt glyph_index, - FT_Int32 load_flags ) + af_autofitter_load_glyph( FT_AutoHinter module_, + FT_GlyphSlot slot, + FT_Size size, + FT_UInt glyph_index, + FT_Int32 load_flags ) { + AF_Module module = (AF_Module)module_; + FT_Error error = FT_Err_Ok; FT_Memory memory = module->root.library->memory; -- cgit v1.2.3 From 669b7f7d6b924c11e30b0459eba911d29194a542 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 7 May 2023 20:26:12 +0200 Subject: [pshinter] Signature fixes. * src/pshinter/pshrec.c (t1_hints_close, t1_hints_apply): New wrapper functions. (t1_hints_funcs_init): Use them. (t2_hints_close, t2_hints_apply): New wrapper functions. (t2_hints_funcs_init): Use them. --- src/pshinter/pshmod.c | 9 ++++++-- src/pshinter/pshrec.c | 63 +++++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 58 insertions(+), 14 deletions(-) diff --git a/src/pshinter/pshmod.c b/src/pshinter/pshmod.c index a12e48566..974a99e01 100644 --- a/src/pshinter/pshmod.c +++ b/src/pshinter/pshmod.c @@ -37,8 +37,11 @@ /* finalize module */ FT_CALLBACK_DEF( void ) - ps_hinter_done( PS_Hinter_Module module ) + ps_hinter_done( FT_Module module_ ) /* PS_Hinter_Module */ { + PS_Hinter_Module module = (PS_Hinter_Module)module_; + + module->t1_funcs.hints = NULL; module->t2_funcs.hints = NULL; @@ -48,8 +51,10 @@ /* initialize module, create hints recorder and the interface */ FT_CALLBACK_DEF( FT_Error ) - ps_hinter_init( PS_Hinter_Module module ) + ps_hinter_init( FT_Module module_ ) /* PS_Hinter_Module */ { + PS_Hinter_Module module = (PS_Hinter_Module)module_; + FT_Memory memory = module->root.memory; void* ph = &module->ps_hints; diff --git a/src/pshinter/pshrec.c b/src/pshinter/pshrec.c index 58c8cf1b4..680e6d013 100644 --- a/src/pshinter/pshrec.c +++ b/src/pshinter/pshrec.c @@ -851,10 +851,11 @@ /* add one Type1 counter stem to the current hints table */ static void - ps_hints_t1stem3( PS_Hints hints, + ps_hints_t1stem3( T1_Hints hints_, /* PS_Hints */ FT_UInt dimension, FT_Fixed* stems ) { + PS_Hints hints = (PS_Hints)hints_; FT_Error error = FT_Err_Ok; @@ -914,9 +915,10 @@ /* reset hints (only with Type 1 hints) */ static void - ps_hints_t1reset( PS_Hints hints, + ps_hints_t1reset( T1_Hints hints_, /* PS_Hints */ FT_UInt end_point ) { + PS_Hints hints = (PS_Hints)hints_; FT_Error error = FT_Err_Ok; @@ -953,11 +955,12 @@ /* Type2 "hintmask" operator, add a new hintmask to each direction */ static void - ps_hints_t2mask( PS_Hints hints, + ps_hints_t2mask( T2_Hints hints_, /* PS_Hints */ FT_UInt end_point, FT_UInt bit_count, const FT_Byte* bytes ) { + PS_Hints hints = (PS_Hints)hints_; FT_Error error; @@ -999,10 +1002,11 @@ static void - ps_hints_t2counter( PS_Hints hints, + ps_hints_t2counter( T2_Hints hints_, /* PS_Hints */ FT_UInt bit_count, const FT_Byte* bytes ) { + PS_Hints hints = (PS_Hints)hints_; FT_Error error; @@ -1087,6 +1091,13 @@ ps_hints_open( (PS_Hints)hints, PS_HINT_TYPE_1 ); } + static FT_Error + t1_hints_close( T1_Hints hints, + FT_UInt end_point ) + { + return ps_hints_close( (PS_Hints)hints, end_point ); + } + static void t1_hints_stem( T1_Hints hints, FT_UInt dimension, @@ -1102,17 +1113,27 @@ } + static FT_Error + t1_hints_apply( T1_Hints hints, + FT_Outline* outline, + PSH_Globals globals, + FT_Render_Mode hint_mode ) + { + return ps_hints_apply( (PS_Hints)hints, outline, globals, hint_mode ); + } + + FT_LOCAL_DEF( void ) t1_hints_funcs_init( T1_Hints_FuncsRec* funcs ) { FT_ZERO( funcs ); funcs->open = (T1_Hints_OpenFunc) t1_hints_open; - funcs->close = (T1_Hints_CloseFunc) ps_hints_close; + funcs->close = (T1_Hints_CloseFunc) t1_hints_close; funcs->stem = (T1_Hints_SetStemFunc) t1_hints_stem; funcs->stem3 = (T1_Hints_SetStem3Func)ps_hints_t1stem3; funcs->reset = (T1_Hints_ResetFunc) ps_hints_t1reset; - funcs->apply = (T1_Hints_ApplyFunc) ps_hints_apply; + funcs->apply = (T1_Hints_ApplyFunc) t1_hints_apply; } @@ -1131,6 +1152,14 @@ } + static FT_Error + t2_hints_close( T2_Hints hints, + FT_UInt end_point ) + { + return ps_hints_close( (PS_Hints)hints, end_point ); + } + + static void t2_hints_stems( T2_Hints hints, FT_UInt dimension, @@ -1168,17 +1197,27 @@ } + static FT_Error + t2_hints_apply( T2_Hints hints, + FT_Outline* outline, + PSH_Globals globals, + FT_Render_Mode hint_mode ) + { + return ps_hints_apply( (PS_Hints)hints, outline, globals, hint_mode ); + } + + FT_LOCAL_DEF( void ) t2_hints_funcs_init( T2_Hints_FuncsRec* funcs ) { FT_ZERO( funcs ); - funcs->open = (T2_Hints_OpenFunc) t2_hints_open; - funcs->close = (T2_Hints_CloseFunc) ps_hints_close; - funcs->stems = (T2_Hints_StemsFunc) t2_hints_stems; - funcs->hintmask= (T2_Hints_MaskFunc) ps_hints_t2mask; - funcs->counter = (T2_Hints_CounterFunc)ps_hints_t2counter; - funcs->apply = (T2_Hints_ApplyFunc) ps_hints_apply; + funcs->open = (T2_Hints_OpenFunc) t2_hints_open; + funcs->close = (T2_Hints_CloseFunc) t2_hints_close; + funcs->stems = (T2_Hints_StemsFunc) t2_hints_stems; + funcs->hintmask = (T2_Hints_MaskFunc) ps_hints_t2mask; + funcs->counter = (T2_Hints_CounterFunc)ps_hints_t2counter; + funcs->apply = (T2_Hints_ApplyFunc) t2_hints_apply; } -- cgit v1.2.3 From 02283a6e99d0df31e958119bb534f1672de8c8f6 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 7 May 2023 20:37:38 +0200 Subject: [smooth] Signature fixes. --- src/smooth/ftgrays.c | 26 ++++++++++++++++++++------ src/smooth/ftsmooth.c | 22 ++++++++++++++++------ 2 files changed, 36 insertions(+), 12 deletions(-) diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c index 05478f41c..1e2f7ad8b 100644 --- a/src/smooth/ftgrays.c +++ b/src/smooth/ftgrays.c @@ -1427,8 +1427,10 @@ typedef ptrdiff_t FT_PtrDist; static int gray_move_to( const FT_Vector* to, - gray_PWorker worker ) + void* worker_ ) /* gray_PWorker */ { + gray_PWorker worker = (gray_PWorker)worker_; + TPos x, y; @@ -1446,8 +1448,11 @@ typedef ptrdiff_t FT_PtrDist; static int gray_line_to( const FT_Vector* to, - gray_PWorker worker ) + void* worker_ ) /* gray_PWorker */ { + gray_PWorker worker = (gray_PWorker)worker_; + + gray_render_line( RAS_VAR_ UPSCALE( to->x ), UPSCALE( to->y ) ); return 0; } @@ -1456,8 +1461,11 @@ typedef ptrdiff_t FT_PtrDist; static int gray_conic_to( const FT_Vector* control, const FT_Vector* to, - gray_PWorker worker ) + void* worker_ ) /* gray_PWorker */ { + gray_PWorker worker = (gray_PWorker)worker_; + + gray_render_conic( RAS_VAR_ control, to ); return 0; } @@ -1467,8 +1475,11 @@ typedef ptrdiff_t FT_PtrDist; gray_cubic_to( const FT_Vector* control1, const FT_Vector* control2, const FT_Vector* to, - gray_PWorker worker ) + void* worker_ ) /* gray_PWorker */ { + gray_PWorker worker = (gray_PWorker)worker_; + + gray_render_cubic( RAS_VAR_ control1, control2, to ); return 0; } @@ -2155,9 +2166,12 @@ typedef ptrdiff_t FT_PtrDist; #else /* !STANDALONE_ */ static int - gray_raster_new( FT_Memory memory, - gray_PRaster* araster ) + gray_raster_new( void* memory_, + FT_Raster* araster_ ) { + FT_Memory memory = (FT_Memory)memory_; + gray_PRaster* araster = (gray_PRaster*)araster_; + FT_Error error; gray_PRaster raster = NULL; diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c index cdbc78c3e..9b0e8886c 100644 --- a/src/smooth/ftsmooth.c +++ b/src/smooth/ftsmooth.c @@ -87,8 +87,10 @@ /* initialize renderer -- init its raster */ static FT_Error - ft_smooth_init( FT_Renderer render ) + ft_smooth_init( FT_Module module ) /* FT_Renderer */ { + FT_Renderer render = (FT_Renderer)module; + FT_Vector* sub = render->root.library->lcd_geometry; @@ -111,8 +113,10 @@ ft_smooth_lcd_spans( int y, int count, const FT_Span* spans, - TOrigin* target ) + void* target_ ) /* TOrigin* */ { + TOrigin* target = (TOrigin*)target_; + unsigned char* dst_line = target->origin - y * target->pitch; unsigned char* dst; unsigned short w; @@ -141,7 +145,7 @@ /* Set up direct rendering to record them on each third byte. */ params.source = outline; params.flags = FT_RASTER_FLAG_AA | FT_RASTER_FLAG_DIRECT; - params.gray_spans = (FT_SpanFunc)ft_smooth_lcd_spans; + params.gray_spans = ft_smooth_lcd_spans; params.user = ⌖ params.clip_box.xMin = 0; @@ -256,8 +260,11 @@ /* initialize renderer -- init its raster */ static FT_Error - ft_smooth_init( FT_Renderer render ) + ft_smooth_init( FT_Module module ) /* FT_Renderer */ { + FT_Renderer render = (FT_Renderer)module; + + /* set up default LCD filtering */ FT_Library_SetLcdFilter( render->root.library, FT_LCD_FILTER_DEFAULT ); @@ -340,8 +347,11 @@ ft_smooth_overlap_spans( int y, int count, const FT_Span* spans, - TOrigin* target ) + void* target_ ) { + TOrigin* target = (TOrigin*)target_; + + unsigned char* dst = target->origin - ( y / SCALE ) * target->pitch; unsigned short x; unsigned int cover, sum; @@ -386,7 +396,7 @@ /* Set up direct rendering to average oversampled spans. */ params.source = outline; params.flags = FT_RASTER_FLAG_AA | FT_RASTER_FLAG_DIRECT; - params.gray_spans = (FT_SpanFunc)ft_smooth_overlap_spans; + params.gray_spans = ft_smooth_overlap_spans; params.user = ⌖ params.clip_box.xMin = 0; -- cgit v1.2.3 From 6e7b1b7650559d437a66e91098376c5363c4c241 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 7 May 2023 20:51:32 +0200 Subject: [raster] Signature fixes. --- src/raster/ftraster.c | 12 ++++++++---- src/raster/ftrend1.c | 5 ++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/raster/ftraster.c b/src/raster/ftraster.c index 59b27a408..c997fa9e6 100644 --- a/src/raster/ftraster.c +++ b/src/raster/ftraster.c @@ -3165,9 +3165,12 @@ static int - ft_black_new( FT_Memory memory, - black_PRaster *araster ) + ft_black_new( void* memory_, /* FT_Memory */ + FT_Raster *araster_ ) /* black_PRaster */ { + FT_Memory memory = (FT_Memory)memory_; + black_PRaster *araster = (black_PRaster*)araster_; + FT_Error error; black_PRaster raster = NULL; @@ -3182,9 +3185,10 @@ static void - ft_black_done( black_PRaster raster ) + ft_black_done( FT_Raster raster_ ) /* black_PRaster */ { - FT_Memory memory = (FT_Memory)raster->memory; + black_PRaster raster = (black_PRaster)raster_; + FT_Memory memory = (FT_Memory)raster->memory; FT_FREE( raster ); diff --git a/src/raster/ftrend1.c b/src/raster/ftrend1.c index 0b5d86714..7a59ccc2f 100644 --- a/src/raster/ftrend1.c +++ b/src/raster/ftrend1.c @@ -27,8 +27,11 @@ /* initialize renderer -- init its raster */ static FT_Error - ft_raster1_init( FT_Renderer render ) + ft_raster1_init( FT_Module module ) /* FT_Renderer */ { + FT_Renderer render = (FT_Renderer)module; + + render->clazz->raster_class->raster_reset( render->raster, NULL, 0 ); return FT_Err_Ok; -- cgit v1.2.3 From 924329a9b0946afd8ca740224e8ba7f94493cb88 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 7 May 2023 20:57:22 +0200 Subject: * src/svg/ftsvg.c: Signature fixes. --- src/svg/ftsvg.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/svg/ftsvg.c b/src/svg/ftsvg.c index 7edb1a338..e353d47d2 100644 --- a/src/svg/ftsvg.c +++ b/src/svg/ftsvg.c @@ -40,26 +40,31 @@ /* ft_svg_init */ static FT_Error - ft_svg_init( SVG_Renderer svg_module ) + ft_svg_init( FT_Module module ) { + SVG_Renderer render = (SVG_Renderer)module; + FT_Error error = FT_Err_Ok; - svg_module->loaded = FALSE; - svg_module->hooks_set = FALSE; + render->loaded = FALSE; + render->hooks_set = FALSE; return error; } static void - ft_svg_done( SVG_Renderer svg_module ) + ft_svg_done( FT_Module module ) { - if ( svg_module->loaded == TRUE && - svg_module->hooks_set == TRUE ) - svg_module->hooks.free_svg( &svg_module->state ); + SVG_Renderer render = (SVG_Renderer)module; + + + if ( render->loaded == TRUE && + render->hooks_set == TRUE ) + render->hooks.free_svg( &render->state ); - svg_module->loaded = FALSE; + render->loaded = FALSE; } @@ -203,7 +208,7 @@ static FT_Error ft_svg_property_get( FT_Module module, const char* property_name, - const void* value ) + void* value ) { FT_Error error = FT_Err_Ok; SVG_Renderer renderer = (SVG_Renderer)module; -- cgit v1.2.3 From c8ae37bab35eeeb1d59bf11cada70ce8569f2a2c Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 7 May 2023 21:06:14 +0200 Subject: [sdf] Signature fixes. --- src/sdf/ftbsdf.c | 7 +++++-- src/sdf/ftsdf.c | 8 ++++++-- src/sdf/ftsdfrend.c | 12 ++++++------ 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/sdf/ftbsdf.c b/src/sdf/ftbsdf.c index 901d8b740..e47273833 100644 --- a/src/sdf/ftbsdf.c +++ b/src/sdf/ftbsdf.c @@ -1173,9 +1173,12 @@ /* called when adding a new module through @FT_Add_Module */ static FT_Error - bsdf_raster_new( FT_Memory memory, - BSDF_PRaster* araster ) + bsdf_raster_new( void* memory_, /* FT_Memory */ + FT_Raster* araster_ ) /* BSDF_PRaster* */ { + FT_Memory memory = (FT_Memory)memory_; + BSDF_PRaster* araster = (BSDF_PRaster*)araster_; + FT_Error error; BSDF_PRaster raster = NULL; diff --git a/src/sdf/ftsdf.c b/src/sdf/ftsdf.c index 0a43e9be6..bc4625d98 100644 --- a/src/sdf/ftsdf.c +++ b/src/sdf/ftsdf.c @@ -3762,9 +3762,13 @@ */ static FT_Error - sdf_raster_new( FT_Memory memory, - SDF_PRaster* araster ) + sdf_raster_new( void* memory_, /* FT_Memory */ + FT_Raster* araster_ ) /* SDF_PRaster* */ { + FT_Memory memory = (FT_Memory)memory_; + SDF_PRaster* araster = (SDF_PRaster*)araster_; + + FT_Error error; SDF_PRaster raster = NULL; diff --git a/src/sdf/ftsdfrend.c b/src/sdf/ftsdfrend.c index 9ac7d6f62..c4d1a8cba 100644 --- a/src/sdf/ftsdfrend.c +++ b/src/sdf/ftsdfrend.c @@ -197,10 +197,10 @@ static FT_Module_Interface - ft_sdf_requester( FT_Renderer render, + ft_sdf_requester( FT_Module module, const char* module_interface ) { - FT_UNUSED( render ); + FT_UNUSED( module ); return ft_service_list_lookup( sdf_services, module_interface ); } @@ -221,9 +221,9 @@ */ static FT_Error - ft_sdf_init( FT_Renderer render ) + ft_sdf_init( FT_Module module ) /* SDF_Renderer */ { - SDF_Renderer sdf_render = SDF_RENDERER( render ); + SDF_Renderer sdf_render = SDF_RENDERER( module ); sdf_render->spread = DEFAULT_SPREAD; @@ -236,9 +236,9 @@ static void - ft_sdf_done( FT_Renderer render ) + ft_sdf_done( FT_Module module ) { - FT_UNUSED( render ); + FT_UNUSED( module ); } -- cgit v1.2.3 From d52166ae9d933f74249be2ae746ba9ca07de9c09 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 8 May 2023 06:15:44 +0200 Subject: [cache] Signature fixes. * src/cache/ftcglyph.c, src/cache/ftcglyph.h (FTC_GNode_Compare): Remove redundant function. It is equivalent to `ftc_gnode_compare` and becomes completely meaningless with fixed signatures. Update all callers. * src/cache/ftcsbits.c, src/cache/ftcsbits.h (FTC_SNode_Compare): Remove redundant function. It is equivalent to `ftc_snode_compare` and becomes completely meaningless with fixed signatures. Update all callers. --- src/cache/ftcbasic.c | 8 ++++---- src/cache/ftcglyph.c | 14 -------------- src/cache/ftcglyph.h | 15 +-------------- src/cache/ftcsbits.c | 15 --------------- src/cache/ftcsbits.h | 11 ----------- 5 files changed, 5 insertions(+), 58 deletions(-) diff --git a/src/cache/ftcbasic.c b/src/cache/ftcbasic.c index 4c6d41b2c..24a56c8d2 100644 --- a/src/cache/ftcbasic.c +++ b/src/cache/ftcbasic.c @@ -337,7 +337,7 @@ #if 1 /* inlining is about 50% faster! */ FTC_GCACHE_LOOKUP_CMP( cache, ftc_basic_family_compare, - FTC_GNode_Compare, + ftc_gnode_compare, hash, gindex, &query, node, @@ -411,7 +411,7 @@ FTC_GCACHE_LOOKUP_CMP( cache, ftc_basic_family_compare, - FTC_GNode_Compare, + ftc_gnode_compare, hash, gindex, &query, node, @@ -537,7 +537,7 @@ #if 1 /* inlining is about 50% faster! */ FTC_GCACHE_LOOKUP_CMP( cache, ftc_basic_family_compare, - FTC_SNode_Compare, + ftc_snode_compare, hash, gindex, &query, node, @@ -613,7 +613,7 @@ FTC_GCACHE_LOOKUP_CMP( cache, ftc_basic_family_compare, - FTC_SNode_Compare, + ftc_snode_compare, hash, gindex, &query, node, diff --git a/src/cache/ftcglyph.c b/src/cache/ftcglyph.c index b3fb2f219..5cbda318f 100644 --- a/src/cache/ftcglyph.c +++ b/src/cache/ftcglyph.c @@ -79,20 +79,6 @@ } -#ifdef FTC_INLINE - - FT_LOCAL_DEF( FT_Bool ) - FTC_GNode_Compare( FTC_GNode gnode, - FTC_GQuery gquery, - FTC_Cache cache, - FT_Bool* list_changed ) - { - return ftc_gnode_compare( FTC_NODE( gnode ), gquery, - cache, list_changed ); - } - -#endif - /*************************************************************************/ /*************************************************************************/ /***** *****/ diff --git a/src/cache/ftcglyph.h b/src/cache/ftcglyph.h index 728d4db1d..0181e9816 100644 --- a/src/cache/ftcglyph.h +++ b/src/cache/ftcglyph.h @@ -58,7 +58,7 @@ * - FTC_GNode sub-class, e.g. MyNode, with relevant methods: * my_node_new (must call FTC_GNode_Init) * my_node_free (must call FTC_GNode_Done) - * my_node_compare (must call FTC_GNode_Compare) + * my_node_compare (must call ftc_gnode_compare) * my_node_remove_faceid (must call ftc_gnode_unselect in case * of match) * @@ -179,19 +179,6 @@ FT_BEGIN_HEADER FT_UInt gindex, /* glyph index for node */ FTC_Family family ); -#ifdef FTC_INLINE - - /* returns TRUE iff the query's glyph index correspond to the node; */ - /* this assumes that the `family' and `hash' fields of the query are */ - /* already correctly set */ - FT_LOCAL( FT_Bool ) - FTC_GNode_Compare( FTC_GNode gnode, - FTC_GQuery gquery, - FTC_Cache cache, - FT_Bool* list_changed ); - -#endif - /* call this function to clear a node's family -- this is necessary */ /* to implement the `node_remove_faceid' cache method correctly */ FT_LOCAL( void ) diff --git a/src/cache/ftcsbits.c b/src/cache/ftcsbits.c index ee9dab263..216a710e3 100644 --- a/src/cache/ftcsbits.c +++ b/src/cache/ftcsbits.c @@ -411,19 +411,4 @@ return result; } - -#ifdef FTC_INLINE - - FT_LOCAL_DEF( FT_Bool ) - FTC_SNode_Compare( FTC_SNode snode, - FTC_GQuery gquery, - FTC_Cache cache, - FT_Bool* list_changed ) - { - return ftc_snode_compare( FTC_NODE( snode ), gquery, - cache, list_changed ); - } - -#endif - /* END */ diff --git a/src/cache/ftcsbits.h b/src/cache/ftcsbits.h index 3473923f0..e833cb5c3 100644 --- a/src/cache/ftcsbits.h +++ b/src/cache/ftcsbits.h @@ -81,17 +81,6 @@ FT_BEGIN_HEADER FTC_SNode_Weight( FTC_SNode inode ); #endif - -#ifdef FTC_INLINE - - FT_LOCAL( FT_Bool ) - FTC_SNode_Compare( FTC_SNode snode, - FTC_GQuery gquery, - FTC_Cache cache, - FT_Bool* list_changed); - -#endif - /* */ FT_END_HEADER -- cgit v1.2.3 From 968fc281acc3dc2d7ad82f9d439b8e248aa0ffba Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 8 May 2023 06:26:43 +0200 Subject: * src/bzip2/ftbzip2.c: Signature fixes. --- src/bzip2/ftbzip2.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/bzip2/ftbzip2.c b/src/bzip2/ftbzip2.c index 6cf10678b..ad342bd01 100644 --- a/src/bzip2/ftbzip2.c +++ b/src/bzip2/ftbzip2.c @@ -62,10 +62,12 @@ static void* - ft_bzip2_alloc( FT_Memory memory, - int items, - int size ) + ft_bzip2_alloc( void* memory_, /* FT_Memory */ + int items, + int size ) { + FT_Memory memory = (FT_Memory)memory_; + FT_ULong sz = (FT_ULong)size * (FT_ULong)items; FT_Error error; FT_Pointer p = NULL; @@ -77,9 +79,12 @@ static void - ft_bzip2_free( FT_Memory memory, - void* address ) + ft_bzip2_free( void* memory_, /* FT_Memory */ + void* address ) { + FT_Memory memory = (FT_Memory)memory_; + + FT_MEM_FREE( address ); } @@ -170,8 +175,8 @@ } /* initialize bzlib */ - bzstream->bzalloc = (alloc_func)ft_bzip2_alloc; - bzstream->bzfree = (free_func) ft_bzip2_free; + bzstream->bzalloc = ft_bzip2_alloc; + bzstream->bzfree = ft_bzip2_free; bzstream->opaque = zip->memory; bzstream->avail_in = 0; -- cgit v1.2.3 From bd37b8471803a006c0bfb14470293d5dc1c297ea Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 8 May 2023 06:46:55 +0200 Subject: * src/psaux/t1cmap.c: Signature fixes. --- src/psaux/t1cmap.c | 135 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 77 insertions(+), 58 deletions(-) diff --git a/src/psaux/t1cmap.c b/src/psaux/t1cmap.c index f94b544f2..c4bcf599e 100644 --- a/src/psaux/t1cmap.c +++ b/src/psaux/t1cmap.c @@ -50,8 +50,11 @@ FT_CALLBACK_DEF( void ) - t1_cmap_std_done( T1_CMapStd cmap ) + t1_cmap_std_done( FT_CMap cmap_ ) /* T1_CMapStd */ { + T1_CMapStd cmap = (T1_CMapStd)cmap_; + + cmap->num_glyphs = 0; cmap->glyph_names = NULL; cmap->sid_to_string = NULL; @@ -60,10 +63,11 @@ FT_CALLBACK_DEF( FT_UInt ) - t1_cmap_std_char_index( T1_CMapStd cmap, - FT_UInt32 char_code ) + t1_cmap_std_char_index( FT_CMap cmap, /* T1_CMapStd */ + FT_UInt32 char_code ) { - FT_UInt result = 0; + T1_CMapStd t1cmap = (T1_CMapStd)cmap; + FT_UInt result = 0; if ( char_code < 256 ) @@ -73,13 +77,13 @@ /* convert character code to Adobe SID string */ - code = cmap->code_to_sid[char_code]; - glyph_name = cmap->sid_to_string( code ); + code = t1cmap->code_to_sid[char_code]; + glyph_name = t1cmap->sid_to_string( code ); /* look for the corresponding glyph name */ - for ( n = 0; n < cmap->num_glyphs; n++ ) + for ( n = 0; n < t1cmap->num_glyphs; n++ ) { - const char* gname = cmap->glyph_names[n]; + const char* gname = t1cmap->glyph_names[n]; if ( gname && gname[0] == glyph_name[0] && @@ -96,8 +100,8 @@ FT_CALLBACK_DEF( FT_UInt ) - t1_cmap_std_char_next( T1_CMapStd cmap, - FT_UInt32 *pchar_code ) + t1_cmap_std_char_next( FT_CMap cmap, + FT_UInt32 *pchar_code ) { FT_UInt result = 0; FT_UInt32 char_code = *pchar_code + 1; @@ -120,13 +124,14 @@ FT_CALLBACK_DEF( FT_Error ) - t1_cmap_standard_init( T1_CMapStd cmap, + t1_cmap_standard_init( FT_CMap cmap, /* T1_CMapStd */ FT_Pointer pointer ) { + T1_CMapStd t1cmap = (T1_CMapStd)cmap; FT_UNUSED( pointer ); - t1_cmap_std_init( cmap, 0 ); + t1_cmap_std_init( t1cmap, 0 ); return 0; } @@ -150,13 +155,14 @@ FT_CALLBACK_DEF( FT_Error ) - t1_cmap_expert_init( T1_CMapStd cmap, + t1_cmap_expert_init( FT_CMap cmap, /* T1_CMapStd */ FT_Pointer pointer ) { + T1_CMapStd t1cmap = (T1_CMapStd)cmap; FT_UNUSED( pointer ); - t1_cmap_std_init( cmap, 1 ); + t1_cmap_std_init( t1cmap, 1 ); return 0; } @@ -188,20 +194,21 @@ FT_CALLBACK_DEF( FT_Error ) - t1_cmap_custom_init( T1_CMapCustom cmap, - FT_Pointer pointer ) + t1_cmap_custom_init( FT_CMap cmap, /* T1_CMapCustom */ + FT_Pointer pointer ) { - T1_Face face = (T1_Face)FT_CMAP_FACE( cmap ); - T1_Encoding encoding = &face->type1.encoding; + T1_CMapCustom t1cmap = (T1_CMapCustom)cmap; + T1_Face face = (T1_Face)FT_CMAP_FACE( cmap ); + T1_Encoding encoding = &face->type1.encoding; FT_UNUSED( pointer ); - cmap->first = (FT_UInt)encoding->code_first; - cmap->count = (FT_UInt)encoding->code_last - cmap->first; - cmap->indices = encoding->char_index; + t1cmap->first = (FT_UInt)encoding->code_first; + t1cmap->count = (FT_UInt)encoding->code_last - t1cmap->first; + t1cmap->indices = encoding->char_index; - FT_ASSERT( cmap->indices ); + FT_ASSERT( t1cmap->indices ); FT_ASSERT( encoding->code_first <= encoding->code_last ); return 0; @@ -209,45 +216,50 @@ FT_CALLBACK_DEF( void ) - t1_cmap_custom_done( T1_CMapCustom cmap ) + t1_cmap_custom_done( FT_CMap cmap ) /* T1_CMapCustom */ { - cmap->indices = NULL; - cmap->first = 0; - cmap->count = 0; + T1_CMapCustom t1cmap = (T1_CMapCustom)cmap; + + + t1cmap->indices = NULL; + t1cmap->first = 0; + t1cmap->count = 0; } FT_CALLBACK_DEF( FT_UInt ) - t1_cmap_custom_char_index( T1_CMapCustom cmap, - FT_UInt32 char_code ) + t1_cmap_custom_char_index( FT_CMap cmap, /* T1_CMapCustom */ + FT_UInt32 char_code ) { - FT_UInt result = 0; + T1_CMapCustom t1cmap = (T1_CMapCustom)cmap; + FT_UInt result = 0; - if ( ( char_code >= cmap->first ) && - ( char_code < ( cmap->first + cmap->count ) ) ) - result = cmap->indices[char_code]; + if ( char_code >= t1cmap->first && + char_code < ( t1cmap->first + t1cmap->count ) ) + result = t1cmap->indices[char_code]; return result; } FT_CALLBACK_DEF( FT_UInt ) - t1_cmap_custom_char_next( T1_CMapCustom cmap, - FT_UInt32 *pchar_code ) + t1_cmap_custom_char_next( FT_CMap cmap, /* T1_CMapCustom */ + FT_UInt32 *pchar_code ) { - FT_UInt result = 0; - FT_UInt32 char_code = *pchar_code; + T1_CMapCustom t1cmap = (T1_CMapCustom)cmap; + FT_UInt result = 0; + FT_UInt32 char_code = *pchar_code; char_code++; - if ( char_code < cmap->first ) - char_code = cmap->first; + if ( char_code < t1cmap->first ) + char_code = t1cmap->first; - for ( ; char_code < ( cmap->first + cmap->count ); char_code++ ) + for ( ; char_code < ( t1cmap->first + t1cmap->count ); char_code++ ) { - result = cmap->indices[char_code]; + result = t1cmap->indices[char_code]; if ( result != 0 ) goto Exit; } @@ -287,20 +299,24 @@ /*************************************************************************/ FT_CALLBACK_DEF( const char * ) - psaux_get_glyph_name( T1_Face face, + psaux_get_glyph_name( void* face_, FT_UInt idx ) { + T1_Face face = (T1_Face)face_; + + return face->type1.glyph_names[idx]; } FT_CALLBACK_DEF( FT_Error ) - t1_cmap_unicode_init( PS_Unicodes unicodes, - FT_Pointer pointer ) + t1_cmap_unicode_init( FT_CMap cmap, /* PS_Unicodes */ + FT_Pointer pointer ) { - T1_Face face = (T1_Face)FT_CMAP_FACE( unicodes ); - FT_Memory memory = FT_FACE_MEMORY( face ); - FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames; + PS_Unicodes unicodes = (PS_Unicodes)cmap; + T1_Face face = (T1_Face)FT_CMAP_FACE( cmap ); + FT_Memory memory = FT_FACE_MEMORY( face ); + FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames; FT_UNUSED( pointer ); @@ -311,17 +327,18 @@ return psnames->unicodes_init( memory, unicodes, (FT_UInt)face->type1.num_glyphs, - (PS_GetGlyphNameFunc)&psaux_get_glyph_name, + &psaux_get_glyph_name, (PS_FreeGlyphNameFunc)NULL, (FT_Pointer)face ); } FT_CALLBACK_DEF( void ) - t1_cmap_unicode_done( PS_Unicodes unicodes ) + t1_cmap_unicode_done( FT_CMap cmap ) /* PS_Unicodes */ { - FT_Face face = FT_CMAP_FACE( unicodes ); - FT_Memory memory = FT_FACE_MEMORY( face ); + PS_Unicodes unicodes = (PS_Unicodes)cmap; + FT_Face face = FT_CMAP_FACE( cmap ); + FT_Memory memory = FT_FACE_MEMORY( face ); FT_FREE( unicodes->maps ); @@ -330,11 +347,12 @@ FT_CALLBACK_DEF( FT_UInt ) - t1_cmap_unicode_char_index( PS_Unicodes unicodes, - FT_UInt32 char_code ) + t1_cmap_unicode_char_index( FT_CMap cmap, /* PS_Unicodes */ + FT_UInt32 char_code ) { - T1_Face face = (T1_Face)FT_CMAP_FACE( unicodes ); - FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames; + PS_Unicodes unicodes = (PS_Unicodes)cmap; + T1_Face face = (T1_Face)FT_CMAP_FACE( cmap ); + FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames; return psnames->unicodes_char_index( unicodes, char_code ); @@ -342,11 +360,12 @@ FT_CALLBACK_DEF( FT_UInt ) - t1_cmap_unicode_char_next( PS_Unicodes unicodes, - FT_UInt32 *pchar_code ) + t1_cmap_unicode_char_next( FT_CMap cmap, /* PS_Unicodes */ + FT_UInt32 *pchar_code ) { - T1_Face face = (T1_Face)FT_CMAP_FACE( unicodes ); - FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames; + PS_Unicodes unicodes = (PS_Unicodes)cmap; + T1_Face face = (T1_Face)FT_CMAP_FACE( cmap ); + FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames; return psnames->unicodes_char_next( unicodes, pchar_code ); -- cgit v1.2.3 From 5edd6d52b1b610c9f4445f0ca941a624d2ad56c3 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 8 May 2023 07:22:59 +0200 Subject: Minor compiler warning fixes. * src/autofit/afcjk.c (af_cjk_get_standard_widths), src/autofit/aflatin.c (af_latin_get_standard_widths): Use `FT_CALLBACK_DEF`. * src/cff/cffparse.c (cff_parser_run): Initialize and fix allocation of `q`. --- src/autofit/afcjk.c | 2 +- src/autofit/aflatin.c | 2 +- src/cff/cffparse.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c index fdb8e8f6d..3466bb9f9 100644 --- a/src/autofit/afcjk.c +++ b/src/autofit/afcjk.c @@ -773,7 +773,7 @@ /* Extract standard_width from writing system/script specific */ /* metrics class. */ - FT_LOCAL_DEF( void ) + FT_CALLBACK_DEF( void ) af_cjk_get_standard_widths( AF_StyleMetrics metrics_, /* AF_CJKMetrics */ FT_Pos* stdHW, FT_Pos* stdVW ) diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c index e98861c3a..6f672d593 100644 --- a/src/autofit/aflatin.c +++ b/src/autofit/aflatin.c @@ -1506,7 +1506,7 @@ /* Extract standard_width from writing system/script specific */ /* metrics class. */ - FT_LOCAL_DEF( void ) + FT_CALLBACK_DEF( void ) af_latin_get_standard_widths( AF_StyleMetrics metrics_, /* AF_LatinMetrics */ FT_Pos* stdHW, FT_Pos* stdVW ) diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c index 89a0263b7..c850dfc61 100644 --- a/src/cff/cffparse.c +++ b/src/cff/cffparse.c @@ -1200,8 +1200,8 @@ FT_Byte* charstring_base; FT_ULong charstring_len; - FT_Fixed* stack; - FT_Byte* q; + FT_Fixed* stack; + FT_Byte* q = NULL; charstring_base = ++p; @@ -1243,7 +1243,7 @@ /* converting it back to charstring number representations */ /* (this is ugly, I know). */ /* The maximum required size is 5 bytes per stack element. */ - if ( FT_QALLOC( q, 2 * sizeof ( FT_ListNode ) + + if ( FT_QALLOC( q, (FT_Long)( 2 * sizeof ( FT_ListNode ) ) + 5 * ( decoder.top - decoder.stack ) ) ) goto Exit; -- cgit v1.2.3 From e02a40a4f8754774c8dccc01aeb0f07ea58e81c7 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 8 May 2023 20:12:26 +0200 Subject: * src/cff/cffdrivr.c (cff_glyph_load): Fix guard for `size`. This was forgotten to change in commit 2b54eba36b (in May 2004). Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=58739 --- src/cff/cffdrivr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index 3d08f8d5b..7ee26a9f4 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -181,7 +181,7 @@ if ( load_flags & FT_LOAD_NO_SCALE ) size = NULL; - if ( cffsize ) + if ( size ) { /* these two objects must have the same parent */ if ( size->face != slot->face ) -- cgit v1.2.3 From c3876354e5c0812ae5929f7e68849c2e611b720c Mon Sep 17 00:00:00 2001 From: Jouk Jansen Date: Tue, 9 May 2023 07:15:53 +0200 Subject: * src/smooth/ftgrays.c (FT_SSE2): Don't define for VMS. --- src/smooth/ftgrays.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c index 1e2f7ad8b..6252df98a 100644 --- a/src/smooth/ftgrays.c +++ b/src/smooth/ftgrays.c @@ -1006,9 +1006,9 @@ typedef ptrdiff_t FT_PtrDist; * * For other cases, using binary splits is actually slightly faster. */ -#if defined( __SSE2__ ) || \ - defined( __x86_64__ ) || \ - defined( _M_AMD64 ) || \ +#if defined( __SSE2__ ) || \ + ( defined( __x86_64__ ) && !defined( __VMS ) ) || \ + defined( _M_AMD64 ) || \ ( defined( _M_IX86_FP ) && _M_IX86_FP >= 2 ) # define FT_SSE2 1 #else -- cgit v1.2.3 From 6ca0a9356ff05c15edbc2bbd905221beacbef447 Mon Sep 17 00:00:00 2001 From: suzuki toshiya Date: Thu, 11 May 2023 14:31:23 +0000 Subject: [t1cid] Set FT_FACE_FLAG_CID_KEYED. * cidobjs.c (cid_face_init): Set FT_FACE_FLAG_CID_KEYED. * cidriver.c (cid_get_is_cid): Comment about the case that is_cid cannot guarantee the glyph collection specification. --- src/cid/cidobjs.c | 8 ++++++++ src/cid/cidriver.c | 8 +++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c index 1fc121c00..e11c41d8b 100644 --- a/src/cid/cidobjs.c +++ b/src/cid/cidobjs.c @@ -374,6 +374,14 @@ if ( info->is_fixed_pitch ) cidface->face_flags |= FT_FACE_FLAG_FIXED_WIDTH; + /* + * For the sfnt-wrapped CID fonts for MacOS, currently, + * its `cmap' tables are ignored, and the content in + * its `CID ' table is treated the same as naked CID-keyed + * font. See ft_lookup_PS_in_sfnt_stream(). + */ + cidface->face_flags |= FT_FACE_FLAG_CID_KEYED; + /* XXX: TODO: add kerning with .afm support */ /* get style name -- be careful, some broken fonts only */ diff --git a/src/cid/cidriver.c b/src/cid/cidriver.c index fd015ef2e..0907b1dcf 100644 --- a/src/cid/cidriver.c +++ b/src/cid/cidriver.c @@ -141,8 +141,14 @@ FT_UNUSED( face ); + /* + * XXX: If the ROS is Adobe-Identity-H or -V, + * the font has no reliable information about + * its glyph collection. Should we not set + * *is_cid in such cases? + */ if ( is_cid ) - *is_cid = 1; /* cid driver is only used for CID keyed fonts */ + *is_cid = 1; return error; } -- cgit v1.2.3 From ad708d70c9d5dc0553e4caa6097b150f6e6843e9 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Thu, 11 May 2023 17:41:49 -0400 Subject: [cache] Revise the dynamic hash table accounting. Instead of counting entries relative to the middle of the hash table, this switches to the absolute counter with the full index range mask. As a result, some calculations become a bit simpler. The cache resizing logic stays largely the same. * src/cache/ftccache.h (FTC_NODE_TOP_FOR_HASH): Revised with new counter. * src/cache/ftccache.c (ftc_get_top_node_for_hash): Ditto. (ftc_cache_resize): Simplify reallocations and stop their zeroing. (ftc_cache_init): Stop over-allocating but keep zeroing initially. (FTC_Cache_Clear, FTC_Cache_RemoveFaceID): Updated accordingly. --- src/cache/ftccache.c | 76 ++++++++++++++++++++++++---------------------------- src/cache/ftccache.h | 17 +++++++----- 2 files changed, 45 insertions(+), 48 deletions(-) diff --git a/src/cache/ftccache.c b/src/cache/ftccache.c index ef7369d0a..e77c1468f 100644 --- a/src/cache/ftccache.c +++ b/src/cache/ftccache.c @@ -94,8 +94,8 @@ idx = hash & cache->mask; - if ( idx < cache->p ) - idx = hash & ( 2 * cache->mask + 1 ); + if ( idx >= cache->p ) + idx = hash & ( cache->mask >> 1 ); return cache->buckets + idx; } @@ -113,9 +113,9 @@ for (;;) { FTC_Node node, *pnode; - FT_UFast p = cache->p; - FT_UFast mask = cache->mask; - FT_UFast count = mask + p + 1; /* number of buckets */ + FT_UFast p = cache->p; + FT_UFast size = cache->mask + 1; /* available size */ + FT_UFast half = size >> 1; /* do we need to expand the buckets array? */ @@ -127,20 +127,22 @@ /* try to expand the buckets array _before_ splitting * the bucket lists */ - if ( p >= mask ) + if ( p == size ) { FT_Memory memory = cache->memory; FT_Error error; /* if we can't expand the array, leave immediately */ - if ( FT_RENEW_ARRAY( cache->buckets, - ( mask + 1 ) * 2, ( mask + 1 ) * 4 ) ) + if ( FT_QRENEW_ARRAY( cache->buckets, size, size * 2 ) ) break; + + cache->mask = 2 * size - 1; + half = size; } - /* split a single bucket */ - pnode = cache->buckets + p; + /* the bucket to split */ + pnode = cache->buckets + p - half; for (;;) { @@ -148,7 +150,7 @@ if ( !node ) break; - if ( node->hash & ( mask + 1 ) ) + if ( node->hash & half ) { *pnode = node->link; node->link = new_list; @@ -158,56 +160,50 @@ pnode = &node->link; } - cache->buckets[p + mask + 1] = new_list; + cache->buckets[p] = new_list; cache->slack += FTC_HASH_MAX_LOAD; + cache->p = p + 1; - if ( p >= mask ) - { - cache->mask = 2 * mask + 1; - cache->p = 0; - } - else - cache->p = p + 1; + FT_TRACE2(( "ftc_cache_resize: cache %u increased to %u hashes\n", + cache->index, cache->p )); } /* do we need to shrink the buckets array? */ - else if ( cache->slack > (FT_Long)count * FTC_HASH_SUB_LOAD ) + else if ( cache->slack > (FT_Long)p * FTC_HASH_SUB_LOAD ) { - FT_UFast old_index = p + mask; - FTC_Node* pold; + FTC_Node old_list = cache->buckets[--p]; - if ( old_index + 1 <= FTC_HASH_INITIAL_SIZE ) + if ( p < FTC_HASH_INITIAL_SIZE ) break; - if ( p == 0 ) + if ( p == half ) { FT_Memory memory = cache->memory; FT_Error error; /* if we can't shrink the array, leave immediately */ - if ( FT_QRENEW_ARRAY( cache->buckets, - ( mask + 1 ) * 2, mask + 1 ) ) + if ( FT_QRENEW_ARRAY( cache->buckets, size, half ) ) break; - cache->mask >>= 1; - p = cache->mask; + cache->mask = half - 1; } - else - p--; - pnode = cache->buckets + p; + /* the bucket to merge */ + pnode = cache->buckets + p - half; + while ( *pnode ) pnode = &(*pnode)->link; - pold = cache->buckets + old_index; - *pnode = *pold; - *pold = NULL; + *pnode = old_list; cache->slack -= FTC_HASH_MAX_LOAD; cache->p = p; + + FT_TRACE2(( "ftc_cache_resize: cache %u decreased to %u hashes\n", + cache->index, cache->p )); } /* otherwise, the hash table is balanced */ @@ -336,11 +332,11 @@ FT_Error error; - cache->p = 0; + cache->p = FTC_HASH_INITIAL_SIZE; cache->mask = FTC_HASH_INITIAL_SIZE - 1; cache->slack = FTC_HASH_INITIAL_SIZE * FTC_HASH_MAX_LOAD; - FT_MEM_NEW_ARRAY( cache->buckets, FTC_HASH_INITIAL_SIZE * 2 ); + FT_MEM_NEW_ARRAY( cache->buckets, FTC_HASH_INITIAL_SIZE ); return error; } @@ -351,11 +347,9 @@ if ( cache && cache->buckets ) { FTC_Manager manager = cache->manager; + FT_UFast count = cache->p; FT_UFast i; - FT_UFast count; - - count = cache->p + cache->mask + 1; for ( i = 0; i < count; i++ ) { @@ -562,12 +556,12 @@ FTC_Cache_RemoveFaceID( FTC_Cache cache, FTC_FaceID face_id ) { - FT_UFast i, count; FTC_Manager manager = cache->manager; FTC_Node frees = NULL; + FT_UFast count = cache->p; + FT_UFast i; - count = cache->p + cache->mask + 1; for ( i = 0; i < count; i++ ) { FTC_Node* pnode = cache->buckets + i; diff --git a/src/cache/ftccache.h b/src/cache/ftccache.h index 23bcb6585..850d2554b 100644 --- a/src/cache/ftccache.h +++ b/src/cache/ftccache.h @@ -72,11 +72,12 @@ FT_BEGIN_HEADER #define FTC_NODE_NEXT( x ) FTC_NODE( (x)->mru.next ) #define FTC_NODE_PREV( x ) FTC_NODE( (x)->mru.prev ) + /* address the hash table entries */ #ifdef FTC_INLINE -#define FTC_NODE_TOP_FOR_HASH( cache, hash ) \ - ( ( cache )->buckets + \ - ( ( ( ( hash ) & ( cache )->mask ) < ( cache )->p ) \ - ? ( ( hash ) & ( ( cache )->mask * 2 + 1 ) ) \ +#define FTC_NODE_TOP_FOR_HASH( cache, hash ) \ + ( ( cache )->buckets + \ + ( ( ( ( hash ) & ( cache )->mask ) >= ( cache )->p ) \ + ? ( ( hash ) & ( ( cache )->mask >> 1 ) ) \ : ( ( hash ) & ( cache )->mask ) ) ) #else FT_LOCAL( FTC_Node* ) @@ -139,11 +140,13 @@ FT_BEGIN_HEADER } FTC_CacheClassRec; - /* each cache really implements a dynamic hash table to manage its nodes */ + /* each cache really implements a hash table to manage its nodes */ + /* the number of the table entries (buckets) can change dynamically */ + /* each bucket contains a linked lists of nodes for a given hash */ typedef struct FTC_CacheRec_ { - FT_UFast p; - FT_UFast mask; + FT_UFast p; /* hash table counter */ + FT_UFast mask; /* hash table index range */ FT_Long slack; FTC_Node* buckets; -- cgit v1.2.3 From 7132f5b0d1874c69dd9df731c2490a1a9112b846 Mon Sep 17 00:00:00 2001 From: suzuki toshiya Date: Fri, 12 May 2023 09:49:58 +0900 Subject: * include/freetype/internal/t1types.h: Fix the indentation. --- include/freetype/internal/t1types.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/include/freetype/internal/t1types.h b/include/freetype/internal/t1types.h index 5a105c587..b9c94398f 100644 --- a/include/freetype/internal/t1types.h +++ b/include/freetype/internal/t1types.h @@ -201,30 +201,30 @@ FT_BEGIN_HEADER typedef struct T1_FaceRec_ { - FT_FaceRec root; - T1_FontRec type1; - const void* psnames; - const void* psaux; - const void* afm_data; - FT_CharMapRec charmaprecs[2]; - FT_CharMap charmaps[2]; + FT_FaceRec root; + T1_FontRec type1; + const void* psnames; + const void* psaux; + const void* afm_data; + FT_CharMapRec charmaprecs[2]; + FT_CharMap charmaps[2]; /* support for Multiple Masters fonts */ - PS_Blend blend; + PS_Blend blend; /* undocumented, optional: indices of subroutines that express */ /* the NormalizeDesignVector and the ConvertDesignVector procedure, */ /* respectively, as Type 2 charstrings; -1 if keywords not present */ - FT_Int ndv_idx; - FT_Int cdv_idx; + FT_Int ndv_idx; + FT_Int cdv_idx; /* undocumented, optional: has the same meaning as len_buildchar */ /* for Type 2 fonts; manipulated by othersubrs 19, 24, and 25 */ - FT_UInt len_buildchar; - FT_Long* buildchar; + FT_UInt len_buildchar; + FT_Long* buildchar; /* since version 2.1 - interface to PostScript hinter */ - const void* pshinter; + const void* pshinter; } T1_FaceRec; -- cgit v1.2.3 From b07ab47b2acfd433d50f00cbac2be414fc17b982 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Thu, 11 May 2023 23:23:52 -0400 Subject: * include/freetype/ftcache.h: Formatted and updated. --- include/freetype/ftcache.h | 85 +++++++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 42 deletions(-) diff --git a/include/freetype/ftcache.h b/include/freetype/ftcache.h index c76869545..72e1d3fdb 100644 --- a/include/freetype/ftcache.h +++ b/include/freetype/ftcache.h @@ -43,60 +43,61 @@ FT_BEGIN_HEADER * objects, as well as caching information like character maps and glyph * images while limiting their maximum memory usage. * - * Note that all types and functions begin with the `FTC_` prefix. - * - * The cache is highly portable and thus doesn't know anything about the - * fonts installed on your system, or how to access them. This implies - * the following scheme: - * - * First, available or installed font faces are uniquely identified by - * @FTC_FaceID values, provided to the cache by the client. Note that - * the cache only stores and compares these values, and doesn't try to - * interpret them in any way. - * - * Second, the cache calls, only when needed, a client-provided function - * to convert an @FTC_FaceID into a new @FT_Face object. The latter is - * then completely managed by the cache, including its termination - * through @FT_Done_Face. To monitor termination of face objects, the - * finalizer callback in the `generic` field of the @FT_Face object can - * be used, which might also be used to store the @FTC_FaceID of the - * face. - * - * Clients are free to map face IDs to anything else. The most simple - * usage is to associate them to a (pathname,face_index) pair that is - * used to call @FT_New_Face. However, more complex schemes are also - * possible. + * Note that all types and functions begin with the `FTC_` prefix rather + * than the usual `FT_` prefix int the rest of FreeType. + * + * The cache is highly portable and, thus, doesn't know anything about + * the fonts installed on your system, or how to access them. Therefore, + * it requires the following: + * + * * @FTC_FaceID, an arbitrary non-zero value, that uniquely identifies + * available or installed font faces, has to be provided to the + * cache by the client. Note that the cache only stores and compares + * these values, and doesn't try to interpret them in any way but they + * have to be persistent on the client side. + * + * * @FTC_Face_Requester, a method to convert an @FTC_FaceID into a new + * @FT_Face object, when necessary, has to be provided to the cache by + * the client. The @FT_Face object is completely managed by the cache, + * including its termination through @FT_Done_Face. To monitor + * termination of face objects, the finalizer callback in the `generic` + * field of the @FT_Face object can be used, which might also be used + * to store the @FTC_FaceID of the face. + * + * Clients are free to map face IDs to anything useful. The most simple + * usage is, for example, to associate them to a {pathname,face_index} + * pair that is then used by @FTC_Face_Requester to call @FT_New_Face. + * However, more complex schemes are also possible. * * Note that for the cache to work correctly, the face ID values must be * **persistent**, which means that the contents they point to should not * change at runtime, or that their value should not become invalid. - * * If this is unavoidable (e.g., when a font is uninstalled at runtime), * you should call @FTC_Manager_RemoveFaceID as soon as possible, to let * the cache get rid of any references to the old @FTC_FaceID it may keep * internally. Failure to do so will lead to incorrect behaviour or even - * crashes. + * crashes in @FTC_Face_Requester. * * To use the cache, start with calling @FTC_Manager_New to create a new * @FTC_Manager object, which models a single cache instance. You can * then look up @FT_Face and @FT_Size objects with - * @FTC_Manager_LookupFace and @FTC_Manager_LookupSize, respectively. - * - * If you want to use the charmap caching, call @FTC_CMapCache_New, then - * later use @FTC_CMapCache_Lookup to perform the equivalent of - * @FT_Get_Char_Index, only much faster. - * - * If you want to use the @FT_Glyph caching, call @FTC_ImageCache_New, - * then later use @FTC_ImageCache_Lookup to retrieve the corresponding - * @FT_Glyph objects from the cache. - * - * If you need lots of small bitmaps, it is much more memory efficient to - * call @FTC_SBitCache_New followed by @FTC_SBitCache_Lookup. This - * returns @FTC_SBitRec structures, which are used to store small bitmaps - * directly. (A small bitmap is one whose metrics and dimensions all fit - * into 8-bit integers). - * - * We hope to also provide a kerning cache in the near future. + * @FTC_Manager_LookupFace and @FTC_Manager_LookupSize, respectively, and + * use them in any FreeType work stream. You can also cache other + * FreeType objects as follows: + * + * * If you want to use the charmap caching, call @FTC_CMapCache_New, + * then later use @FTC_CMapCache_Lookup to perform the equivalent of + * @FT_Get_Char_Index, only much faster. + * + * * If you want to use the @FT_Glyph caching, call @FTC_ImageCache_New, + * then later use @FTC_ImageCache_Lookup to retrieve the corresponding + * @FT_Glyph objects from the cache. + * + * * If you need lots of small bitmaps, it is much more memory efficient + * to call @FTC_SBitCache_New followed by @FTC_SBitCache_Lookup. This + * returns @FTC_SBitRec structures, which are used to store small + * bitmaps directly. (A small bitmap is one whose metrics and + * dimensions all fit into 8-bit integers). * * * @order: -- cgit v1.2.3 From 3af4772d68f261ae34677db4a0434ababe5676bd Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 12 May 2023 05:58:43 +0200 Subject: * include/freetype/ftcache.h: Typo, punctuation. --- include/freetype/ftcache.h | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/include/freetype/ftcache.h b/include/freetype/ftcache.h index 72e1d3fdb..a2072e26b 100644 --- a/include/freetype/ftcache.h +++ b/include/freetype/ftcache.h @@ -44,20 +44,20 @@ FT_BEGIN_HEADER * images while limiting their maximum memory usage. * * Note that all types and functions begin with the `FTC_` prefix rather - * than the usual `FT_` prefix int the rest of FreeType. + * than the usual `FT_` prefix in the rest of FreeType. * * The cache is highly portable and, thus, doesn't know anything about * the fonts installed on your system, or how to access them. Therefore, - * it requires the following: + * it requires the following. * - * * @FTC_FaceID, an arbitrary non-zero value, that uniquely identifies + * * @FTC_FaceID, an arbitrary non-zero value that uniquely identifies * available or installed font faces, has to be provided to the * cache by the client. Note that the cache only stores and compares - * these values, and doesn't try to interpret them in any way but they + * these values and doesn't try to interpret them in any way, but they * have to be persistent on the client side. * * * @FTC_Face_Requester, a method to convert an @FTC_FaceID into a new - * @FT_Face object, when necessary, has to be provided to the cache by + * @FT_Face object when necessary, has to be provided to the cache by * the client. The @FT_Face object is completely managed by the cache, * including its termination through @FT_Done_Face. To monitor * termination of face objects, the finalizer callback in the `generic` @@ -65,7 +65,7 @@ FT_BEGIN_HEADER * to store the @FTC_FaceID of the face. * * Clients are free to map face IDs to anything useful. The most simple - * usage is, for example, to associate them to a {pathname,face_index} + * usage is, for example, to associate them to a `{pathname,face_index}` * pair that is then used by @FTC_Face_Requester to call @FT_New_Face. * However, more complex schemes are also possible. * @@ -73,7 +73,7 @@ FT_BEGIN_HEADER * **persistent**, which means that the contents they point to should not * change at runtime, or that their value should not become invalid. * If this is unavoidable (e.g., when a font is uninstalled at runtime), - * you should call @FTC_Manager_RemoveFaceID as soon as possible, to let + * you should call @FTC_Manager_RemoveFaceID as soon as possible to let * the cache get rid of any references to the old @FTC_FaceID it may keep * internally. Failure to do so will lead to incorrect behaviour or even * crashes in @FTC_Face_Requester. @@ -83,7 +83,7 @@ FT_BEGIN_HEADER * then look up @FT_Face and @FT_Size objects with * @FTC_Manager_LookupFace and @FTC_Manager_LookupSize, respectively, and * use them in any FreeType work stream. You can also cache other - * FreeType objects as follows: + * FreeType objects as follows. * * * If you want to use the charmap caching, call @FTC_CMapCache_New, * then later use @FTC_CMapCache_Lookup to perform the equivalent of @@ -93,13 +93,12 @@ FT_BEGIN_HEADER * then later use @FTC_ImageCache_Lookup to retrieve the corresponding * @FT_Glyph objects from the cache. * - * * If you need lots of small bitmaps, it is much more memory efficient + * * If you need lots of small bitmaps, it is much more memory-efficient * to call @FTC_SBitCache_New followed by @FTC_SBitCache_Lookup. This * returns @FTC_SBitRec structures, which are used to store small * bitmaps directly. (A small bitmap is one whose metrics and * dimensions all fit into 8-bit integers). * - * * @order: * FTC_Manager * FTC_FaceID -- cgit v1.2.3 From 771ff8bd03e5e2e5faae51aea22dfde2dc1522cc Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Fri, 12 May 2023 22:21:47 -0400 Subject: [cache] Minor casting and cosmetic updates. * src/cache/ftcglyph.c (ftc_gcache_{init,done}): Remove casting. (FTC_GCache_Lookup): Cosmetic variable renaming. * src/cache/ftcsbits.c (ftc_snode_compare): Formatting. --- src/cache/ftcglyph.c | 32 ++++++++++++++++---------------- src/cache/ftcsbits.c | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/cache/ftcglyph.c b/src/cache/ftcglyph.c index 5cbda318f..d344733f3 100644 --- a/src/cache/ftcglyph.c +++ b/src/cache/ftcglyph.c @@ -101,22 +101,22 @@ FT_LOCAL_DEF( FT_Error ) - ftc_gcache_init( FTC_Cache ftccache ) + ftc_gcache_init( FTC_Cache cache ) { - FTC_GCache cache = (FTC_GCache)ftccache; + FTC_GCache gcache = (FTC_GCache)cache; FT_Error error; - error = FTC_Cache_Init( FTC_CACHE( cache ) ); + error = FTC_Cache_Init( cache ); if ( !error ) { - FTC_GCacheClass clazz = (FTC_GCacheClass)FTC_CACHE( cache )->org_class; + FTC_GCacheClass clazz = (FTC_GCacheClass)cache->org_class; - FTC_MruList_Init( &cache->families, + FTC_MruList_Init( &gcache->families, clazz->family_class, 0, /* no maximum here! */ cache, - FTC_CACHE( cache )->memory ); + cache->memory ); } return error; @@ -126,31 +126,31 @@ #if 0 FT_LOCAL_DEF( FT_Error ) - FTC_GCache_Init( FTC_GCache cache ) + FTC_GCache_Init( FTC_GCache gcache ) { - return ftc_gcache_init( FTC_CACHE( cache ) ); + return ftc_gcache_init( FTC_CACHE( gcache ) ); } #endif /* 0 */ FT_LOCAL_DEF( void ) - ftc_gcache_done( FTC_Cache ftccache ) + ftc_gcache_done( FTC_Cache cache ) { - FTC_GCache cache = (FTC_GCache)ftccache; + FTC_GCache gcache = (FTC_GCache)cache; - FTC_Cache_Done( (FTC_Cache)cache ); - FTC_MruList_Done( &cache->families ); + FTC_Cache_Done( cache ); + FTC_MruList_Done( &gcache->families ); } #if 0 FT_LOCAL_DEF( void ) - FTC_GCache_Done( FTC_GCache cache ) + FTC_GCache_Done( FTC_GCache gcache ) { - ftc_gcache_done( FTC_CACHE( cache ) ); + ftc_gcache_done( FTC_CACHE( gcache ) ); } #endif /* 0 */ @@ -169,7 +169,7 @@ #ifndef FTC_INLINE FT_LOCAL_DEF( FT_Error ) - FTC_GCache_Lookup( FTC_GCache cache, + FTC_GCache_Lookup( FTC_GCache gcache, FT_Offset hash, FT_UInt gindex, FTC_GQuery query, @@ -190,7 +190,7 @@ /* out-of-memory condition occurs during glyph node initialization. */ family->num_nodes++; - error = FTC_Cache_Lookup( FTC_CACHE( cache ), hash, query, anode ); + error = FTC_Cache_Lookup( FTC_CACHE( gcache ), hash, query, anode ); if ( --family->num_nodes == 0 ) FTC_FAMILY_FREE( family, cache ); diff --git a/src/cache/ftcsbits.c b/src/cache/ftcsbits.c index 216a710e3..9929a0bcc 100644 --- a/src/cache/ftcsbits.c +++ b/src/cache/ftcsbits.c @@ -342,7 +342,7 @@ FT_Bool result; - if (list_changed) + if ( list_changed ) *list_changed = FALSE; result = FT_BOOL( gnode->family == gquery->family && gindex - gnode->gindex < snode->count ); -- cgit v1.2.3 From e1a4e081aa57b3e044c7f30c3118cb6015e397d6 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Fri, 12 May 2023 22:27:08 -0400 Subject: [cache] Merge functions. * src/cache/ftccache.c (FTC_Cache_Init): Merge into... (ftc_cache_done): ... this function, with unnecessary checks removed. --- src/cache/ftccache.c | 47 +++++++++++++++++------------------------------ 1 file changed, 17 insertions(+), 30 deletions(-) diff --git a/src/cache/ftccache.c b/src/cache/ftccache.c index e77c1468f..e0698557b 100644 --- a/src/cache/ftccache.c +++ b/src/cache/ftccache.c @@ -318,13 +318,6 @@ /*************************************************************************/ - FT_LOCAL_DEF( FT_Error ) - FTC_Cache_Init( FTC_Cache cache ) - { - return ftc_cache_init( cache ); - } - - FT_LOCAL_DEF( FT_Error ) ftc_cache_init( FTC_Cache cache ) { @@ -341,10 +334,20 @@ } - static void - FTC_Cache_Clear( FTC_Cache cache ) + FT_LOCAL_DEF( FT_Error ) + FTC_Cache_Init( FTC_Cache cache ) + { + return ftc_cache_init( cache ); + } + + + FT_LOCAL_DEF( void ) + ftc_cache_done( FTC_Cache cache ) { - if ( cache && cache->buckets ) + FT_Memory memory = cache->memory; + + + if ( cache->buckets ) { FTC_Manager manager = cache->manager; FT_UFast count = cache->p; @@ -370,30 +373,14 @@ cache->clazz.node_free( node, cache ); node = next; } - cache->buckets[i] = NULL; } - ftc_cache_resize( cache ); } - } + FT_FREE( cache->buckets ); - FT_LOCAL_DEF( void ) - ftc_cache_done( FTC_Cache cache ) - { - if ( cache->memory ) - { - FT_Memory memory = cache->memory; - - - FTC_Cache_Clear( cache ); - - FT_FREE( cache->buckets ); - cache->mask = 0; - cache->p = 0; - cache->slack = 0; - - cache->memory = NULL; - } + cache->p = 0; + cache->mask = 0; + cache->slack = 0; } -- cgit v1.2.3 From 872a759b468ef0d88b0636d6beb074fe6b87f9cd Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 13 May 2023 09:34:45 +0200 Subject: .mailmap: Updated. --- .mailmap | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.mailmap b/.mailmap index 533274d12..9c7d08f88 100644 --- a/.mailmap +++ b/.mailmap @@ -1,7 +1,7 @@ +Alexander Borsuk Behdad Esfahbod (بهداد اسفهبد) Behdad Esfahbod (بهداد اسفهبد) Behdad Esfahbod (بهداد اسفهبد) -Alexander Borsuk Ewald Hew (Hew Yih Shiuan 丘毅宣) Moazin Khatti (موؤذن کھٹی) Priyesh Kumar (प्रियेश कुमार) @@ -15,6 +15,7 @@ Suzuki, Toshiya (鈴木俊哉) sssa suzuki toshiya Bram Tassyns bram tassyns Bram Tassyns +Anurag Thakur (अनुराग ठाकुर) David Turner David Turner Anuj Verma (अनुज वर्मा) -- cgit v1.2.3 From 416d4c25f1e15d2494d373982a511928f635e705 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 15 May 2023 15:44:36 +0200 Subject: Add new load flag `FT_LOAD_NO_SVG`. Modern color fonts often contain both an 'SVG' and 'COLR' table. FreeType always preferred 'SVG' over 'COLR' (this was a design decision), however, this might not be the right choice for the user. The new flags makes FreeType ignore the 'SVG' table while loading a glyph. Fixes #1229. * include/freetype/freetype.h (FT_LOAD_NO_SVG): New macro. * src/base/ftobjs.c (FT_Load_Glyph), src/cff/cffgload.c (cff_slot_load), src/truetype/ttgload.c (TT_Load_Glyph): Use it. --- docs/CHANGES | 3 +++ include/freetype/freetype.h | 13 +++++++++---- src/base/ftobjs.c | 3 ++- src/cff/cffgload.c | 6 ++++-- src/truetype/ttgload.c | 4 +++- 5 files changed, 21 insertions(+), 8 deletions(-) diff --git a/docs/CHANGES b/docs/CHANGES index 105f976e8..7562f10e7 100644 --- a/docs/CHANGES +++ b/docs/CHANGES @@ -5,6 +5,9 @@ CHANGES BETWEEN 2.13.0 and 2.13.1 (2023-XXX-XX) - New function `FT_Get_Default_Named_Instance` to get the index of the default named instance of an OpenType Variation Font. + - A new load flag `FT_LOAD_NO_SVG` to make FreeType ignore glyphs in + an 'SVG ' table. + ====================================================================== diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 15609e6a2..81f0e86ed 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -3425,10 +3425,11 @@ FT_BEGIN_HEADER * * [Since 2.12] If the glyph index maps to an entry in the face's * 'SVG~' table, load the associated SVG document from this table and - * set the `format` field of @FT_GlyphSlotRec to @FT_GLYPH_FORMAT_SVG. - * Note that FreeType itself can't render SVG documents; however, the - * library provides hooks to seamlessly integrate an external renderer. - * See sections @ot_svg_driver and @svg_fonts for more. + * set the `format` field of @FT_GlyphSlotRec to @FT_GLYPH_FORMAT_SVG + * ([since 2.13.1] provided @FT_LOAD_NO_SVG is not set). Note that + * FreeType itself can't render SVG documents; however, the library + * provides hooks to seamlessly integrate an external renderer. See + * sections @ot_svg_driver and @svg_fonts for more. * * [Since 2.10, experimental] If the glyph index maps to an entry in * the face's 'COLR' table with a 'CPAL' palette table (as defined in @@ -3442,6 +3443,9 @@ FT_BEGIN_HEADER * @FT_Palette_Select instead of setting @FT_LOAD_COLOR for rendering * so that the client application can handle blending by itself. * + * FT_LOAD_NO_SVG :: + * [Since 2.13.1] Ignore SVG glyph data when loading. + * * FT_LOAD_COMPUTE_METRICS :: * [Since 2.6.1] Compute glyph metrics from the glyph data, without the * use of bundled metrics tables (for example, the 'hdmx' table in @@ -3507,6 +3511,7 @@ FT_BEGIN_HEADER #define FT_LOAD_COLOR ( 1L << 20 ) #define FT_LOAD_COMPUTE_METRICS ( 1L << 21 ) #define FT_LOAD_BITMAP_METRICS_ONLY ( 1L << 22 ) +#define FT_LOAD_NO_SVG ( 1L << 24 ) /* */ diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index b7e89540e..abfa3ab0e 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -1019,7 +1019,8 @@ /* elegant. */ /* try to load SVG documents if available */ - if ( FT_HAS_SVG( face ) ) + if ( ( load_flags & FT_LOAD_NO_SVG ) == 0 && + FT_HAS_SVG( face ) ) { error = driver->clazz->load_glyph( slot, face->size, glyph_index, diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c index cfa0aaf2b..c483d1d1a 100644 --- a/src/cff/cffgload.c +++ b/src/cff/cffgload.c @@ -356,14 +356,16 @@ #ifdef FT_CONFIG_OPTION_SVG /* check for OT-SVG */ - if ( ( load_flags & FT_LOAD_COLOR ) && face->svg ) + if ( ( load_flags & FT_LOAD_NO_SVG ) == 0 && + ( load_flags & FT_LOAD_COLOR ) && + face->svg ) { /* * We load the SVG document and try to grab the advances from the * table. For the bearings we rely on the presetting hook to do that. */ - SFNT_Service sfnt = (SFNT_Service)face->sfnt; + SFNT_Service sfnt = (SFNT_Service)face->sfnt; if ( size && (size->root.metrics.x_ppem < 1 || diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index b56db1740..5f15a7f4d 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -2802,7 +2802,9 @@ #ifdef FT_CONFIG_OPTION_SVG /* check for OT-SVG */ - if ( ( load_flags & FT_LOAD_COLOR ) && face->svg ) + if ( ( load_flags & FT_LOAD_NO_SVG ) == 0 && + ( load_flags & FT_LOAD_COLOR ) && + face->svg ) { SFNT_Service sfnt = (SFNT_Service)face->sfnt; -- cgit v1.2.3 From 99dadd56a40e6d9ae23b395225ecf9997432d22c Mon Sep 17 00:00:00 2001 From: Jouk Jansen Date: Wed, 17 May 2023 12:40:59 +0200 Subject: vms_make.com: Create shared executable for x86 version of OpenVMS. --- vms_make.com | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vms_make.com b/vms_make.com index 0a87c7178..a7696e3bf 100644 --- a/vms_make.com +++ b/vms_make.com @@ -99,7 +99,7 @@ $! $! $! Alpha & Itanium get a shareable image $! -$ If f$getsyi("HW_MODEL") .gt. 1024 +$ If f$getsyi("HW_MODEL") .gt. 1024 .or. f$getsyi("HW_MODEL") .eq. 0 $ Then $ write sys$output "Creating freetype2shr.exe" $ library/extract=* [.lib]freetype.olb -- cgit v1.2.3 From 115e927540dba128980dd734dadeb06aa7b0f4d8 Mon Sep 17 00:00:00 2001 From: Seigo Nonaka Date: Fri, 19 May 2023 12:11:45 +0900 Subject: [truetype] Reduce heap allocation of `deltaSet` variation data. `deltaSet` is an array of packed integers that can be 32 bits, 16 bits, or 8 bits. Before this change, these values were unpacked to 32-bit integers. However, this can cause big heap allocations, e.g., around 500 KByte for 'NotoSansCJK'. To reduce this amount, store the packed integers and unpack them just before passing to the calculation. At calculation time, due to the variable length of region indices, temporary heap allocations are necessary. This heap allocation is not negligible and visible in `ftbench` results. So, use stack-allocated arrays for short array calculations. Fixes #1230. * include/freetype/internal/ftmmtypes.h (GX_ItemVarDataRec): New fields `wordDeltaCount` and `longWords`. * src/truetype/ttgxvar.c (tt_var_load_item_variation_store): Load packed data. (tt_var_get_item_delta): Unpack data before applying. --- include/freetype/internal/ftmmtypes.h | 20 ++++--- src/truetype/ttgxvar.c | 106 ++++++++++++++++++++++------------ 2 files changed, 81 insertions(+), 45 deletions(-) diff --git a/include/freetype/internal/ftmmtypes.h b/include/freetype/internal/ftmmtypes.h index b7c66c35d..c4b21d614 100644 --- a/include/freetype/internal/ftmmtypes.h +++ b/include/freetype/internal/ftmmtypes.h @@ -28,13 +28,19 @@ FT_BEGIN_HEADER typedef struct GX_ItemVarDataRec_ { - FT_UInt itemCount; /* number of delta sets per item */ - FT_UInt regionIdxCount; /* number of region indices */ - FT_UInt* regionIndices; /* array of `regionCount' indices; */ - /* these index `varRegionList' */ - FT_ItemVarDelta* deltaSet; /* array of `itemCount' deltas */ - /* use `innerIndex' for this array */ - + FT_UInt itemCount; /* Number of delta sets per item. */ + FT_UInt regionIdxCount; /* Number of region indices. */ + FT_UInt* regionIndices; /* Array of `regionCount` indices; */ + /* these index `varRegionList`. */ + FT_Byte* deltaSet; /* Array of `itemCount` deltas; */ + /* use `innerIndex` for this array. */ + FT_UShort wordDeltaCount; /* Number of the first 32-bit ints */ + /* or 16-bit ints of `deltaSet` */ + /* depending on `longWords`. */ + FT_Bool longWords; /* If true, `deltaSet` is a 32-bit */ + /* array followed by a 16-bit */ + /* array, otherwise a 16-bit array */ + /* followed by an 8-bit array. */ } GX_ItemVarDataRec, *GX_ItemVarData; diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index 04caff7b0..8c713f1b6 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -509,7 +509,7 @@ FT_UShort axis_count; FT_UInt region_count; - FT_UInt i, j, k; + FT_UInt i, j; FT_Bool long_words; GX_Blend blend = ttface->blend; @@ -624,6 +624,7 @@ FT_UInt item_count; FT_UInt word_delta_count; FT_UInt region_idx_count; + FT_UInt per_region_size; if ( FT_STREAM_SEEK( offset + dataOffsetArray[i] ) ) @@ -660,6 +661,8 @@ if ( FT_NEW_ARRAY( varData->regionIndices, region_idx_count ) ) goto Exit; varData->regionIdxCount = region_idx_count; + varData->wordDeltaCount = word_delta_count; + varData->longWords = long_words; for ( j = 0; j < varData->regionIdxCount; j++ ) { @@ -675,37 +678,22 @@ } } - /* Parse delta set. */ - /* */ - /* On input, deltas are (word_delta_count + region_idx_count) bytes */ - /* each if `long_words` isn't set, and twice as much otherwise. */ - /* */ - /* On output, deltas are expanded to `region_idx_count` shorts each. */ - if ( FT_NEW_ARRAY( varData->deltaSet, item_count * region_idx_count ) ) - goto Exit; - varData->itemCount = item_count; + per_region_size = word_delta_count + region_idx_count; + if ( long_words ) + per_region_size *= 2; - for ( j = 0; j < item_count * region_idx_count; ) + if ( FT_NEW_ARRAY( varData->deltaSet, per_region_size * item_count ) ) + goto Exit; + if ( FT_Stream_Read( stream, + varData->deltaSet, + per_region_size * item_count ) ) { - if ( long_words ) - { - for ( k = 0; k < word_delta_count; k++, j++ ) - if ( FT_READ_LONG( varData->deltaSet[j] ) ) - goto Exit; - for ( ; k < region_idx_count; k++, j++ ) - if ( FT_READ_SHORT( varData->deltaSet[j] ) ) - goto Exit; - } - else - { - for ( k = 0; k < word_delta_count; k++, j++ ) - if ( FT_READ_SHORT( varData->deltaSet[j] ) ) - goto Exit; - for ( ; k < region_idx_count; k++, j++ ) - if ( FT_READ_CHAR( varData->deltaSet[j] ) ) - goto Exit; - } + FT_TRACE2(( "deltaSet read failed." )); + error = FT_THROW( Invalid_Table ); + goto Exit; } + + varData->itemCount = item_count; } Exit: @@ -1005,11 +993,16 @@ FT_Error error = FT_Err_Ok; GX_ItemVarData varData; - FT_ItemVarDelta* deltaSet; + FT_ItemVarDelta* deltaSet = NULL; + FT_ItemVarDelta deltaSetStack[16]; + + FT_Fixed* scalars = NULL; + FT_Fixed scalarsStack[16]; FT_UInt master, j; - FT_Fixed* scalars = NULL; - FT_ItemVarDelta returnValue; + FT_ItemVarDelta returnValue = 0; + FT_UInt per_region_size; + FT_Byte* bytes; if ( !ttface->blend || !ttface->blend->normalizedcoords ) @@ -1026,15 +1019,48 @@ if ( outerIndex >= itemStore->dataCount ) return 0; /* Out of range. */ - varData = &itemStore->varData[outerIndex]; - deltaSet = FT_OFFSET( varData->deltaSet, - varData->regionIdxCount * innerIndex ); + varData = &itemStore->varData[outerIndex]; if ( innerIndex >= varData->itemCount ) return 0; /* Out of range. */ - if ( FT_QNEW_ARRAY( scalars, varData->regionIdxCount ) ) - return 0; + if ( varData->regionIdxCount < 16 ) + { + deltaSet = deltaSetStack; + scalars = scalarsStack; + } + else + { + if ( FT_QNEW_ARRAY( deltaSet, varData->regionIdxCount ) ) + goto Exit; + if ( FT_QNEW_ARRAY( scalars, varData->regionIdxCount ) ) + goto Exit; + } + + /* Parse delta set. */ + /* */ + /* Deltas are (word_delta_count + region_idx_count) bytes each */ + /* if `longWords` isn't set, and twice as much otherwise. */ + per_region_size = varData->wordDeltaCount + varData->regionIdxCount; + if ( varData->longWords ) + per_region_size *= 2; + + bytes = varData->deltaSet + per_region_size * innerIndex; + + if ( varData->longWords ) + { + for ( master = 0; master < varData->wordDeltaCount; master++ ) + deltaSet[master] = FT_NEXT_LONG( bytes ); + for ( ; master < varData->regionIdxCount; master++ ) + deltaSet[master] = FT_NEXT_SHORT( bytes ); + } + else + { + for ( master = 0; master < varData->wordDeltaCount; master++ ) + deltaSet[master] = FT_NEXT_SHORT( bytes ); + for ( ; master < varData->regionIdxCount; master++ ) + deltaSet[master] = FT_NEXT_CHAR( bytes ); + } /* outer loop steps through master designs to be blended */ for ( master = 0; master < varData->regionIdxCount; master++ ) @@ -1109,7 +1135,11 @@ */ returnValue = FT_MulAddFix( scalars, deltaSet, varData->regionIdxCount ); - FT_FREE( scalars ); + Exit: + if ( scalars != scalarsStack ) + FT_FREE( scalars ); + if ( deltaSet != deltaSetStack ) + FT_FREE( deltaSet ); return returnValue; } -- cgit v1.2.3 From 2342a03a9d3e58a82e698fc4074dc2e5f95c4e26 Mon Sep 17 00:00:00 2001 From: Craig White Date: Fri, 19 May 2023 14:11:57 -0400 Subject: Add missing end quote of a string in the example code of FT_Trace_Set_Level --- include/freetype/ftlogging.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/freetype/ftlogging.h b/include/freetype/ftlogging.h index 2246dc836..53b8b8964 100644 --- a/include/freetype/ftlogging.h +++ b/include/freetype/ftlogging.h @@ -62,7 +62,7 @@ FT_BEGIN_HEADER * component. * * ``` - * FT_Trace_Set_Level( "any:7 memory:0 ); + * FT_Trace_Set_Level( "any:7 memory:0" ); * ``` * * @note: -- cgit v1.2.3 From 562f34819229080abb05b4e7ae7e9e47fc84c6eb Mon Sep 17 00:00:00 2001 From: suzuki toshiya Date: Sat, 20 May 2023 12:52:25 +0000 Subject: [doc] Type1 GX (sfnt-wrapped Type1) is not supported. * docs/formats.txt: Clarify the reference of Type1 GX, and state that this format is not supported. This is because the content `TYP1' table is not exactly same with the Type1 font format specification; no eexec encryption is used. For detail and concrete examples, see the analysis on: https://gitlab.freedesktop.org/freetype/freetype/-/issues/1231 --- docs/formats.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/formats.txt b/docs/formats.txt index 4b2f32eab..3d03c01bf 100644 --- a/docs/formats.txt +++ b/docs/formats.txt @@ -77,8 +77,8 @@ which isn't supported yet please send a mail too. --- BDF --- --- bdf 5005.BDF_Spec.pdf, X11 - SFNT PS TYPE_1 --- type1 Type 1 GX Font Format - (for the Mac) [3] + SFNT PS TYPE_1 --- type1 Type 1 GX Font Format [7] + (for the Mac; not supported) SFNT PS TYPE_1 CID cid 5180.sfnt.pdf (for the Mac) [3] SFNT PS CFF --- cff OT spec, 5176.CFF.pdf (`OTTO' format) @@ -198,6 +198,12 @@ which isn't supported yet please send a mail too. [6] Supported font formats are TrueType and OpenType fonts as defined in the OpenType specification 1.6 and newer. +[7] `The Type 1 GX Font Format' (dated 1995-09-27) was distributed in + Apple Developer CD-ROM in those days. The content of `TYP1' table + is a PostScript Type 1 font without the eexec encryption. Current + versions of FreeType don't not support this format, but FontForge + can load it. + ------------------------------------------------------------------------ Copyright (C) 2004-2023 by -- cgit v1.2.3 From 66cc4619d2328dff7277b428c0ca75cbb837ff96 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 23 May 2023 12:54:48 +0200 Subject: docs/DEBUG: Formatting. --- docs/DEBUG | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/DEBUG b/docs/DEBUG index 4a5ac3a40..7398df69b 100644 --- a/docs/DEBUG +++ b/docs/DEBUG @@ -270,12 +270,12 @@ to access them. `FT2_DEBUG' environment variable. Use this function to override the value with `level'. Use value `NULL' to disable tracing. - FT_Trace_Set_Default_Level(): + FT_Trace_Set_Default_Level( void ) Reset the tracing levels to the default value, i.e., the value of the `FT2_DEBUG' environment variable or no tracing if not set. - FT_Set_Log_Handler( ft_custom_log_handler handler ): + FT_Set_Log_Handler( ft_custom_log_handler handler ) Use `handler' as a custom handler for formatting tracing and error messages. The `ft_custom_log_handler' typedef has the following @@ -290,7 +290,7 @@ to access them. first argument of `FT_TRACE' or `FT_ERROR', and `args' holds the remaining arguments. - FT_Set_Default_Log_Handler(): + FT_Set_Default_Log_Handler( void ) Reset the log handler to the default version. -- cgit v1.2.3 From 80a507a6b8e3d2906ad2c8ba69329bd2fb2a85ef Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 23 May 2023 13:13:56 +0200 Subject: Replace `sprintf` with `snprintf`. Fixes #1233. * include/freetype/config/ftstdlib.h (ft_sprintf): Replace with... (ft_snprintf): This new macro. * src/autofit/afhints.c (af_print_idx): Add argument to pass the buffer size. (af_glyph_hints_dump_points, af_glyph_hints_dump_segments, af_glyph_hints_dump_edges): Updated. * src/bdf/bdflib.c (BUFSIZE): New macro. (bdf_parse_properties_, bdf_parse_start_): Use `ft_snprintf`. * src/tools/ftrandom/ftrandom.c (do_test): Use `snprintf`. --- include/freetype/config/ftstdlib.h | 14 ++++----- src/autofit/afhints.c | 58 ++++++++++++++++++++++---------------- src/bdf/bdflib.c | 15 ++++++---- src/tools/ftrandom/ftrandom.c | 2 +- 4 files changed, 51 insertions(+), 38 deletions(-) diff --git a/include/freetype/config/ftstdlib.h b/include/freetype/config/ftstdlib.h index 3c9d2ae59..f65148a90 100644 --- a/include/freetype/config/ftstdlib.h +++ b/include/freetype/config/ftstdlib.h @@ -111,13 +111,13 @@ #include -#define FT_FILE FILE -#define ft_fclose fclose -#define ft_fopen fopen -#define ft_fread fread -#define ft_fseek fseek -#define ft_ftell ftell -#define ft_sprintf sprintf +#define FT_FILE FILE +#define ft_fclose fclose +#define ft_fopen fopen +#define ft_fread fread +#define ft_fseek fseek +#define ft_ftell ftell +#define ft_snprintf snprintf /************************************************************************** diff --git a/src/autofit/afhints.c b/src/autofit/afhints.c index 6515af9f0..e4a378fbf 100644 --- a/src/autofit/afhints.c +++ b/src/autofit/afhints.c @@ -320,8 +320,9 @@ static char* - af_print_idx( char* p, - int idx ) + af_print_idx( char* p, + size_t n, + int idx ) { if ( idx == -1 ) { @@ -330,7 +331,7 @@ p[2] = '\0'; } else - ft_sprintf( p, "%d", idx ); + ft_snprintf( p, n, "%d", idx ); return p; } @@ -457,12 +458,12 @@ " %5d %5d %7.2f %7.2f %7.2f %7.2f" " %5s %5s %5s %5s\n", point_idx, - af_print_idx( buf1, + af_print_idx( buf1, 16, af_get_edge_index( hints, segment_idx_1, 1 ) ), - af_print_idx( buf2, segment_idx_1 ), - af_print_idx( buf3, + af_print_idx( buf2, 16, segment_idx_1 ), + af_print_idx( buf3, 16, af_get_edge_index( hints, segment_idx_0, 0 ) ), - af_print_idx( buf4, segment_idx_0 ), + af_print_idx( buf4, 16, segment_idx_0 ), ( point->flags & AF_FLAG_NEAR ) ? " near " : ( point->flags & AF_FLAG_WEAK_INTERPOLATION ) @@ -476,18 +477,22 @@ (double)point->x / 64, (double)point->y / 64, - af_print_idx( buf5, af_get_strong_edge_index( hints, - point->before, - 1 ) ), - af_print_idx( buf6, af_get_strong_edge_index( hints, - point->after, - 1 ) ), - af_print_idx( buf7, af_get_strong_edge_index( hints, - point->before, - 0 ) ), - af_print_idx( buf8, af_get_strong_edge_index( hints, - point->after, - 0 ) ) )); + af_print_idx( buf5, 16, + af_get_strong_edge_index( hints, + point->before, + 1 ) ), + af_print_idx( buf6, 16, + af_get_strong_edge_index( hints, + point->after, + 1 ) ), + af_print_idx( buf7, 16, + af_get_strong_edge_index( hints, + point->before, + 0 ) ), + af_print_idx( buf8, 16, + af_get_strong_edge_index( hints, + point->after, + 0 ) ) )); } AF_DUMP(( "\n" )); } @@ -574,9 +579,12 @@ AF_INDEX_NUM( seg->first, points ), AF_INDEX_NUM( seg->last, points ), - af_print_idx( buf1, AF_INDEX_NUM( seg->link, segments ) ), - af_print_idx( buf2, AF_INDEX_NUM( seg->serif, segments ) ), - af_print_idx( buf3, AF_INDEX_NUM( seg->edge, edges ) ), + af_print_idx( buf1, 16, + AF_INDEX_NUM( seg->link, segments ) ), + af_print_idx( buf2, 16, + AF_INDEX_NUM( seg->serif, segments ) ), + af_print_idx( buf3, 16, + AF_INDEX_NUM( seg->edge, edges ) ), seg->height, seg->height - ( seg->max_coord - seg->min_coord ), @@ -716,8 +724,10 @@ AF_INDEX_NUM( edge, edges ), (double)(int)edge->opos / 64, af_dir_str( (AF_Direction)edge->dir ), - af_print_idx( buf1, AF_INDEX_NUM( edge->link, edges ) ), - af_print_idx( buf2, AF_INDEX_NUM( edge->serif, edges ) ), + af_print_idx( buf1, 16, + AF_INDEX_NUM( edge->link, edges ) ), + af_print_idx( buf2, 16, + AF_INDEX_NUM( edge->serif, edges ) ), edge->blue_edge ? 'y' : 'n', (double)edge->opos / 64, diff --git a/src/bdf/bdflib.c b/src/bdf/bdflib.c index 936829be4..0fa7e0a8c 100644 --- a/src/bdf/bdflib.c +++ b/src/bdf/bdflib.c @@ -51,6 +51,9 @@ #define FT_COMPONENT bdflib +#define BUFSIZE 128 + + /************************************************************************** * * Default BDF font options. @@ -1773,7 +1776,7 @@ bdf_parse_t_* p; char* name; char* value; - char nbuf[128]; + char nbuf[BUFSIZE]; FT_Error error = FT_Err_Ok; FT_UNUSED( lineno ); @@ -1794,7 +1797,7 @@ if ( bdf_get_font_property( p->font, "FONT_ASCENT" ) == 0 ) { p->font->font_ascent = p->font->bbx.ascent; - ft_sprintf( nbuf, "%hd", p->font->bbx.ascent ); + ft_snprintf( nbuf, BUFSIZE, "%hd", p->font->bbx.ascent ); error = bdf_add_property_( p->font, "FONT_ASCENT", nbuf, lineno ); if ( error ) @@ -1806,7 +1809,7 @@ if ( bdf_get_font_property( p->font, "FONT_DESCENT" ) == 0 ) { p->font->font_descent = p->font->bbx.descent; - ft_sprintf( nbuf, "%hd", p->font->bbx.descent ); + ft_snprintf( nbuf, BUFSIZE, "%hd", p->font->bbx.descent ); error = bdf_add_property_( p->font, "FONT_DESCENT", nbuf, lineno ); if ( error ) @@ -2114,7 +2117,7 @@ /* Check for the CHARS field -- font properties are optional */ if ( _bdf_strncmp( line, "CHARS", 5 ) == 0 ) { - char nbuf[128]; + char nbuf[BUFSIZE]; if ( !( p->flags & BDF_FONT_BBX_ ) ) @@ -2128,7 +2131,7 @@ /* Add the two standard X11 properties which are required */ /* for compiling fonts. */ p->font->font_ascent = p->font->bbx.ascent; - ft_sprintf( nbuf, "%hd", p->font->bbx.ascent ); + ft_snprintf( nbuf, BUFSIZE, "%hd", p->font->bbx.ascent ); error = bdf_add_property_( p->font, "FONT_ASCENT", nbuf, lineno ); if ( error ) @@ -2136,7 +2139,7 @@ FT_TRACE2(( "bdf_parse_properties_: " ACMSG1, p->font->bbx.ascent )); p->font->font_descent = p->font->bbx.descent; - ft_sprintf( nbuf, "%hd", p->font->bbx.descent ); + ft_snprintf( nbuf, BUFSIZE, "%hd", p->font->bbx.descent ); error = bdf_add_property_( p->font, "FONT_DESCENT", nbuf, lineno ); if ( error ) diff --git a/src/tools/ftrandom/ftrandom.c b/src/tools/ftrandom/ftrandom.c index 4f912cd21..0ee765e52 100644 --- a/src/tools/ftrandom/ftrandom.c +++ b/src/tools/ftrandom/ftrandom.c @@ -520,7 +520,7 @@ char buffer[1024]; - sprintf( buffer, "%s/test%d", results_dir, test_num++ ); + snprintf( buffer, 1024, "%s/test%d", results_dir, test_num++ ); if ( copyfont ( &fontlist[i], buffer ) ) { -- cgit v1.2.3 From b641b607be7aaff32928ccb1fad80e6824ad8675 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 3 Jun 2023 06:09:30 +0200 Subject: Minor formatting. --- src/gxvalid/gxvfgen.c | 3 ++- src/truetype/ttinterp.c | 18 ++++++++++-------- src/truetype/ttobjs.c | 3 ++- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/gxvalid/gxvfgen.c b/src/gxvalid/gxvfgen.c index 115354228..cf98bb36c 100644 --- a/src/gxvalid/gxvfgen.c +++ b/src/gxvalid/gxvfgen.c @@ -97,7 +97,8 @@ #define EMPTYFEAT {0, 0, {NULL}} - static GX_Feature_RegistryRec featreg_table[] = { + static GX_Feature_RegistryRec featreg_table[] = + { { /* 0 */ "All Typographic Features", 0, diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index 0ac0f9e12..34c3e6c92 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -3547,7 +3547,8 @@ #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY /* arguments to opcodes are skipped by `SKIP_Code' */ - FT_Byte opcode_pattern[9][12] = { + FT_Byte opcode_pattern[9][12] = + { /* #0 inline delta function 1 */ { 0x4B, /* PPEM */ @@ -7679,13 +7680,14 @@ FT_UShort i; #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY - FT_Byte opcode_pattern[1][2] = { - /* #8 TypeMan Talk Align */ - { - 0x06, /* SPVTL */ - 0x7D, /* RDTG */ - }, - }; + FT_Byte opcode_pattern[1][2] = + { + /* #8 TypeMan Talk Align */ + { + 0x06, /* SPVTL */ + 0x7D, /* RDTG */ + }, + }; FT_UShort opcode_patterns = 1; FT_UShort opcode_pointer[1] = { 0 }; FT_UShort opcode_size[1] = { 1 }; diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c index ce956c02c..958fa54d4 100644 --- a/src/truetype/ttobjs.c +++ b/src/truetype/ttobjs.c @@ -312,7 +312,8 @@ #define TRICK_SFNT_IDS_NUM_FACES 31 static const tt_sfnt_id_rec sfnt_id[TRICK_SFNT_IDS_NUM_FACES] - [TRICK_SFNT_IDS_PER_FACE] = { + [TRICK_SFNT_IDS_PER_FACE] = + { #define TRICK_SFNT_ID_cvt 0 #define TRICK_SFNT_ID_fpgm 1 -- cgit v1.2.3 From 2fb8eda5d6bf50fc5ced3987e12ad301b0be968f Mon Sep 17 00:00:00 2001 From: Ben Wagner Date: Thu, 1 Jun 2023 19:38:36 -0400 Subject: */*: Remove many function pointer casts. In C it is undefined behavior to call a function through a function pointer of a different type. This is now detected by the Control Flow Integrity Sanitizer. All known issues have already been fixed. Prevent any accidental re-introduction by removing function pointer casts when defining services. The services will call the service functions through the function pointers on the service. As a result the functions must have the same type so there should be no need to cast. Removing the casts allows compilers to warn about assignment to an incompatible function pointer type. --- src/autofit/afmodule.c | 19 +++---- src/cff/cffdrivr.c | 132 ++++++++++++++++++++++-------------------------- src/cid/cidriver.c | 28 +++++----- src/psnames/psmodule.c | 30 +++++------ src/raster/ftraster.c | 10 ++-- src/raster/ftrend1.c | 16 +++--- src/sfnt/sfdriver.c | 24 ++++----- src/svg/ftsvg.c | 22 ++++---- src/truetype/ttdriver.c | 82 +++++++++++++----------------- src/type1/t1driver.c | 72 ++++++++++++-------------- 10 files changed, 204 insertions(+), 231 deletions(-) diff --git a/src/autofit/afmodule.c b/src/autofit/afmodule.c index e3c62b867..20a6b96bc 100644 --- a/src/autofit/afmodule.c +++ b/src/autofit/afmodule.c @@ -372,8 +372,9 @@ FT_DEFINE_SERVICE_PROPERTIESREC( af_service_properties, - (FT_Properties_SetFunc)af_property_set, /* set_property */ - (FT_Properties_GetFunc)af_property_get ) /* get_property */ + af_property_set, /* FT_Properties_SetFunc set_property */ + af_property_get /* FT_Properties_GetFunc get_property */ + ) FT_DEFINE_SERVICEDESCREC1( @@ -499,10 +500,10 @@ FT_DEFINE_AUTOHINTER_INTERFACE( af_autofitter_interface, - NULL, /* reset_face */ - NULL, /* get_global_hints */ - NULL, /* done_global_hints */ - (FT_AutoHinter_GlyphLoadFunc)af_autofitter_load_glyph /* load_glyph */ + NULL, /* FT_AutoHinter_GlobalResetFunc reset_face */ + NULL, /* FT_AutoHinter_GlobalGetFunc get_global_hints */ + NULL, /* FT_AutoHinter_GlobalDoneFunc done_global_hints */ + af_autofitter_load_glyph /* FT_AutoHinter_GlyphLoadFunc load_glyph */ ) FT_DEFINE_MODULE( @@ -517,9 +518,9 @@ (const void*)&af_autofitter_interface, - (FT_Module_Constructor)af_autofitter_init, /* module_init */ - (FT_Module_Destructor) af_autofitter_done, /* module_done */ - (FT_Module_Requester) af_get_interface /* get_interface */ + af_autofitter_init, /* FT_Module_Constructor module_init */ + af_autofitter_done, /* FT_Module_Destructor module_done */ + af_get_interface /* FT_Module_Requester get_interface */ ) diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index 7ee26a9f4..9898d625c 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -442,8 +442,8 @@ FT_DEFINE_SERVICE_GLYPHDICTREC( cff_service_glyph_dict, - (FT_GlyphDict_GetNameFunc) cff_get_glyph_name, /* get_name */ - (FT_GlyphDict_NameIndexFunc)cff_get_name_index /* name_index */ + cff_get_glyph_name, /* FT_GlyphDict_GetNameFunc get_name */ + cff_get_name_index /* FT_GlyphDict_NameIndexFunc name_index */ ) @@ -592,13 +592,13 @@ FT_DEFINE_SERVICE_PSINFOREC( cff_service_ps_info, - (PS_GetFontInfoFunc) cff_ps_get_font_info, /* ps_get_font_info */ - (PS_GetFontExtraFunc) cff_ps_get_font_extra, /* ps_get_font_extra */ - (PS_HasGlyphNamesFunc) cff_ps_has_glyph_names, /* ps_has_glyph_names */ + cff_ps_get_font_info, /* PS_GetFontInfoFunc ps_get_font_info */ + cff_ps_get_font_extra, /* PS_GetFontExtraFunc ps_get_font_extra */ + cff_ps_has_glyph_names, /* PS_HasGlyphNamesFunc ps_has_glyph_names */ /* unsupported with CFF fonts */ - (PS_GetFontPrivateFunc)NULL, /* ps_get_font_private */ + NULL, /* PS_GetFontPrivateFunc ps_get_font_private */ /* not implemented */ - (PS_GetFontValueFunc) NULL /* ps_get_font_value */ + NULL /* PS_GetFontValueFunc ps_get_font_value */ ) @@ -640,7 +640,7 @@ FT_DEFINE_SERVICE_PSFONTNAMEREC( cff_service_ps_name, - (FT_PsName_GetFunc)cff_get_ps_name /* get_ps_font_name */ + cff_get_ps_name /* FT_PsName_GetFunc get_ps_font_name */ ) @@ -688,7 +688,7 @@ FT_DEFINE_SERVICE_TTCMAPSREC( cff_service_get_cmap_info, - (TT_CMap_Info_GetFunc)cff_get_cmap_info /* get_cmap_info */ + cff_get_cmap_info /* TT_CMap_Info_GetFunc get_cmap_info */ ) @@ -820,12 +820,12 @@ FT_DEFINE_SERVICE_CIDREC( cff_service_cid_info, - (FT_CID_GetRegistryOrderingSupplementFunc) - cff_get_ros, /* get_ros */ - (FT_CID_GetIsInternallyCIDKeyedFunc) - cff_get_is_cid, /* get_is_cid */ - (FT_CID_GetCIDFromGlyphIndexFunc) - cff_get_cid_from_glyph_index /* get_cid_from_glyph_index */ + cff_get_ros, + /* FT_CID_GetRegistryOrderingSupplementFunc get_ros */ + cff_get_is_cid, + /* FT_CID_GetIsInternallyCIDKeyedFunc get_is_cid */ + cff_get_cid_from_glyph_index + /* FT_CID_GetCIDFromGlyphIndexFunc get_cid_from_glyph_index */ ) @@ -837,9 +837,9 @@ FT_DEFINE_SERVICE_PROPERTIESREC( cff_service_properties, - (FT_Properties_SetFunc)ps_property_set, /* set_property */ - (FT_Properties_GetFunc)ps_property_get ) /* get_property */ - + ps_property_set, /* FT_Properties_SetFunc set_property */ + ps_property_get /* FT_Properties_GetFunc get_property */ + ) #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT @@ -1044,45 +1044,35 @@ FT_DEFINE_SERVICE_MULTIMASTERSREC( cff_service_multi_masters, - (FT_Get_MM_Func) NULL, /* get_mm */ - (FT_Set_MM_Design_Func) NULL, /* set_mm_design */ - (FT_Set_MM_Blend_Func) cff_set_mm_blend, /* set_mm_blend */ - (FT_Get_MM_Blend_Func) cff_get_mm_blend, /* get_mm_blend */ - (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_Named_Instance_Func) - cff_set_named_instance, - /* set_named_instance */ - (FT_Get_Default_Named_Instance_Func) - cff_get_default_named_instance, - /* get_default_named_instance */ - (FT_Set_MM_WeightVector_Func) - cff_set_mm_weightvector, - /* set_mm_weightvector */ - (FT_Get_MM_WeightVector_Func) - cff_get_mm_weightvector, - /* get_mm_weightvector */ - - (FT_Construct_PS_Name_Func) - cff_construct_ps_name, - /* construct_ps_name */ - (FT_Var_Load_Delta_Set_Idx_Map_Func) - cff_load_delta_set_index_mapping, - /* load_delta_set_idx_map */ - (FT_Var_Load_Item_Var_Store_Func) - cff_load_item_variation_store, - /* load_item_variation_store */ - (FT_Var_Get_Item_Delta_Func) - cff_get_item_delta, /* get_item_delta */ - (FT_Var_Done_Item_Var_Store_Func) - cff_done_item_variation_store, - /* done_item_variation_store */ - (FT_Var_Done_Delta_Set_Idx_Map_Func) - cff_done_delta_set_index_map, - /* done_delta_set_index_map */ - (FT_Get_Var_Blend_Func) cff_get_var_blend, /* get_var_blend */ - (FT_Done_Blend_Func) cff_done_blend /* done_blend */ + NULL, /* FT_Get_MM_Func get_mm */ + NULL, /* FT_Set_MM_Design_Func set_mm_design */ + cff_set_mm_blend, /* FT_Set_MM_Blend_Func set_mm_blend */ + cff_get_mm_blend, /* FT_Get_MM_Blend_Func get_mm_blend */ + cff_get_mm_var, /* FT_Get_MM_Var_Func get_mm_var */ + cff_set_var_design, /* FT_Set_Var_Design_Func set_var_design */ + cff_get_var_design, /* FT_Get_Var_Design_Func get_var_design */ + cff_set_named_instance, + /* FT_Set_Named_Instance_Func set_named_instance */ + cff_get_default_named_instance, + /* FT_Get_Default_Named_Instance_Func get_default_named_instance */ + cff_set_mm_weightvector, + /* FT_Set_MM_WeightVector_Func set_mm_weightvector */ + cff_get_mm_weightvector, + /* FT_Get_MM_WeightVector_Func get_mm_weightvector */ + cff_construct_ps_name, + /* FT_Construct_PS_Name_Func construct_ps_name */ + cff_load_delta_set_index_mapping, + /* FT_Var_Load_Delta_Set_Idx_Map_Func load_delta_set_idx_map */ + cff_load_item_variation_store, + /* FT_Var_Load_Item_Var_Store_Func load_item_variation_store */ + cff_get_item_delta, + /* FT_Var_Get_Item_Delta_Func get_item_delta */ + cff_done_item_variation_store, + /* FT_Var_Done_Item_Var_Store_Func done_item_variation_store */ + cff_done_delta_set_index_map, + /* FT_Var_Done_Delta_Set_Idx_Map_Func done_delta_set_index_map */ + cff_get_var_blend, /* FT_Get_Var_Blend_Func get_var_blend */ + cff_done_blend /* FT_Done_Blend_Func done_blend */ ) @@ -1120,17 +1110,17 @@ FT_DEFINE_SERVICE_METRICSVARIATIONSREC( cff_service_metrics_variations, - (FT_HAdvance_Adjust_Func)cff_hadvance_adjust, /* hadvance_adjust */ - (FT_LSB_Adjust_Func) NULL, /* lsb_adjust */ - (FT_RSB_Adjust_Func) NULL, /* rsb_adjust */ + cff_hadvance_adjust, /* FT_HAdvance_Adjust_Func hadvance_adjust */ + NULL, /* FT_LSB_Adjust_Func lsb_adjust */ + NULL, /* FT_RSB_Adjust_Func rsb_adjust */ - (FT_VAdvance_Adjust_Func)NULL, /* vadvance_adjust */ - (FT_TSB_Adjust_Func) NULL, /* tsb_adjust */ - (FT_BSB_Adjust_Func) NULL, /* bsb_adjust */ - (FT_VOrg_Adjust_Func) NULL, /* vorg_adjust */ + NULL, /* FT_VAdvance_Adjust_Func vadvance_adjust */ + NULL, /* FT_TSB_Adjust_Func tsb_adjust */ + NULL, /* FT_BSB_Adjust_Func bsb_adjust */ + NULL, /* FT_VOrg_Adjust_Func vorg_adjust */ - (FT_Metrics_Adjust_Func) cff_metrics_adjust, /* metrics_adjust */ - (FT_Size_Reset_Func) NULL /* size_reset */ + cff_metrics_adjust, /* FT_Metrics_Adjust_Func metrics_adjust */ + NULL /* FT_Size_Reset_Func size_reset */ ) #endif @@ -1143,11 +1133,11 @@ 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 + cff_get_standard_encoding, /* FT_Get_Standard_Encoding_Func get_standard_encoding */ + cff_load_private_dict, /* FT_Load_Private_Dict_Func load_private_dict */ + cff_fd_select_get, /* FT_FD_Select_Get_Func fd_select_get */ + cff_blend_check_vector, /* FT_Blend_Check_Vector_Func blend_check_vector */ + cff_blend_build_vector /* FT_Blend_Build_Vector_Func blend_build_vector */ ) diff --git a/src/cid/cidriver.c b/src/cid/cidriver.c index 0907b1dcf..99e7b1183 100644 --- a/src/cid/cidriver.c +++ b/src/cid/cidriver.c @@ -95,14 +95,14 @@ static const FT_Service_PsInfoRec cid_service_ps_info = { - (PS_GetFontInfoFunc) cid_ps_get_font_info, /* ps_get_font_info */ - (PS_GetFontExtraFunc) cid_ps_get_font_extra, /* ps_get_font_extra */ + cid_ps_get_font_info, /* PS_GetFontInfoFunc ps_get_font_info */ + cid_ps_get_font_extra, /* PS_GetFontExtraFunc ps_get_font_extra */ /* unsupported with CID fonts */ - (PS_HasGlyphNamesFunc) NULL, /* ps_has_glyph_names */ + NULL, /* PS_HasGlyphNamesFunc ps_has_glyph_names */ /* unsupported */ - (PS_GetFontPrivateFunc)NULL, /* ps_get_font_private */ + NULL, /* PS_GetFontPrivateFunc ps_get_font_private */ /* not implemented */ - (PS_GetFontValueFunc) NULL /* ps_get_font_value */ + NULL /* PS_GetFontValueFunc ps_get_font_value */ }; @@ -182,12 +182,12 @@ static const FT_Service_CIDRec cid_service_cid_info = { - (FT_CID_GetRegistryOrderingSupplementFunc) - cid_get_ros, /* get_ros */ - (FT_CID_GetIsInternallyCIDKeyedFunc) - cid_get_is_cid, /* get_is_cid */ - (FT_CID_GetCIDFromGlyphIndexFunc) - cid_get_cid_from_glyph_index /* get_cid_from_glyph_index */ + cid_get_ros, + /* FT_CID_GetRegistryOrderingSupplementFunc get_ros */ + cid_get_is_cid, + /* FT_CID_GetIsInternallyCIDKeyedFunc get_is_cid */ + cid_get_cid_from_glyph_index + /* FT_CID_GetCIDFromGlyphIndexFunc get_cid_from_glyph_index */ }; @@ -199,9 +199,9 @@ FT_DEFINE_SERVICE_PROPERTIESREC( cid_service_properties, - (FT_Properties_SetFunc)ps_property_set, /* set_property */ - (FT_Properties_GetFunc)ps_property_get ) /* get_property */ - + ps_property_set, /* FT_Properties_SetFunc set_property */ + ps_property_get /* FT_Properties_GetFunc get_property */ + ) /* * SERVICE LIST diff --git a/src/psnames/psmodule.c b/src/psnames/psmodule.c index 5a9e1eab8..8203a0465 100644 --- a/src/psnames/psmodule.c +++ b/src/psnames/psmodule.c @@ -543,13 +543,13 @@ FT_DEFINE_SERVICE_PSCMAPSREC( pscmaps_interface, - (PS_Unicode_ValueFunc) ps_unicode_value, /* unicode_value */ - (PS_Unicodes_InitFunc) ps_unicodes_init, /* unicodes_init */ - (PS_Unicodes_CharIndexFunc)ps_unicodes_char_index, /* unicodes_char_index */ - (PS_Unicodes_CharNextFunc) ps_unicodes_char_next, /* unicodes_char_next */ + ps_unicode_value, /* PS_Unicode_ValueFunc unicode_value */ + ps_unicodes_init, /* PS_Unicodes_InitFunc unicodes_init */ + ps_unicodes_char_index, /* PS_Unicodes_CharIndexFunc unicodes_char_index */ + ps_unicodes_char_next, /* PS_Unicodes_CharNextFunc unicodes_char_next */ - (PS_Macintosh_NameFunc) ps_get_macintosh_name, /* macintosh_name */ - (PS_Adobe_Std_StringsFunc) ps_get_standard_strings, /* adobe_std_strings */ + ps_get_macintosh_name, /* PS_Macintosh_NameFunc macintosh_name */ + ps_get_standard_strings, /* PS_Adobe_Std_StringsFunc adobe_std_strings */ t1_standard_encoding, /* adobe_std_encoding */ t1_expert_encoding /* adobe_expert_encoding */ @@ -560,13 +560,13 @@ FT_DEFINE_SERVICE_PSCMAPSREC( pscmaps_interface, - NULL, /* unicode_value */ - NULL, /* unicodes_init */ - NULL, /* unicodes_char_index */ - NULL, /* unicodes_char_next */ + NULL, /* PS_Unicode_ValueFunc unicode_value */ + NULL, /* PS_Unicodes_InitFunc unicodes_init */ + NULL, /* PS_Unicodes_CharIndexFunc unicodes_char_index */ + NULL, /* PS_Unicodes_CharNextFunc unicodes_char_next */ - (PS_Macintosh_NameFunc) ps_get_macintosh_name, /* macintosh_name */ - (PS_Adobe_Std_StringsFunc) ps_get_standard_strings, /* adobe_std_strings */ + ps_get_macintosh_name, /* PS_Macintosh_NameFunc macintosh_name */ + ps_get_standard_strings, /* PS_Adobe_Std_StringsFunc adobe_std_strings */ t1_standard_encoding, /* adobe_std_encoding */ t1_expert_encoding /* adobe_expert_encoding */ @@ -612,9 +612,9 @@ PUT_PS_NAMES_SERVICE( (void*)&pscmaps_interface ), /* module specific interface */ - (FT_Module_Constructor)NULL, /* module_init */ - (FT_Module_Destructor) NULL, /* module_done */ - (FT_Module_Requester) PUT_PS_NAMES_SERVICE( psnames_get_service ) /* get_interface */ + NULL, /* FT_Module_Constructor module_init */ + NULL, /* FT_Module_Destructor module_done */ + PUT_PS_NAMES_SERVICE( psnames_get_service ) /* FT_Module_Requester get_interface */ ) diff --git a/src/raster/ftraster.c b/src/raster/ftraster.c index c997fa9e6..192ca0701 100644 --- a/src/raster/ftraster.c +++ b/src/raster/ftraster.c @@ -3283,11 +3283,11 @@ FT_GLYPH_FORMAT_OUTLINE, - (FT_Raster_New_Func) ft_black_new, /* raster_new */ - (FT_Raster_Reset_Func) ft_black_reset, /* raster_reset */ - (FT_Raster_Set_Mode_Func)ft_black_set_mode, /* raster_set_mode */ - (FT_Raster_Render_Func) ft_black_render, /* raster_render */ - (FT_Raster_Done_Func) ft_black_done /* raster_done */ + ft_black_new, /* FT_Raster_New_Func raster_new */ + ft_black_reset, /* FT_Raster_Reset_Func raster_reset */ + ft_black_set_mode, /* FT_Raster_Set_Mode_Func raster_set_mode */ + ft_black_render, /* FT_Raster_Render_Func raster_render */ + ft_black_done /* FT_Raster_Done_Func raster_done */ ) diff --git a/src/raster/ftrend1.c b/src/raster/ftrend1.c index 7a59ccc2f..6d442b1ff 100644 --- a/src/raster/ftrend1.c +++ b/src/raster/ftrend1.c @@ -191,18 +191,18 @@ NULL, /* module specific interface */ - (FT_Module_Constructor)ft_raster1_init, /* module_init */ - (FT_Module_Destructor) NULL, /* module_done */ - (FT_Module_Requester) NULL, /* get_interface */ + ft_raster1_init, /* FT_Module_Constructor module_init */ + NULL, /* FT_Module_Destructor module_done */ + NULL, /* FT_Module_Requester get_interface */ FT_GLYPH_FORMAT_OUTLINE, - (FT_Renderer_RenderFunc) ft_raster1_render, /* render_glyph */ - (FT_Renderer_TransformFunc)ft_raster1_transform, /* transform_glyph */ - (FT_Renderer_GetCBoxFunc) ft_raster1_get_cbox, /* get_glyph_cbox */ - (FT_Renderer_SetModeFunc) ft_raster1_set_mode, /* set_mode */ + ft_raster1_render, /* FT_Renderer_RenderFunc render_glyph */ + ft_raster1_transform, /* FT_Renderer_TransformFunc transform_glyph */ + ft_raster1_get_cbox, /* FT_Renderer_GetCBoxFunc get_glyph_cbox */ + ft_raster1_set_mode, /* FT_Renderer_SetModeFunc set_mode */ - (FT_Raster_Funcs*)&ft_standard_raster /* raster_class */ + &ft_standard_raster /* FT_Raster_Funcs* raster_class */ ) diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c index cb8ab440e..0925940b0 100644 --- a/src/sfnt/sfdriver.c +++ b/src/sfnt/sfdriver.c @@ -172,9 +172,9 @@ FT_DEFINE_SERVICE_SFNT_TABLEREC( sfnt_service_sfnt_table, - (FT_SFNT_TableLoadFunc)sfnt_load_table, /* load_table */ - (FT_SFNT_TableGetFunc) get_sfnt_table, /* get_table */ - (FT_SFNT_TableInfoFunc)sfnt_table_info /* table_info */ + sfnt_load_table, /* FT_SFNT_TableLoadFunc load_table */ + get_sfnt_table, /* FT_SFNT_TableGetFunc get_table */ + sfnt_table_info /* FT_SFNT_TableInfoFunc table_info */ ) @@ -240,8 +240,8 @@ FT_DEFINE_SERVICE_GLYPHDICTREC( sfnt_service_glyph_dict, - (FT_GlyphDict_GetNameFunc) sfnt_get_glyph_name, /* get_name */ - (FT_GlyphDict_NameIndexFunc)sfnt_get_name_index /* name_index */ + sfnt_get_glyph_name, /* FT_GlyphDict_GetNameFunc get_name */ + sfnt_get_name_index /* FT_GlyphDict_NameIndexFunc name_index */ ) #endif /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */ @@ -1113,7 +1113,7 @@ FT_DEFINE_SERVICE_PSFONTNAMEREC( sfnt_service_ps_name, - (FT_PsName_GetFunc)sfnt_get_ps_name /* get_ps_font_name */ + sfnt_get_ps_name /* FT_PsName_GetFunc get_ps_font_name */ ) @@ -1123,7 +1123,7 @@ FT_DEFINE_SERVICE_TTCMAPSREC( tt_service_get_cmap_info, - (TT_CMap_Info_GetFunc)tt_get_cmap_info /* get_cmap_info */ + tt_get_cmap_info /* TT_CMap_Info_GetFunc get_cmap_info */ ) @@ -1168,8 +1168,8 @@ FT_DEFINE_SERVICE_BDFRec( sfnt_service_bdf, - (FT_BDF_GetCharsetIdFunc)sfnt_get_charset_id, /* get_charset_id */ - (FT_BDF_GetPropertyFunc) tt_face_find_bdf_prop /* get_property */ + sfnt_get_charset_id, /* FT_BDF_GetCharsetIdFunc get_charset_id */ + tt_face_find_bdf_prop /* FT_BDF_GetPropertyFunc get_property */ ) @@ -1360,9 +1360,9 @@ (const void*)&sfnt_interface, /* module specific interface */ - (FT_Module_Constructor)NULL, /* module_init */ - (FT_Module_Destructor) NULL, /* module_done */ - (FT_Module_Requester) sfnt_get_interface /* get_interface */ + NULL, /* FT_Module_Constructor module_init */ + NULL, /* FT_Module_Destructor module_done */ + sfnt_get_interface /* FT_Module_Requester get_interface */ ) diff --git a/src/svg/ftsvg.c b/src/svg/ftsvg.c index e353d47d2..ba237f638 100644 --- a/src/svg/ftsvg.c +++ b/src/svg/ftsvg.c @@ -153,7 +153,7 @@ static const SVG_Interface svg_interface = { - (Preset_Bitmap_Func)ft_svg_preset_slot + ft_svg_preset_slot /* Preset_Bitmap_Func preset_slot */ }; @@ -231,8 +231,8 @@ FT_DEFINE_SERVICE_PROPERTIESREC( ft_svg_service_properties, - (FT_Properties_SetFunc)ft_svg_property_set, /* set_property */ - (FT_Properties_GetFunc)ft_svg_property_get /* get_property */ + ft_svg_property_set, /* FT_Properties_SetFunc set_property */ + ft_svg_property_get /* FT_Properties_GetFunc get_property */ ) @@ -338,17 +338,17 @@ (const void*)PUT_SVG_MODULE( &svg_interface ), /* module specific interface */ - (FT_Module_Constructor)PUT_SVG_MODULE( ft_svg_init ), /* module_init */ - (FT_Module_Destructor)PUT_SVG_MODULE( ft_svg_done ), /* module_done */ - PUT_SVG_MODULE( ft_svg_get_interface ), /* get_interface */ + PUT_SVG_MODULE( ft_svg_init ), /* FT_Module_Constructor module_init */ + PUT_SVG_MODULE( ft_svg_done ), /* FT_Module_Destructor module_done */ + PUT_SVG_MODULE( ft_svg_get_interface ), /* FT_Module_Requester get_interface */ SVG_GLYPH_FORMAT, - (FT_Renderer_RenderFunc) PUT_SVG_MODULE( ft_svg_render ), /* render_glyph */ - (FT_Renderer_TransformFunc)PUT_SVG_MODULE( ft_svg_transform ), /* transform_glyph */ - NULL, /* get_glyph_cbox */ - NULL, /* set_mode */ - NULL /* raster_class */ + PUT_SVG_MODULE( ft_svg_render ), /* FT_Renderer_RenderFunc render_glyph */ + PUT_SVG_MODULE( ft_svg_transform ), /* FT_Renderer_TransformFunc transform_glyph */ + NULL, /* FT_Renderer_GetCBoxFunc get_glyph_cbox */ + NULL, /* FT_Renderer_SetModeFunc set_mode */ + NULL /* FT_Raster_Funcs* raster_class */ ) diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c index ffebcc744..7151e8207 100644 --- a/src/truetype/ttdriver.c +++ b/src/truetype/ttdriver.c @@ -154,8 +154,8 @@ FT_DEFINE_SERVICE_PROPERTIESREC( tt_service_properties, - (FT_Properties_SetFunc)tt_property_set, /* set_property */ - (FT_Properties_GetFunc)tt_property_get /* get_property */ + tt_property_set, /* FT_Properties_SetFunc set_property */ + tt_property_get /* FT_Properties_GetFunc get_property */ ) @@ -517,57 +517,47 @@ FT_DEFINE_SERVICE_MULTIMASTERSREC( tt_service_gx_multi_masters, - (FT_Get_MM_Func) NULL, /* get_mm */ - (FT_Set_MM_Design_Func) NULL, /* set_mm_design */ - (FT_Set_MM_Blend_Func) TT_Set_MM_Blend, /* set_mm_blend */ - (FT_Get_MM_Blend_Func) TT_Get_MM_Blend, /* get_mm_blend */ - (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_Named_Instance_Func) - TT_Set_Named_Instance, /* set_named_instance */ - (FT_Get_Default_Named_Instance_Func) - TT_Get_Default_Named_Instance, - /* get_default_named_instance */ - (FT_Set_MM_WeightVector_Func) - NULL, /* set_mm_weightvector */ - (FT_Get_MM_WeightVector_Func) - NULL, /* get_mm_weightvector */ - - (FT_Construct_PS_Name_Func) - tt_construct_ps_name, /* construct_ps_name */ - (FT_Var_Load_Delta_Set_Idx_Map_Func) - tt_var_load_delta_set_index_mapping, - /* load_delta_set_idx_map */ - (FT_Var_Load_Item_Var_Store_Func) - tt_var_load_item_variation_store, - /* load_item_variation_store */ - (FT_Var_Get_Item_Delta_Func) - tt_var_get_item_delta, /* get_item_delta */ - (FT_Var_Done_Item_Var_Store_Func) - tt_var_done_item_variation_store, - /* done_item_variation_store */ - (FT_Var_Done_Delta_Set_Idx_Map_Func) - tt_var_done_delta_set_index_map, - /* done_delta_set_index_map */ - (FT_Get_Var_Blend_Func) tt_get_var_blend, /* get_var_blend */ - (FT_Done_Blend_Func) tt_done_blend /* done_blend */ + NULL, /* FT_Get_MM_Func get_mm */ + NULL, /* FT_Set_MM_Design_Func set_mm_design */ + TT_Set_MM_Blend, /* FT_Set_MM_Blend_Func set_mm_blend */ + TT_Get_MM_Blend, /* FT_Get_MM_Blend_Func get_mm_blend */ + TT_Get_MM_Var, /* FT_Get_MM_Var_Func get_mm_var */ + TT_Set_Var_Design, /* FT_Set_Var_Design_Func set_var_design */ + TT_Get_Var_Design, /* FT_Get_Var_Design_Func get_var_design */ + TT_Set_Named_Instance, /* FT_Set_Named_Instance_Func set_named_instance */ + TT_Get_Default_Named_Instance, + /* FT_Get_Default_Named_Instance_Func get_default_named_instance */ + NULL, /* FT_Set_MM_WeightVector_Func set_mm_weightvector */ + NULL, /* FT_Get_MM_WeightVector_Func get_mm_weightvector */ + + tt_construct_ps_name, /* FT_Construct_PS_Name_Func construct_ps_name */ + tt_var_load_delta_set_index_mapping, + /* FT_Var_Load_Delta_Set_Idx_Map_Func load_delta_set_idx_map */ + tt_var_load_item_variation_store, + /* FT_Var_Load_Item_Var_Store_Func load_item_variation_store */ + tt_var_get_item_delta, /* FT_Var_Get_Item_Delta_Func get_item_delta */ + tt_var_done_item_variation_store, + /* FT_Var_Done_Item_Var_Store_Func done_item_variation_store */ + tt_var_done_delta_set_index_map, + /* FT_Var_Done_Delta_Set_Idx_Map_Func done_delta_set_index_map */ + tt_get_var_blend, /* FT_Get_Var_Blend_Func get_var_blend */ + tt_done_blend /* FT_Done_Blend_Func done_blend */ ) FT_DEFINE_SERVICE_METRICSVARIATIONSREC( tt_service_metrics_variations, - (FT_HAdvance_Adjust_Func)tt_hadvance_adjust, /* hadvance_adjust */ - (FT_LSB_Adjust_Func) NULL, /* lsb_adjust */ - (FT_RSB_Adjust_Func) NULL, /* rsb_adjust */ + tt_hadvance_adjust, /* FT_HAdvance_Adjust_Func hadvance_adjust */ + NULL, /* FT_LSB_Adjust_Func lsb_adjust */ + NULL, /* FT_RSB_Adjust_Func rsb_adjust */ - (FT_VAdvance_Adjust_Func)tt_vadvance_adjust, /* vadvance_adjust */ - (FT_TSB_Adjust_Func) NULL, /* tsb_adjust */ - (FT_BSB_Adjust_Func) NULL, /* bsb_adjust */ - (FT_VOrg_Adjust_Func) NULL, /* vorg_adjust */ + tt_vadvance_adjust, /* FT_VAdvance_Adjust_Func vadvance_adjust */ + NULL, /* FT_TSB_Adjust_Func tsb_adjust */ + NULL, /* FT_BSB_Adjust_Func bsb_adjust */ + NULL, /* FT_VOrg_Adjust_Func vorg_adjust */ - (FT_Metrics_Adjust_Func) tt_apply_mvar, /* metrics_adjust */ - (FT_Size_Reset_Func) tt_size_reset_height /* size_reset */ + tt_apply_mvar, /* FT_Metrics_Adjust_Func metrics_adjust */ + tt_size_reset_height /* FT_Size_Reset_Func size_reset */ ) #endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */ diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c index 4d5f083fd..a4cdf372a 100644 --- a/src/type1/t1driver.c +++ b/src/type1/t1driver.c @@ -94,8 +94,8 @@ static const FT_Service_GlyphDictRec t1_service_glyph_dict = { - (FT_GlyphDict_GetNameFunc) t1_get_glyph_name, /* get_name */ - (FT_GlyphDict_NameIndexFunc)t1_get_name_index /* name_index */ + t1_get_glyph_name, /* FT_GlyphDict_GetNameFunc get_name */ + t1_get_name_index /* FT_GlyphDict_NameIndexFunc name_index */ }; @@ -128,36 +128,28 @@ #ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT static const FT_Service_MultiMastersRec t1_service_multi_masters = { - (FT_Get_MM_Func) T1_Get_Multi_Master, /* get_mm */ - (FT_Set_MM_Design_Func) T1_Set_MM_Design, /* set_mm_design */ - (FT_Set_MM_Blend_Func) T1_Set_MM_Blend, /* set_mm_blend */ - (FT_Get_MM_Blend_Func) T1_Get_MM_Blend, /* get_mm_blend */ - (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_Named_Instance_Func) - T1_Reset_MM_Blend, /* set_named_instance */ - (FT_Get_Default_Named_Instance_Func) - NULL, /* get_default_named_instance */ - (FT_Set_MM_WeightVector_Func) - T1_Set_MM_WeightVector, /* set_mm_weightvector */ - (FT_Get_MM_WeightVector_Func) - T1_Get_MM_WeightVector, /* get_mm_weightvector */ - - (FT_Construct_PS_Name_Func) - NULL, /* construct_ps_name */ - (FT_Var_Load_Delta_Set_Idx_Map_Func) - NULL, /* load_delta_set_idx_map */ - (FT_Var_Load_Item_Var_Store_Func) - NULL, /* load_item_variation_store */ - (FT_Var_Get_Item_Delta_Func) - NULL, /* get_item_delta */ - (FT_Var_Done_Item_Var_Store_Func) - NULL, /* done_item_variation_store */ - (FT_Var_Done_Delta_Set_Idx_Map_Func) - NULL, /* done_delta_set_index_map */ - (FT_Get_Var_Blend_Func) NULL, /* get_var_blend */ - (FT_Done_Blend_Func) T1_Done_Blend /* done_blend */ + T1_Get_Multi_Master, /* FT_Get_MM_Func get_mm */ + T1_Set_MM_Design, /* FT_Set_MM_Design_Func set_mm_design */ + T1_Set_MM_Blend, /* FT_Set_MM_Blend_Func set_mm_blend */ + T1_Get_MM_Blend, /* FT_Get_MM_Blend_Func get_mm_blend */ + T1_Get_MM_Var, /* FT_Get_MM_Var_Func get_mm_var */ + T1_Set_Var_Design, /* FT_Set_Var_Design_Func set_var_design */ + T1_Get_Var_Design, /* FT_Get_Var_Design_Func get_var_design */ + T1_Reset_MM_Blend, /* FT_Set_Named_Instance_Func set_named_instance */ + NULL, /* FT_Get_Default_Named_Instance_Func get_default_named_instance */ + T1_Set_MM_WeightVector, + /* FT_Set_MM_WeightVector_Func set_mm_weightvector */ + T1_Get_MM_WeightVector, + /* FT_Get_MM_WeightVector_Func get_mm_weightvector */ + + NULL, /* FT_Construct_PS_Name_Func construct_ps_name */ + NULL, /* FT_Var_Load_Delta_Set_Idx_Map_Func load_delta_set_idx_map */ + NULL, /* FT_Var_Load_Item_Var_Store_Func load_item_variation_store */ + NULL, /* FT_Var_Get_Item_Delta_Func get_item_delta */ + NULL, /* FT_Var_Done_Item_Var_Store_Func done_item_variation_store */ + NULL, /* FT_Var_Done_Delta_Set_Idx_Map_Func done_delta_set_index_map */ + NULL, /* FT_Get_Var_Blend_Func get_var_blend */ + T1_Done_Blend /* FT_Done_Blend_Func done_blend */ }; #endif @@ -645,11 +637,11 @@ static const FT_Service_PsInfoRec t1_service_ps_info = { - (PS_GetFontInfoFunc) t1_ps_get_font_info, /* ps_get_font_info */ - (PS_GetFontExtraFunc) t1_ps_get_font_extra, /* ps_get_font_extra */ - (PS_HasGlyphNamesFunc) t1_ps_has_glyph_names, /* ps_has_glyph_names */ - (PS_GetFontPrivateFunc)t1_ps_get_font_private, /* ps_get_font_private */ - (PS_GetFontValueFunc) t1_ps_get_font_value, /* ps_get_font_value */ + t1_ps_get_font_info, /* PS_GetFontInfoFunc ps_get_font_info */ + t1_ps_get_font_extra, /* PS_GetFontExtraFunc ps_get_font_extra */ + t1_ps_has_glyph_names, /* PS_HasGlyphNamesFunc ps_has_glyph_names */ + t1_ps_get_font_private, /* PS_GetFontPrivateFunc ps_get_font_private */ + t1_ps_get_font_value, /* PS_GetFontValueFunc ps_get_font_value */ }; @@ -669,9 +661,9 @@ FT_DEFINE_SERVICE_PROPERTIESREC( t1_service_properties, - (FT_Properties_SetFunc)ps_property_set, /* set_property */ - (FT_Properties_GetFunc)ps_property_get ) /* get_property */ - + ps_property_set, /* FT_Properties_SetFunc set_property */ + ps_property_get /* FT_Properties_GetFunc get_property */ + ) /* * SERVICE LIST -- cgit v1.2.3 From 7bed7a02f4bfbfe2a47efb4d06b9c02fdb83b758 Mon Sep 17 00:00:00 2001 From: Ben Wagner Date: Thu, 1 Jun 2023 21:05:32 -0400 Subject: Fix some `FT_Fixed` vs. `FT_Long` confusion. `FT_Fixed` and `FT_Long` are both typedef'ed to be `signed long`. However, `FT_Fixed` implies that the lower 16 bits are being used to express fractional values and so these two types should not be confused. * include/freetype/internal/services/svmm.h (FT_Set_MM_Blend_Func): Use `FT_Fixed` for `coords`. Users are passing `FT_Fixed` and implementations are taking `FT_Fixed`. (FT_Get_MM_Blend_Func): Ditto. * src/autofit/afcjk.c (af_cjk_metrics_check_digits): Use `FT_Long` for `advance` and `old_advance`. `advance`'s address is passed as `FT_Long*` to `af_shaper_get_elem`, which writes the advance in em units (not fixed). The exact value is not important here as it is only compared to check whether it has changed. * src/autofit/aflatin.c (af_latin_metrics_check_digits): Ditto. --- include/freetype/internal/services/svmm.h | 12 ++++++------ src/autofit/afcjk.c | 4 ++-- src/autofit/aflatin.c | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/freetype/internal/services/svmm.h b/include/freetype/internal/services/svmm.h index 982bb47db..7e76ab832 100644 --- a/include/freetype/internal/services/svmm.h +++ b/include/freetype/internal/services/svmm.h @@ -60,9 +60,9 @@ FT_BEGIN_HEADER /* 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, - FT_Long* coords ); + (*FT_Set_MM_Blend_Func)( FT_Face face, + FT_UInt num_coords, + FT_Fixed* coords ); typedef FT_Error (*FT_Get_Var_Design_Func)( FT_Face face, @@ -78,9 +78,9 @@ FT_BEGIN_HEADER FT_UInt *instance_index ); typedef FT_Error - (*FT_Get_MM_Blend_Func)( FT_Face face, - FT_UInt num_coords, - FT_Long* coords ); + (*FT_Get_MM_Blend_Func)( FT_Face face, + FT_UInt num_coords, + FT_Fixed* coords ); typedef FT_Error (*FT_Get_Var_Blend_Func)( FT_Face face, diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c index 3466bb9f9..af775b190 100644 --- a/src/autofit/afcjk.c +++ b/src/autofit/afcjk.c @@ -567,8 +567,8 @@ af_cjk_metrics_check_digits( AF_CJKMetrics metrics, FT_Face face ) { - FT_Bool started = 0, same_width = 1; - FT_Fixed advance = 0, old_advance = 0; + FT_Bool started = 0, same_width = 1; + FT_Long advance = 0, old_advance = 0; /* If HarfBuzz is not available, we need a pointer to a single */ /* unsigned long value. */ diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c index 6f672d593..46c6e450a 100644 --- a/src/autofit/aflatin.c +++ b/src/autofit/aflatin.c @@ -1065,8 +1065,8 @@ af_latin_metrics_check_digits( AF_LatinMetrics metrics, FT_Face face ) { - FT_Bool started = 0, same_width = 1; - FT_Fixed advance = 0, old_advance = 0; + FT_Bool started = 0, same_width = 1; + FT_Long advance = 0, old_advance = 0; /* If HarfBuzz is not available, we need a pointer to a single */ /* unsigned long value. */ -- cgit v1.2.3 From 4e1c0e8fba456b2050c672c9c2c876987f03a3e6 Mon Sep 17 00:00:00 2001 From: Ben Wagner Date: Mon, 5 Jun 2023 11:53:34 -0400 Subject: Mark FT_Renderer_Class::raster_class as pointer to const The `FT_DEFINE_RASTER_FUNCS` macro declares a `const FT_Raster_Funcs`. The address of the definition is taken and assigned to `FT_Renderer_Class::raster_class` which is currently `FT_Raster_Funcs*`. Until recently the `const` was cast away and with the removal of the cast there are now warnings about dropping this `const`. Instead of adding back the casts, make `FT_Renderer_Class::raster_class` a pointer to const, as is done with pointers in other interfaces. * include/freetype/ftrender.h (FT_Renderer_Class_): mark `raster_class` as const. --- include/freetype/ftrender.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/freetype/ftrender.h b/include/freetype/ftrender.h index a8576dab0..0b6fad32e 100644 --- a/include/freetype/ftrender.h +++ b/include/freetype/ftrender.h @@ -158,7 +158,7 @@ FT_BEGIN_HEADER FT_Renderer_GetCBoxFunc get_glyph_cbox; FT_Renderer_SetModeFunc set_mode; - FT_Raster_Funcs* raster_class; + const FT_Raster_Funcs* raster_class; } FT_Renderer_Class; -- cgit v1.2.3 From 86d0ca245ac68b633a98c31023cf307d771c3f40 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Fri, 9 Jun 2023 05:13:47 +0200 Subject: [sdf] Correct handling of empty glyphs. This is a refinement of commit 7b3ebb9. * src/sdf/ftsdfrend.c (ft_sdf_render): Goto 'Exit' instead of directly returning. (fd_bsdf_render): Ditto, also taking care of setting `FT_GLYPH_OWN_BITMAP` correctly. --- src/sdf/ftsdfrend.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/sdf/ftsdfrend.c b/src/sdf/ftsdfrend.c index c4d1a8cba..5610c119f 100644 --- a/src/sdf/ftsdfrend.c +++ b/src/sdf/ftsdfrend.c @@ -300,7 +300,7 @@ /* nothing to render */ if ( !bitmap->rows || !bitmap->pitch ) - return FT_Err_Ok; + goto Exit; /* the padding will simply be equal to the `spread' */ x_pad = sdf_module->spread; @@ -508,6 +508,10 @@ goto Exit; } + /* nothing to render */ + if ( !bitmap->rows || !bitmap->pitch ) + goto Exit; + /* Do not generate SDF if the bitmap is not owned by the */ /* glyph: it might be that the source buffer is already freed. */ if ( !( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) ) @@ -519,10 +523,6 @@ goto Exit; } - /* nothing to render */ - if ( !bitmap->rows || !bitmap->pitch ) - return FT_Err_Ok; - FT_Bitmap_New( &target ); /* padding will simply be equal to `spread` */ @@ -557,15 +557,14 @@ { /* the glyph is successfully converted to a SDF */ if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) - { FT_FREE( bitmap->buffer ); - slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; - } - slot->bitmap = target; - slot->bitmap_top += y_pad; - slot->bitmap_left -= x_pad; - slot->internal->flags |= FT_GLYPH_OWN_BITMAP; + slot->bitmap = target; + slot->bitmap_top += y_pad; + slot->bitmap_left -= x_pad; + + if ( target.buffer ) + slot->internal->flags |= FT_GLYPH_OWN_BITMAP; } else if ( target.buffer ) FT_FREE( target.buffer ); -- cgit v1.2.3 From 5c00a46805d6423fc45b4ba2c0f2e22dd0450d73 Mon Sep 17 00:00:00 2001 From: suzuki toshiya Date: Wed, 17 May 2023 01:29:40 +0900 Subject: Comment fixes. --- src/cid/cidobjs.c | 3 ++- src/type1/t1objs.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c index e11c41d8b..f698a4192 100644 --- a/src/cid/cidobjs.c +++ b/src/cid/cidobjs.c @@ -267,7 +267,8 @@ * * @Input: * stream :: - * The source font stream. + * Dummy argument for compatibility with the `FT_Face_InitFunc` API. + * Ignored. The stream should be passed through `face->root.stream`. * * face_index :: * The index of the font face in the resource. diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c index e8486f562..69e4fd506 100644 --- a/src/type1/t1objs.c +++ b/src/type1/t1objs.c @@ -289,7 +289,8 @@ * * @Input: * stream :: - * input stream where to load font data. + * Dummy argument for compatibility with the `FT_Face_InitFunc` API. + * Ignored. The stream should be passed through `face->root.stream`. * * face_index :: * The index of the font face in the resource. -- cgit v1.2.3 From e4586d960f339cf75e2e0b34aee30a0ed8353c0d Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sat, 24 Jun 2023 05:18:54 +0200 Subject: * Version 2.13.1 released. ========================== Tag sources with `VER-2-13-1'. * docs/VERSION.TXT: Add entry for version 2.13.1. * docs/CHANGES: Updated. * docs/release, docs/README, builds/macs/README: Updated. * README, src/base/ftver.rc, builds/windows/vc2010/index.html, builds/windows/visualc/index.html, builds/windows/visualce/index.html, builds/wince/vc2005-ce/index.html, builds/wince/vc2008-ce/index.html, docs/freetype-config.1: s/2.13.0/2.13/1/, s/2130/2131/. * include/freetype/freetype.h (FREETYPE_PATCH): Set to 1. * builds/unix/configure.raw (version_info): Set to 26:0:20. * CMakeLists.txt (VERSION_PATCH): Set to 1. * subprojects/libpng.wrap, subprojects/zlib.wrap, subprojects/dlg: Updated. --- .gitlab-ci.yml | 2 +- CMakeLists.txt | 2 +- README | 8 +++---- builds/mac/README | 8 ------- builds/unix/configure.raw | 2 +- builds/wince/vc2005-ce/index.html | 2 +- builds/wince/vc2008-ce/index.html | 2 +- builds/windows/vc2010/index.html | 2 +- builds/windows/visualc/index.html | 2 +- builds/windows/visualce/index.html | 2 +- docs/CHANGES | 29 ++++++++++++++++++++++++- docs/README | 2 -- docs/VERSIONS.TXT | 1 + docs/formats.txt | 2 +- docs/freetype-config.1 | 2 +- docs/release | 44 +++++++++++++++++++++++++++----------- include/freetype/freetype.h | 2 +- src/base/ftver.rc | 4 ++-- src/cid/cidgload.c | 4 ++-- src/type1/t1afm.c | 2 +- subprojects/dlg | 2 +- subprojects/libpng.wrap | 9 ++++---- subprojects/zlib.wrap | 9 ++++---- 23 files changed, 92 insertions(+), 52 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c51e136a9..bb078e244 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -76,7 +76,7 @@ variables: # Format of job names: -# +# # Windows jobs. diff --git a/CMakeLists.txt b/CMakeLists.txt index 554b580e9..d31ab175d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -164,7 +164,7 @@ project(freetype C) set(VERSION_MAJOR "2") set(VERSION_MINOR "13") -set(VERSION_PATCH "0") +set(VERSION_PATCH "1") # Generate LIBRARY_VERSION and LIBRARY_SOVERSION. set(LIBTOOL_REGEX "version_info='([0-9]+):([0-9]+):([0-9]+)'") diff --git a/README b/README index 327b94d8e..eb48e7e18 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -FreeType 2.13.0 +FreeType 2.13.1 =============== Homepage: https://www.freetype.org @@ -32,9 +32,9 @@ sites. Go to and download one of the following files. - freetype-doc-2.13.0.tar.xz - freetype-doc-2.13.0.tar.gz - ftdoc2130.zip + freetype-doc-2.13.1.tar.xz + freetype-doc-2.13.1.tar.gz + ftdoc2131.zip To view the documentation online, go to diff --git a/builds/mac/README b/builds/mac/README index 092487a84..06e3d51da 100644 --- a/builds/mac/README +++ b/builds/mac/README @@ -200,14 +200,6 @@ environment by Metrowerks. GCC for MPW and Symantec behaviours are not tested at all. Building ftdemos for classic MacOS and working test is required. - 4-3. Porting Jam onto MPW - ------------------------- - - FreeType uses Jam (and FT-Jam) for unified cross- - platform building tool. At present, Jam is not ported - to MPW. To update classic MacOS support easily, - building by Jam is expected on MPW. - APPENDIX I ---------- diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw index 8e982835e..2c152022f 100644 --- a/builds/unix/configure.raw +++ b/builds/unix/configure.raw @@ -17,7 +17,7 @@ AC_CONFIG_SRCDIR([ftconfig.h.in]) # Don't forget to update `docs/VERSIONS.TXT'! -version_info='25:0:19' +version_info='26:0:20' AC_SUBST([version_info]) ft_version=`echo $version_info | tr : .` AC_SUBST([ft_version]) diff --git a/builds/wince/vc2005-ce/index.html b/builds/wince/vc2005-ce/index.html index 0a8b3c660..cef32c12e 100644 --- a/builds/wince/vc2005-ce/index.html +++ b/builds/wince/vc2005-ce/index.html @@ -21,7 +21,7 @@ the following targets:
  • PPC/SP WM6 (Windows Mobile 6)
  • -It compiles the following libraries from the FreeType 2.13.0 sources:

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

      diff --git a/builds/wince/vc2008-ce/index.html b/builds/wince/vc2008-ce/index.html
      index 747370aa9..1d36f6021 100644
      --- a/builds/wince/vc2008-ce/index.html
      +++ b/builds/wince/vc2008-ce/index.html
      @@ -21,7 +21,7 @@ the following targets:
         
    • PPC/SP WM6 (Windows Mobile 6)
    -It compiles the following libraries from the FreeType 2.13.0 sources:

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

      diff --git a/builds/windows/vc2010/index.html b/builds/windows/vc2010/index.html
      index c03be775e..95e27e628 100644
      --- a/builds/windows/vc2010/index.html
      +++ b/builds/windows/vc2010/index.html
      @@ -12,7 +12,7 @@
       

      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.13.0 sources:

      +from the FreeType 2.13.1 sources:

      • freetype.dll using 'Release' or 'Debug' configurations
      • diff --git a/builds/windows/visualc/index.html b/builds/windows/visualc/index.html index 6a70b34b1..de957a61a 100644 --- a/builds/windows/visualc/index.html +++ b/builds/windows/visualc/index.html @@ -12,7 +12,7 @@

        This directory contains project files freetype.dsp for Visual C++ 6.0, and freetype.vcproj for Visual C++ 2002 through 2008, which you might need to upgrade automatically. -It compiles the following libraries from the FreeType 2.13.0 sources:

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

        • freetype.dll using 'Release' or 'Debug' configurations
        • diff --git a/builds/windows/visualce/index.html b/builds/windows/visualce/index.html index cebab29a0..706924a74 100644 --- a/builds/windows/visualce/index.html +++ b/builds/windows/visualce/index.html @@ -21,7 +21,7 @@ the following targets:
        • PPC/SP WM6 (Windows Mobile 6)
        -It compiles the following libraries from the FreeType 2.13.0 sources:

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

          diff --git a/docs/CHANGES b/docs/CHANGES
          index 7562f10e7..b6ad1ce5d 100644
          --- a/docs/CHANGES
          +++ b/docs/CHANGES
          @@ -1,4 +1,4 @@
          -CHANGES BETWEEN 2.13.0 and 2.13.1 (2023-XXX-XX)
          +CHANGES BETWEEN 2.13.0 and 2.13.1 (2023-Jun-24)
           
             I. MISCELLANEOUS
           
          @@ -8,6 +8,33 @@ CHANGES BETWEEN 2.13.0 and 2.13.1 (2023-XXX-XX)
             - A new load flag `FT_LOAD_NO_SVG` to make FreeType ignore glyphs in
               an 'SVG ' table.
           
          +  - New  function  `FT_GlyphSlot_AdjustWeight`  to  adjust  the  glyph
          +    weight either  horizontally or  vertically.  This  is part  of the
          +    `ftsynth.h` header file, which is  still considered to be in alpha
          +    stage.
          +
          +  - TrueType interpreter  version 38 (also known  as 'Infinality') has
          +    been deactivated; the value  of `TT_INTERPRETER_VERSION_38` is now
          +    the same as `TT_INTERPRETER_VERSION_40`.
          +
          +  - Updated OpenVMS support.
          +
          +  - The  base  API  documentation  has  been  modularized  for  easier
          +    handling.
          +
          +  - Switching named instances on and  off in Variation Fonts was buggy
          +    if the design coordinates didn't change.
          +
          +  - `ftbench`  has a  new  command-line option  `-a`  to apply  design
          +    coordinates.
          +
          +  - `ftview` can now flip SVG rendering on and off using the 'Z' key.
          +
          +  - In  `ftmulti` it  is  now possible  to toggle  the  fill rule  and
          +    overlap flag  used for  rendering glyphs using  the 'F3'  and 'F4'
          +    keys,  respectively.   Toggling  the anti-aliased  mode  has  been
          +    changed to the 'TAB' key.
          +
           
           ======================================================================
           
          diff --git a/docs/README b/docs/README
          index d71fd379c..c2b5af865 100644
          --- a/docs/README
          +++ b/docs/README
          @@ -18,8 +18,6 @@ There are two ways to generate the documentation:
               - This may or may not require internet access every time depending on
               pip and system caching.
           
          -This also works with Jam: Just type `jam refdoc' in the main directory.
          -
           Some troubleshooting tips:
           
           * Regularly run `pip install --upgrade docwriter' to check for updates which
          diff --git a/docs/VERSIONS.TXT b/docs/VERSIONS.TXT
          index 92f6a8ccd..eb71fd051 100644
          --- a/docs/VERSIONS.TXT
          +++ b/docs/VERSIONS.TXT
          @@ -60,6 +60,7 @@ found on _most_ systems, but not all of them:
           
               release     libtool     so
             -------------------------------
          +     2.13.1     26.0.20   6.20.0
                2.13.0     25.0.19   6.19.0
                2.12.1     24.3.18   6.18.3
                2.12.0     24.2.18   6.18.2
          diff --git a/docs/formats.txt b/docs/formats.txt
          index 3d03c01bf..882d62d23 100644
          --- a/docs/formats.txt
          +++ b/docs/formats.txt
          @@ -199,7 +199,7 @@ which isn't supported yet please send a mail too.
               defined in the OpenType specification 1.6 and newer.
           
           [7] `The Type 1 GX Font Format' (dated 1995-09-27)  was distributed in
          -    Apple Developer CD-ROM in those days.  The content of `TYP1' table 
          +    Apple Developer CD-ROM in those days.  The content of `TYP1' table
               is a PostScript Type 1 font without the eexec encryption.  Current
               versions of FreeType don't not support this format,  but FontForge
               can load it.
          diff --git a/docs/freetype-config.1 b/docs/freetype-config.1
          index 64594315f..cc6f3006d 100644
          --- a/docs/freetype-config.1
          +++ b/docs/freetype-config.1
          @@ -1,4 +1,4 @@
          -.TH FREETYPE-CONFIG 1 "February 2023" "FreeType 2.13.0"
          +.TH FREETYPE-CONFIG 1 "June 2023" "FreeType 2.13.1"
           .
           .
           .SH NAME
          diff --git a/docs/release b/docs/release
          index fec91e8a7..c296efcc1 100644
          --- a/docs/release
          +++ b/docs/release
          @@ -15,33 +15,53 @@ How to prepare a new release
           
           . docs/VERSIONS.TXT: Document changed `version_info`.
           
          -. Clone the git archive to another directory with
          +. Update the 'dlg' submodule with
           
          -    git clone -l -s . ../freetype.test
          +    git submodule foreach git pull origin master
           
          -  or something like this and run
          +. Copy the submodule code with
           
          -    make distclean; make devel; make
          -    make distclean; make devel; make multi
          -    make distclean; make devel CC=g++; make CC=g++
          -    make distclean; make devel CC=g++; make multi CC=g++
          +    make copy_submodule
          +
          +  and run
          +
          +    make distclean && make devel && make
          +    make distclean && make devel && make multi
          +    make distclean && make devel CC=g++ && make CC=g++ ANSIFLAGS=""
          +    make distclean && make devel CC=g++ && make multi CC=g++ ANSIFLAGS=""
           
               sh autogen.sh
          -    make distclean; ./configure CC=g++; make
          +    make distclean && ./configure CC=g++ && make ANSIFLAGS=""
           
          -  in the cloned repository to test compilation with both gcc and g++.
          +  to test compilation with both gcc and g++ (you might also add the `-j`
          +  flag to `make` for parallel compilation).
           
             Note that it is normally not necessary to test standard C
             compilation with the `configure`, `meson`, and `cmake` build tools
          -  since this is done by the CI process of 'gitlab.freetype.org' for
          +  since this is done by the CI process of 'gitlab.freedesktop.org' for
             every commit.
           
          -. Test C++ compilation for 'freetype-demos' too (using `git clone` as
          -  above).
          +. Test C++ compilation for 'freetype-demos' too; this needs a compiled
          +  FreeType library as described in the `README` file.
          +
          +    make distclean && make
          +    make distclean && make CC=g++ ANSIFLAGS=""
           
           . Run `src/tools/chktrcmp.py` and check that there are no undefined
             `trace_XXXX` macros.
           
          +. Update meson subproject files (for both the 'freetype' and
          +  'freetype-demos' git repositories) with
          +
          +    meson subprojects update
          +
          +. Test meson compilation (for both the 'freetype' and 'freetype-demos'
          +  git repositories) with
          +
          +    meson setup builddir && meson compile -C builddir
          +
          +. Commit everything.
          +
           . After pushing the new release, tag the git repositories ('freetype',
             'freetype-demos') with
           
          diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
          index 81f0e86ed..4a074a444 100644
          --- a/include/freetype/freetype.h
          +++ b/include/freetype/freetype.h
          @@ -5222,7 +5222,7 @@ FT_BEGIN_HEADER
              */
           #define FREETYPE_MAJOR  2
           #define FREETYPE_MINOR  13
          -#define FREETYPE_PATCH  0
          +#define FREETYPE_PATCH  1
           
           
             /**************************************************************************
          diff --git a/src/base/ftver.rc b/src/base/ftver.rc
          index f113cb892..c7155d53d 100644
          --- a/src/base/ftver.rc
          +++ b/src/base/ftver.rc
          @@ -18,8 +18,8 @@
           
           #include
           
          -#define FT_VERSION      2,13,0,0
          -#define FT_VERSION_STR  "2.13.0"
          +#define FT_VERSION      2,13,1,0
          +#define FT_VERSION_STR  "2.13.1"
           
           VS_VERSION_INFO      VERSIONINFO
           FILEVERSION          FT_VERSION
          diff --git a/src/cid/cidgload.c b/src/cid/cidgload.c
          index 0e6a7ad6b..eaca765ad 100644
          --- a/src/cid/cidgload.c
          +++ b/src/cid/cidgload.c
          @@ -92,7 +92,7 @@
                 *off1_p = off1;
               if ( off2_p )
                 *off2_p = off2;
          -  
          +
               if ( fd_select >= cid->num_dicts )
               {
                 /*
          @@ -147,7 +147,7 @@
                 if ( need_frame_exit )
                   FT_FRAME_EXIT();
           
          -    return error; 
          +    return error;
             }
           
           
          diff --git a/src/type1/t1afm.c b/src/type1/t1afm.c
          index 24ade045e..d9b9398b0 100644
          --- a/src/type1/t1afm.c
          +++ b/src/type1/t1afm.c
          @@ -299,7 +299,7 @@
                 /* ascender and descender are optional and could both be zero */
                 /* check if values are meaningful before overriding defaults  */
                 if ( fi->Ascender > fi->Descender )
          -      {  
          +      {
                   /* no `U' suffix here to 0x8000! */
                   t1_face->ascender  = (FT_Short)( ( fi->Ascender  + 0x8000 ) >> 16 );
                   t1_face->descender = (FT_Short)( ( fi->Descender + 0x8000 ) >> 16 );
          diff --git a/subprojects/dlg b/subprojects/dlg
          index d142e646e..72dfcc858 160000
          --- a/subprojects/dlg
          +++ b/subprojects/dlg
          @@ -1 +1 @@
          -Subproject commit d142e646e263c89f93663e027c2f0d03739ab42d
          +Subproject commit 72dfcc858c040c54a6a0b88fcb7e70ee186d3167
          diff --git a/subprojects/libpng.wrap b/subprojects/libpng.wrap
          index 12ba5b185..68abec897 100644
          --- a/subprojects/libpng.wrap
          +++ b/subprojects/libpng.wrap
          @@ -3,10 +3,11 @@ directory = libpng-1.6.39
           source_url = https://github.com/glennrp/libpng/archive/v1.6.39.tar.gz
           source_filename = libpng-1.6.39.tar.gz
           source_hash = a00e9d2f2f664186e4202db9299397f851aea71b36a35e74910b8820e380d441
          -patch_filename = libpng_1.6.39-2_patch.zip
          -patch_url = https://wrapdb.mesonbuild.com/v2/libpng_1.6.39-2/get_patch
          -patch_hash = 8bcf8f69f50233f3a35e3718ab3c91b0c51b4c1a08a84c87be0b1f4813adf17f
          -wrapdb_version = 1.6.39-2
          +patch_filename = libpng_1.6.39-3_patch.zip
          +patch_url = https://wrapdb.mesonbuild.com/v2/libpng_1.6.39-3/get_patch
          +patch_hash = 6af2a8d464e3f1d2e2832580896323ac7b0b786806c75f0eff0c8ec82dd603ec
          +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/libpng_1.6.39-3/libpng-1.6.39.tar.gz
          +wrapdb_version = 1.6.39-3
           
           [provide]
           libpng = libpng_dep
          diff --git a/subprojects/zlib.wrap b/subprojects/zlib.wrap
          index 23af071a2..4f19672e4 100644
          --- a/subprojects/zlib.wrap
          +++ b/subprojects/zlib.wrap
          @@ -1,12 +1,13 @@
           [wrap-file]
           directory = zlib-1.2.13
           source_url = http://zlib.net/fossils/zlib-1.2.13.tar.gz
          +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/zlib_1.2.13-4/zlib-1.2.13.tar.gz
           source_filename = zlib-1.2.13.tar.gz
           source_hash = b3a24de97a8fdbc835b9833169501030b8977031bcb54b3b3ac13740f846ab30
          -patch_filename = zlib_1.2.13-2_patch.zip
          -patch_url = https://wrapdb.mesonbuild.com/v2/zlib_1.2.13-2/get_patch
          -patch_hash = a7abea3ad65dc2c291ad5fbbf5355d0585a7f7b8c935d4a74335b8fe18684506
          -wrapdb_version = 1.2.13-2
          +patch_filename = zlib_1.2.13-4_patch.zip
          +patch_url = https://wrapdb.mesonbuild.com/v2/zlib_1.2.13-4/get_patch
          +patch_hash = 19636b7807e679b92240bc7a99aed85d1be908a45430b12c7687a825cb499d5e
          +wrapdb_version = 1.2.13-4
           
           [provide]
           zlib = zlib_dep
          -- 
          cgit v1.2.3
          
          
          From 355e9197462d03dc798117b6037cff681ab8a1c7 Mon Sep 17 00:00:00 2001
          From: Hugh McMaster 
          Date: Thu, 6 Jul 2023 21:07:16 +1000
          Subject: [gzip] Don't compile internal zlib development files when using
           system zlib.
          
          `src/gzip/rules.mk` compiles the internal zlib sources even when using the
          zlib development files provided by a host system.  If the internal zlib
          development files are not present, FreeType fails to build from source.
          
          This patch ensures the internal zlib development files are only
          prerequisites when not using zlib development files on a host system.
          
          * src/gzip/rules.mk (GZIP_DRV_SRCS): Define conditionally.
          ---
           src/gzip/rules.mk | 33 ++++++++++++++++-----------------
           1 file changed, 16 insertions(+), 17 deletions(-)
          
          diff --git a/src/gzip/rules.mk b/src/gzip/rules.mk
          index 050e14705..c76eacb1a 100644
          --- a/src/gzip/rules.mk
          +++ b/src/gzip/rules.mk
          @@ -36,24 +36,23 @@ endif
           #
           # All source and header files get loaded by `ftgzip.c' only if SYSTEM_ZLIB
           # is not defined (regardless whether we have a `single' or a `multi' build).
          -# However, it doesn't harm if we add everything as a dependency
          -# unconditionally.
           #
          -GZIP_DRV_SRCS := $(GZIP_DIR)/adler32.c  \
          -                 $(GZIP_DIR)/crc32.c    \
          -                 $(GZIP_DIR)/crc32.h    \
          -                 $(GZIP_DIR)/ftzconf.h  \
          -                 $(GZIP_DIR)/inffast.c  \
          -                 $(GZIP_DIR)/inffast.h  \
          -                 $(GZIP_DIR)/inffixed.h \
          -                 $(GZIP_DIR)/inflate.c  \
          -                 $(GZIP_DIR)/inflate.h  \
          -                 $(GZIP_DIR)/inftrees.c \
          -                 $(GZIP_DIR)/inftrees.h \
          -                 $(GZIP_DIR)/zlib.h     \
          -                 $(GZIP_DIR)/zutil.c    \
          -                 $(GZIP_DIR)/zutil.h
          -
          +ifeq ($(SYSTEM_ZLIB),)
          +  GZIP_DRV_SRCS := $(GZIP_DIR)/adler32.c  \
          +                   $(GZIP_DIR)/crc32.c    \
          +                   $(GZIP_DIR)/crc32.h    \
          +                   $(GZIP_DIR)/ftzconf.h  \
          +                   $(GZIP_DIR)/inffast.c  \
          +                   $(GZIP_DIR)/inffast.h  \
          +                   $(GZIP_DIR)/inffixed.h \
          +                   $(GZIP_DIR)/inflate.c  \
          +                   $(GZIP_DIR)/inflate.h  \
          +                   $(GZIP_DIR)/inftrees.c \
          +                   $(GZIP_DIR)/inftrees.h \
          +                   $(GZIP_DIR)/zlib.h     \
          +                   $(GZIP_DIR)/zutil.c    \
          +                   $(GZIP_DIR)/zutil.h
          +endif
           
           # gzip driver object(s)
           #
          -- 
          cgit v1.2.3
          
          
          From dec2743e6a2a40cddfc8a9892895cb4f861e1eeb Mon Sep 17 00:00:00 2001
          From: Hin-Tak Leung 
          Date: Fri, 7 Jul 2023 19:24:48 +0100
          Subject: * src/truetype/ttgload.c (TT_Hint_Glyph): More mostly cosmetic
           update.
          
          This is a follow-up to commit 49c74ac02, which creates a new local variable
          "exec = loader->exec", and shortening a lot of "loader->exec".  This commit
          does two more such changes missed in that first commit.
          
          Signed-off-by: Hin-Tak Leung 
          ---
           src/truetype/ttgload.c | 4 ++--
           1 file changed, 2 insertions(+), 2 deletions(-)
          
          diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
          index 5f15a7f4d..d538e8ee8 100644
          --- a/src/truetype/ttgload.c
          +++ b/src/truetype/ttgload.c
          @@ -820,7 +820,7 @@
                 FT_ARRAY_COPY( zone->org, zone->cur, zone->n_points );
           
               /* Reset graphics state. */
          -    loader->exec->GS = loader->size->GS;
          +    exec->GS = loader->size->GS;
           
               /* XXX: UNDOCUMENTED! Hinting instructions of a composite glyph */
               /*      completely refer to the (already) hinted subglyphs.     */
          @@ -860,7 +860,7 @@
                 exec->is_composite = is_composite;
                 exec->pts          = *zone;
           
          -      error = TT_Run_Context( loader->exec );
          +      error = TT_Run_Context( exec );
                 if ( error && exec->pedantic_hinting )
                   return error;
           
          -- 
          cgit v1.2.3
          
          
          From 26a7f0478b95a4da3551072a6c70a77187556f8c Mon Sep 17 00:00:00 2001
          From: Skef Iterum 
          Date: Tue, 11 Jul 2023 01:40:25 -0700
          Subject: [cff] Make blend operator work with floats in private dicts.
          
          The CFF2 blend operator takes N default values and corresponding
          sets of deltas and pushes N values specific to a designspace
          location.  CFF has a floating point numeric type and the FreeType
          blending code was not converting those into its internal 16.16
          Fixed type format.
          
          Fixes #1243.
          
          * src/cff/cffparse.c (do_fixed): Handle floating point numbers.
          Also fix scaling overflow check for integer-to-fixed conversion.
          
          * src/cff/cffload.c (cff_blend_doBlend): Updated.
          ---
           src/cff/cffload.c  |  7 ++++---
           src/cff/cffparse.c | 20 +++++++++++++++++++-
           2 files changed, 23 insertions(+), 4 deletions(-)
          
          diff --git a/src/cff/cffload.c b/src/cff/cffload.c
          index f96002ec0..bee89f0c6 100644
          --- a/src/cff/cffload.c
          +++ b/src/cff/cffload.c
          @@ -1364,11 +1364,12 @@
                 FT_UInt32        sum;
           
           
          -      /* convert inputs to 16.16 fixed-point */
          -      sum = cff_parse_num( parser, &parser->stack[i + base] ) * 0x10000;
          +      /* convert inputs to 16.16 fixed point */
          +      sum = cff_parse_fixed( parser, &parser->stack[i + base] );
           
                 for ( j = 1; j < blend->lenBV; j++ )
          -        sum += cff_parse_num( parser, &parser->stack[delta++] ) * *weight++;
          +        sum += FT_MulFix( cff_parse_fixed( parser, &parser->stack[delta++] ),
          +                          *weight++ );
           
                 /* point parser stack to new value on blend_stack */
                 parser->stack[i + base] = subFont->blend_top;
          diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c
          index c850dfc61..f8270aa52 100644
          --- a/src/cff/cffparse.c
          +++ b/src/cff/cffparse.c
          @@ -499,6 +499,24 @@
             {
               if ( **d == 30 )
                 return cff_parse_real( *d, parser->limit, scaling, NULL );
          +    else if ( **d == 255 )
          +    {
          +      FT_Fixed val = ( ( ( (FT_UInt32)*( d[0] + 1 ) << 24 ) |
          +                         ( (FT_UInt32)*( d[0] + 2 ) << 16 ) |
          +                         ( (FT_UInt32)*( d[0] + 3 ) <<  8 ) |
          +                           (FT_UInt32)*( d[0] + 4 )         ) );
          +
          +      if ( scaling )
          +      {
          +        if ( FT_ABS( val ) > power_ten_limits[scaling] )
          +        {
          +           FT_TRACE4(( "!!!OVERFLOW:!!!" ));
          +           return val > 0 ? 0x7FFFFFFFL : -0x7FFFFFFFL;
          +        }
          +        val *= power_tens[scaling];
          +      }
          +      return val;
          +    }
               else
               {
                 FT_Long  val = cff_parse_integer( *d, parser->limit );
          @@ -506,7 +524,7 @@
           
                 if ( scaling )
                 {
          -        if ( FT_ABS( val ) > power_ten_limits[scaling] )
          +        if ( ( FT_ABS( val ) << 16 ) > power_ten_limits[scaling] )
                   {
                     val = val > 0 ? 0x7FFFFFFFL : -0x7FFFFFFFL;
                     goto Overflow;
          -- 
          cgit v1.2.3
          
          
          From 85167dbd508c95cc923d36c0be8a602991c6e43a Mon Sep 17 00:00:00 2001
          From: Ben Wagner 
          Date: Thu, 13 Jul 2023 16:49:34 -0400
          Subject: [woff2] Remove sfnt size guess check
          
          In WOFF the `totalSfntSize` must be correct, however in WOFF2 this value
          is now just a hint and a conforming implementation must not reject
          otherwise valid data if the `totalSfntSize` turns out not to be exact.
          
          * src/sfnt/sfwoff2.c (woff2_open_font): remove check that uncompressed
          woff2 data would fit in the sfnt size guess.
          
          Fixes: #1235
          ---
           src/sfnt/sfwoff2.c | 7 -------
           1 file changed, 7 deletions(-)
          
          diff --git a/src/sfnt/sfwoff2.c b/src/sfnt/sfwoff2.c
          index 49ad5cc81..fecae276c 100644
          --- a/src/sfnt/sfwoff2.c
          +++ b/src/sfnt/sfwoff2.c
          @@ -2257,13 +2257,6 @@
                 goto Exit;
               }
           
          -    if ( woff2.uncompressed_size > sfnt_size )
          -    {
          -      FT_ERROR(( "woff2_open_font: SFNT table lengths are too large.\n" ));
          -      error = FT_THROW( Invalid_Table );
          -      goto Exit;
          -    }
          -
               /* Allocate memory for uncompressed table data. */
               if ( FT_QALLOC( uncompressed_buf, woff2.uncompressed_size ) ||
                    FT_FRAME_ENTER( woff2.totalCompressedSize )            )
          -- 
          cgit v1.2.3
          
          
          From 3c92e7bfc21289a53a748469f6c420bdd6a8941d Mon Sep 17 00:00:00 2001
          From: Werner Lemberg 
          Date: Fri, 14 Jul 2023 18:58:55 +0200
          Subject: [cff] Fix compiler warning.
          
          * src/cff/cffparse.c, src/cff/cffparse.h: Make `cff_parse_fixed` a local
          function.
          ---
           src/cff/cffparse.c | 2 +-
           src/cff/cffparse.h | 4 ++++
           2 files changed, 5 insertions(+), 1 deletion(-)
          
          diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c
          index f8270aa52..3b076704c 100644
          --- a/src/cff/cffparse.c
          +++ b/src/cff/cffparse.c
          @@ -554,7 +554,7 @@
           
           
             /* read a floating point number, either integer or real */
          -  static FT_Fixed
          +  FT_LOCAL_DEF( FT_Fixed )
             cff_parse_fixed( CFF_Parser  parser,
                              FT_Byte**   d )
             {
          diff --git a/src/cff/cffparse.h b/src/cff/cffparse.h
          index b6378a8e8..418caacc6 100644
          --- a/src/cff/cffparse.h
          +++ b/src/cff/cffparse.h
          @@ -76,6 +76,10 @@ FT_BEGIN_HEADER
             cff_parse_num( CFF_Parser  parser,
                            FT_Byte**   d );
           
          +  FT_LOCAL( FT_Fixed )
          +  cff_parse_fixed( CFF_Parser  parser,
          +                   FT_Byte**   d );
          +
             FT_LOCAL( FT_Error )
             cff_parser_init( CFF_Parser  parser,
                              FT_UInt     code,
          -- 
          cgit v1.2.3
          
          
          From 336503dfd73d0370b3c90f12582d86d832ddedc1 Mon Sep 17 00:00:00 2001
          From: Werner Lemberg 
          Date: Sun, 16 Jul 2023 07:36:01 +0200
          Subject: [woff2] Avoid allocation bomb.
          
          This is a fix for commit 85167dbd5, reported as
          
            https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=60615
          
          * src/sfnt/sfwoff2.c (MAX_SFNT_SIZE): New macro.
          (woff2_open_font): Use it to limit the maximum size of an uncompressed WOFF2
          font.
          ---
           src/sfnt/sfwoff2.c | 18 +++++++++++++++---
           1 file changed, 15 insertions(+), 3 deletions(-)
          
          diff --git a/src/sfnt/sfwoff2.c b/src/sfnt/sfwoff2.c
          index fecae276c..7dec540b4 100644
          --- a/src/sfnt/sfwoff2.c
          +++ b/src/sfnt/sfwoff2.c
          @@ -36,6 +36,8 @@
           #undef  FT_COMPONENT
           #define FT_COMPONENT  sfwoff2
           
          +  /* An arbitrary, heuristic size limit (67MByte) for expanded WOFF2 data. */
          +#define MAX_SFNT_SIZE  ( 1 << 26 )
           
           #define READ_255USHORT( var )  FT_SET_ERROR( Read255UShort( stream, &var ) )
           
          @@ -2180,9 +2182,8 @@
                 else
                   sfnt_size = woff2.totalSfntSize;
           
          -      /* Value 1<<26 = 67108864 is heuristic. */
          -      if (sfnt_size >= (1 << 26))
          -        sfnt_size = 1 << 26;
          +      if ( sfnt_size >= MAX_SFNT_SIZE )
          +        sfnt_size = MAX_SFNT_SIZE;
           
           #ifdef FT_DEBUG_LEVEL_TRACE
                 if ( sfnt_size != woff2.totalSfntSize )
          @@ -2257,6 +2258,17 @@
                 goto Exit;
               }
           
          +    /* We must not blindly trust `uncompressed_size` since its   */
          +    /* value might be corrupted.  If it is too large, reject the */
          +    /* font.  In other words, we don't accept a WOFF2 font that  */
          +    /* expands to something larger than MAX_SFNT_SIZE.  If ever  */
          +    /* necessary, this limit can be easily adjusted.             */
          +    if ( woff2.uncompressed_size > MAX_SFNT_SIZE )
          +    {
          +      FT_ERROR(( "Uncompressed font too large.\n" ));
          +      return FT_THROW( Array_Too_Large );
          +    }
          +
               /* Allocate memory for uncompressed table data. */
               if ( FT_QALLOC( uncompressed_buf, woff2.uncompressed_size ) ||
                    FT_FRAME_ENTER( woff2.totalCompressedSize )            )
          -- 
          cgit v1.2.3
          
          
          From dd3c9c5fecb163b7aa06ef115adb9274d4c9192a Mon Sep 17 00:00:00 2001
          From: Ben Wagner 
          Date: Tue, 18 Jul 2023 13:25:57 -0400
          Subject: [woff2] Clean up on large brotli expansion
          
          * src/sfnt/sfwoff2.c (woff2_open_font): set error and goto cleanup
          
          Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=60711
          ---
           src/sfnt/sfwoff2.c | 3 ++-
           1 file changed, 2 insertions(+), 1 deletion(-)
          
          diff --git a/src/sfnt/sfwoff2.c b/src/sfnt/sfwoff2.c
          index 7dec540b4..2be44a347 100644
          --- a/src/sfnt/sfwoff2.c
          +++ b/src/sfnt/sfwoff2.c
          @@ -2266,7 +2266,8 @@
               if ( woff2.uncompressed_size > MAX_SFNT_SIZE )
               {
                 FT_ERROR(( "Uncompressed font too large.\n" ));
          -      return FT_THROW( Array_Too_Large );
          +      error = FT_THROW( Array_Too_Large );
          +      goto Exit;
               }
           
               /* Allocate memory for uncompressed table data. */
          -- 
          cgit v1.2.3
          
          
          From e8aa5af936e55ab301b056ea6322571b65e845cf Mon Sep 17 00:00:00 2001
          From: Jouk Jansen 
          Date: Wed, 19 Jul 2023 13:34:45 +0200
          Subject: vms_make.com: Add `/warn=noinfo` to `CFLAGS`.
          
          This reduces enormously the informationals while compiling on x86_64 (i.e.,
          which `.h` file is inluded form where).
          ---
           vms_make.com | 96 ++++++++++++++++++++++++++++++------------------------------
           1 file changed, 48 insertions(+), 48 deletions(-)
          
          diff --git a/vms_make.com b/vms_make.com
          index a7696e3bf..2c792145e 100644
          --- a/vms_make.com
          +++ b/vms_make.com
          @@ -268,10 +268,10 @@ $ deck
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/list/show=all/include=([],[--.include],[--.src.base])
           
           .c.obj :
          -	cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	cc$(CFLAGS)/warn=noinfo/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
           	$(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
           
          @@ -310,10 +310,10 @@ $ deck
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.autofit])
           
           .c.obj :
          -	cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
           	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
           
          @@ -351,10 +351,10 @@ $ deck
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.builds.vms],[--.include],[--.src.base])
           
           .c.obj :
          -	cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
           	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
           
          @@ -427,7 +427,7 @@ $ deck
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.bdf])
           
           .c.obj :
          -	cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
           	cc$(CFLAGS)/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          @@ -468,7 +468,7 @@ $ deck
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.cache])/nowarn
           
           .c.obj :
          -	cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
           	cc$(CFLAGS)/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          @@ -512,10 +512,10 @@ $ deck
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.cff])
           
           .c.obj :
          -	cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
           	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
           
          @@ -553,10 +553,10 @@ $ deck
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.cid])
           
           .c.obj :
          -	cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
           	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
           
          @@ -594,10 +594,10 @@ $ deck
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.gxvalid])
           
           .c.obj :
          -	cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
           	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
           
          @@ -638,10 +638,10 @@ $ deck
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.gzip])
           
           .c.obj :
          -	cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
           	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
           
          @@ -684,10 +684,10 @@ $ deck
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.bzip2])
           
           .c.obj :
          -	cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
           	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
           
          @@ -728,10 +728,10 @@ $ deck
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.lzw])
           
           .c.obj :
          -	cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
           	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
           
          @@ -769,10 +769,10 @@ $ deck
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.otvalid])
           
           .c.obj :
          -	cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
           	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
           
          @@ -822,10 +822,10 @@ $ deck
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.pcf])
           
           .c.obj :
          -	cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
           	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
           
          @@ -863,10 +863,10 @@ $ deck
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.pfr])
           
           .c.obj :
          -	cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
           	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
           
          @@ -904,10 +904,10 @@ $ deck
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.psaux])
           
           .c.obj :
          -	cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
           	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
           
          @@ -945,10 +945,10 @@ $ deck
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.psnames])
           
           .c.obj :
          -	cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
           	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
           
          @@ -986,10 +986,10 @@ $ deck
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.psnames])
           
           .c.obj :
          -	cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
           	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
           
          @@ -1027,10 +1027,10 @@ $ deck
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.raster])
           
           .c.obj :
          -	cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
           	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
           
          @@ -1068,10 +1068,10 @@ $ deck
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.sfnt])
           
           .c.obj :
          -	cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
           	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
           
          @@ -1109,7 +1109,7 @@ $ deck
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.smooth])
           
           .c.obj :
          -	cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
           	cc$(CFLAGS)/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          @@ -1150,7 +1150,7 @@ $ deck
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.svg])
           
           .c.obj :
          -	cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
           	cc$(CFLAGS)/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          @@ -1191,10 +1191,10 @@ $ deck
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.truetype])
           
           .c.obj :
          -	cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
           	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
           
          @@ -1232,10 +1232,10 @@ $ deck
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.type1])
           
           .c.obj :
          -	cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
           	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
           
          @@ -1275,10 +1275,10 @@ $ deck
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.type1])
           
           .c.obj :
          -	cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
           	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
           
          @@ -1318,10 +1318,10 @@ $ deck
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.type42])
           
           .c.obj :
          -	cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
           	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
           
          @@ -1359,10 +1359,10 @@ $ deck
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.winfonts])
           
           .c.obj :
          -	cc$(CFLAGS)/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=disable=(MAYLOSEDATA3)/point=64\
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
           	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
           
          -- 
          cgit v1.2.3
          
          
          From 5769f13a6b9fafa3840726f06dde07e755501a16 Mon Sep 17 00:00:00 2001
          From: Jouk Jansen 
          Date: Wed, 19 Jul 2023 13:37:48 +0200
          Subject: vms_make.com: Make use of additional libraries optional.
          
          Check whether `.olb` files are present.
          
          Also check for the HarfBuzz library.
          ---
           vms_make.com | 18 ++++++++++++++----
           1 file changed, 14 insertions(+), 4 deletions(-)
          
          diff --git a/vms_make.com b/vms_make.com
          index 2c792145e..8d761d264 100644
          --- a/vms_make.com
          +++ b/vms_make.com
          @@ -74,16 +74,26 @@ $!
           $!
           $! Pull in external libraries
           $!
          +$ have_png = f$search("sys$library:libpng.olb/lib") .nes. ""
          +$ have_bz2 = f$search("sys$library:libbz2.olb") .nes. ""
          +$ have_z = f$search("sys$library:libpng.olb") .nes. ""
          +$ have_harfbuzz = f$search("") .nes. "sys$library:libharfbuzz.olb/lib"
          +$!
           $ create libs.opt
           $ open/write libsf libs.opt
          -$ write libsf "sys$library:libpng.olb/lib"
          -$ write libsf "sys$library:libbz2.olb/lib"
          -$ write libsf "sys$library:libz.olb/lib"
          +$ if ( have_harfbuzz ) then write libsf "sys$library:libharfbuzz.olb/lib"
          +$ if ( have_png ) then write libsf "sys$library:libpng.olb/lib"
          +$ if ( have_bz2 ) then write libsf "sys$library:libbz2.olb/lib"
          +$ if ( have_z ) then write libsf "sys$library:libz.olb/lib"
           $ close libsf
           $!
           $! Create objects
           $!
          -$ libdefs = "FT2_BUILD_LIBRARY,FT_CONFIG_OPTION_OLD_INTERNALS,FT_CONFIG_OPTION_USE_BZIP2=1,FT_CONFIG_OPTION_USE_PNG=1,FT_CONFIG_OPTION_SYSTEM_ZLIB=1"
          +$ libdefs = "FT2_BUILD_LIBRARY,FT_CONFIG_OPTION_OLD_INTERNALS"
          +$ if ( have_bz2 ) then libdef=libdefs+",FT_CONFIG_OPTION_USE_BZIP2=1"
          +$ if ( have_png ) then libdef=libdefs+",FT_CONFIG_OPTION_USE_PNG=1"
          +$ if ( have_z ) then libdef=libdefs+",FT_CONFIG_OPTION_USE_ZLIB=1"
          +$ if ( have_harfbuzz ) then libdef=libdefs+",FT_CONFIG_OPTION_USE_HARFBUZZ=1"
           $ if libdefs .nes. ""
           $ then
           $   ccopt = ccopt + "/define=(" + f$extract(0,f$length(libdefs)-1,libdefs) + ")"
          -- 
          cgit v1.2.3
          
          
          From 7c542d02bf9c58b37e314f9227a36b53ad508cb4 Mon Sep 17 00:00:00 2001
          From: Jouk Jansen 
          Date: Fri, 21 Jul 2023 21:31:28 +0200
          Subject: * src/smooth/ftgrays.c (FT_SSE2): Fix definition for VMS.
          
          ---
           src/smooth/ftgrays.c | 9 +++++----
           1 file changed, 5 insertions(+), 4 deletions(-)
          
          diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
          index 6252df98a..55628af9e 100644
          --- a/src/smooth/ftgrays.c
          +++ b/src/smooth/ftgrays.c
          @@ -1006,10 +1006,11 @@ typedef ptrdiff_t  FT_PtrDist;
              *
              * For other cases, using binary splits is actually slightly faster.
              */
          -#if defined( __SSE2__ )                            || \
          -    ( defined( __x86_64__ ) && !defined( __VMS ) ) || \
          -    defined( _M_AMD64 )                            || \
          -    ( defined( _M_IX86_FP ) && _M_IX86_FP >= 2 )
          +#if ( defined( __SSE2__ )                          ||   \
          +      defined( __x86_64__ )                        ||   \
          +      defined( _M_AMD64 )                          ||   \
          +      ( defined( _M_IX86_FP ) && _M_IX86_FP >= 2 ) ) && \
          +    !defined( __VMS )
           #  define FT_SSE2 1
           #else
           #  define FT_SSE2 0
          -- 
          cgit v1.2.3
          
          
          From f7ae7e88e9fde4fccbe7bbd03d72e411fb0e4db3 Mon Sep 17 00:00:00 2001
          From: Jouk Jansen 
          Date: Fri, 21 Jul 2023 21:33:20 +0200
          Subject: * vms_make.com: Fix typos.
          
          ---
           vms_make.com | 6 +++---
           1 file changed, 3 insertions(+), 3 deletions(-)
          
          diff --git a/vms_make.com b/vms_make.com
          index 8d761d264..52a607599 100644
          --- a/vms_make.com
          +++ b/vms_make.com
          @@ -74,10 +74,10 @@ $!
           $!
           $! Pull in external libraries
           $!
          -$ have_png = f$search("sys$library:libpng.olb/lib") .nes. ""
          +$ have_png = f$search("sys$library:libpng.olb") .nes. ""
           $ have_bz2 = f$search("sys$library:libbz2.olb") .nes. ""
          -$ have_z = f$search("sys$library:libpng.olb") .nes. ""
          -$ have_harfbuzz = f$search("") .nes. "sys$library:libharfbuzz.olb/lib"
          +$ have_z = f$search("sys$library:libz.olb") .nes. ""
          +$ have_harfbuzz = f$search("sys$library:libharfbuzz.olb") .nes. ""
           $!
           $ create libs.opt
           $ open/write libsf libs.opt
          -- 
          cgit v1.2.3
          
          
          From 9e3c5d7e183c1a8d5ed8868d7d28ef18d3ec9ec8 Mon Sep 17 00:00:00 2001
          From: Jouk Jansen 
          Date: Fri, 21 Jul 2023 21:36:57 +0200
          Subject: * vms_make.com: Provide separate library compiled with C++.
          
          Some types on OpenVMS x86_64 (for example, `long') have different sizes
          depending on whether compiled with either C or C++.  In particular,
          X-Windows applications crash if linked with the C++ version.
          
          This patch makes `vms_make.com` create a second version of the FreeType
          library compiled with C++ if OpenVMS is running on the x86_64 platform.
          ---
           vms_make.com | 704 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
           1 file changed, 653 insertions(+), 51 deletions(-)
          
          diff --git a/vms_make.com b/vms_make.com
          index 52a607599..2c85a016a 100644
          --- a/vms_make.com
          +++ b/vms_make.com
          @@ -34,6 +34,13 @@ $! 0.01 20040401 First version to receive a number
           $! 0.02 20041030 Add error handling, FreeType 2.1.9
           $!
           $ on error then goto err_exit
          +$!
          +$! Get platform
          +$ vax      = f$getsyi("ARCH_NAME").eqs. "VAX"
          +$ axp      = f$getsyi("ARCH_NAME").eqs. "Alpha"
          +$ ia64     = f$getsyi("ARCH_NAME").eqs. "IA64"
          +$ x86_64   = f$getsyi("ARCH_NAME").eqs. "x86_64"
          +$!
           $ true  = 1
           $ false = 0
           $ tmpnam = "temp_" + f$getjpi("","pid")
          @@ -48,6 +55,7 @@ $! Setup variables holding "config" information
           $!
           $ Make    = ""
           $ ccopt   = "/name=(as_is,short)/float=ieee"
          +$ if ( x86_64 ) then cxxopt = "/name=(as_is,short)"
           $ lopts   = ""
           $ dnsrl   = ""
           $ aconf_in_file = "config.hin"
          @@ -86,34 +94,45 @@ $ if ( have_png ) then write libsf "sys$library:libpng.olb/lib"
           $ if ( have_bz2 ) then write libsf "sys$library:libbz2.olb/lib"
           $ if ( have_z ) then write libsf "sys$library:libz.olb/lib"
           $ close libsf
          +$ open/write libsf libs_cxx.opt
          +$ if ( have_harfbuzz ) then write libsf "sys$library:libharfbuzz.olb/lib"
          +$ if ( have_png ) then write libsf "sys$library:libpng_cxx.olb/lib"
          +$ if ( have_bz2 ) then write libsf "sys$library:libbz2_cxx.olb/lib"
          +$ if ( have_z ) then write libsf "sys$library:libz_cxx.olb/lib"
          +$ close libsf
           $!
           $! Create objects
           $!
           $ libdefs = "FT2_BUILD_LIBRARY,FT_CONFIG_OPTION_OLD_INTERNALS"
          -$ if ( have_bz2 ) then libdef=libdefs+",FT_CONFIG_OPTION_USE_BZIP2=1"
          -$ if ( have_png ) then libdef=libdefs+",FT_CONFIG_OPTION_USE_PNG=1"
          -$ if ( have_z ) then libdef=libdefs+",FT_CONFIG_OPTION_USE_ZLIB=1"
          -$ if ( have_harfbuzz ) then libdef=libdefs+",FT_CONFIG_OPTION_USE_HARFBUZZ=1"
          +$ if ( have_bz2 ) then libdefs=libdefs+",FT_CONFIG_OPTION_USE_BZIP2=1"
          +$ if ( have_png ) then libdefs=libdefs+",FT_CONFIG_OPTION_USE_PNG=1"
          +$ if ( have_z ) then libdefs=libdefs+",FT_CONFIG_OPTION_SYSTEM_ZLIB=1"
          +$ if ( have_harfbuzz ) then libdefs=libdefs+",FT_CONFIG_OPTION_USE_HARFBUZZ=1"
           $ if libdefs .nes. ""
           $ then
          -$   ccopt = ccopt + "/define=(" + f$extract(0,f$length(libdefs)-1,libdefs) + ")"
          +$   ccopt = ccopt + "/define=(" + libdefs + ")"
          +$ if ( x86_64 ) then cxxopt = cxxopt + "/define=(" + libdefs + ")"
           $ endif
           $!
           $ if f$locate("AS_IS",f$edit(ccopt,"UPCASE")) .lt. f$length(ccopt) -
               then s_case = true
           $ gosub crea_mms
           $!
          -$ 'Make' /macro=(comp_flags="''ccopt'")
          +$ if x86_64
          +$ then
          +$   'Make' /macro=(comp_flags="''ccopt'",cxxcomp_flags="''cxxopt'","X86=1")
          +$ else
          +$   'Make' /macro=(comp_flags="''ccopt'")
          +$ endif
           $ purge/nolog [...]descrip.mms
           $!
           $!
           $! Alpha & Itanium get a shareable image
           $!
          -$ If f$getsyi("HW_MODEL") .gt. 1024 .or. f$getsyi("HW_MODEL") .eq. 0
          +$ If .not. vax
           $ Then
           $   write sys$output "Creating freetype2shr.exe"
           $   library/extract=* [.lib]freetype.olb
          -$   pipe link/nodeb/noshare/noexe/map=libfreetype.map/full freetype.obj | copy sys$input nl:
           $   set def [.src.tools]
           $   cc apinames.c
           $   link apinames
          @@ -134,6 +153,22 @@ $   link/nodeb/share=[.lib]freetype2shr.exe/map=libfreetype.map/full -
                 libfreetype/opt,freetype_vms/opt,libs/opt
           $   delete freetype.obj;*
           $ endif
          +$ if x86_64
          +$ then
          +$   write sys$output "Creating freetype2shr_cxx.exe"
          +$   library/extract=* [.lib]freetype_cxx.olb
          +$   open/write file  libfreetype_cxx.opt
          +$   write file "!"
          +$   write file "! libfreetype_cxx.opt generated by vms_make.com"
          +$   write file "!"
          +$   write file "IDENTIFICATION=""freetype2 2.0"""
          +$   write file "GSMATCH=LEQUAL,2,0
          +$   write file "freetype_cxx.obj"
          +$   close file
          +$   link/nodeb/share=[.lib]freetype2shr_cxx.exe/map=libfreetype_cxx.map/full -
          +      libfreetype_cxx/opt,freetype_vms/opt,libs_cxx/opt
          +$   delete freetype_cxx.obj;*
          +$ endif
           $!
           $ exit
           $!
          @@ -175,6 +210,7 @@ $ deck
           # fully.
           $ EOD
           $ write out "CFLAGS = ", ccopt
          +$ if x86_64 then write out "CXXFLAGS = ", cxxopt
           $ copy sys$input: out
           $ deck
           
          @@ -276,22 +312,43 @@ $ deck
           
           
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/list/show=all/include=([],[--.include],[--.src.base])
          +.ifdef X86
          +CXXFLAGS=$(CXXCOMP_FLAGS)$(DEBUG)/list/show=all/include=([],[--.include],[--.src.base])
          +.endif
           
          +.ifdef X86
           .c.obj :
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c
           	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
           	cc$(CFLAGS)/warn=noinfo/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
           	$(MMS$TARGET_NAME)_64.c
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_64_cxx.obj $(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
          +.else
          +.c.obj :
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
          +	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          +	cc$(CFLAGS)/warn=noinfo/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
          +	delete $(MMS$TARGET_NAME)_64.c;*
          +.endif
           
           OBJS=ftsystem.obj
           
           OBJS64=ftsystem_64.obj
           
          +OBJSCXX=ftsystem_cxx.obj
          +
           all : $(OBJS)
                   library/create [--.lib]freetype.olb $(OBJS)
                   library [--.lib]freetype.olb $(OBJS64)
          +.ifdef X86
          +        library/create [--.lib]freetype_cxx.olb $(OBJSCXX)
          +        library [--.lib]freetype_cxx.olb $(OBJS64)
          +.endif
           
           ftsystem.obj : ftsystem.c ftconfig.h
           
          @@ -318,22 +375,43 @@ $ deck
           # fully.
           
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.autofit])
          +.ifdef X86
          +CXXFLAGS=$(CXXCOMP_FLAGS)$(DEBUG)/list/show=all/include=([],[--.include],[--.src.base])
          +.endif
           
          +.ifdef X86
           .c.obj :
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c
           	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
          -	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          +	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map nl: exclude hb_
           	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
           	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_64_cxx.obj $(MMS$TARGET_NAME)_64.c
          +	delete $(MMS$TARGET_NAME)_64.c;*
          +.else
          +.c.obj :
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
          +	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
          +.endif
           
           OBJS=autofit.obj
           
           OBJS64=autofit_64.obj
           
          +OBJSCXX=autofit_cxx.obj
          +
           all : $(OBJS)
                   library [--.lib]freetype.olb $(OBJS)
                   library [--.lib]freetype.olb $(OBJS64)
          +.ifdef X86
          +        library [--.lib]freetype_cxx.olb $(OBJSCXX)
          +        library [--.lib]freetype_cxx.olb $(OBJS64)
          +.endif
           
           # EOF
           $ eod
          @@ -359,14 +437,29 @@ $ deck
           
           
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.builds.vms],[--.include],[--.src.base])
          +.ifdef X86
          +CXXFLAGS=$(CXXCOMP_FLAGS)$(DEBUG)/list/show=all/include=([],[--.include],[--.src.base])
          +.endif
           
          +.ifdef X86
           .c.obj :
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c
           	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
           	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
           	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_64_cxx.obj $(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
          +.else
          +.c.obj :
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
          +	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
          +	delete $(MMS$TARGET_NAME)_64.c;*
          +.endif
           
           OBJS=ftbase.obj,\
                ftbbox.obj,\
          @@ -402,9 +495,30 @@ OBJS64=ftbase_64.obj,\
                fttype1_64.obj,\
                ftwinfnt_64.obj,ftpatent_64.obj,ftgxval_64.obj,ftotval_64.obj
           
          +OBJSCXX=ftbase_cxx.obj,\
          +     ftbbox_cxx.obj,\
          +     ftbdf_cxx.obj,\
          +     ftbitmap_cxx.obj,\
          +     ftcid_cxx.obj,\
          +     ftdebug_cxx.obj,\
          +     ftfstype_cxx.obj,\
          +     ftgasp_cxx.obj,\
          +     ftglyph_cxx.obj,\
          +     ftinit_cxx.obj,\
          +     ftmm_cxx.obj,\
          +     ftpfr_cxx.obj,\
          +     ftstroke_cxx.obj,\
          +     ftsynth_cxx.obj,\
          +     fttype1_cxx.obj,\
          +     ftwinfnt_cxx.obj,ftpatent_cxx.obj,ftgxval_cxx.obj,ftotval_cxx.obj
          +
           all : $(OBJS)
                   library [--.lib]freetype.olb $(OBJS)
                   library [--.lib]freetype.olb $(OBJS64)
          +.ifdef X86
          +        library [--.lib]freetype_cxx.olb $(OBJSCXX)
          +        library [--.lib]freetype_cxx.olb $(OBJS64)
          +.endif
           
           ftbase.obj : ftbase.c ftadvanc.c ftcalc.c ftcolor.c ftdbgmem.c fterrors.c\
           	ftfntfmt.c ftgloadr.c fthash.c ftlcdfil.c ftmac.c ftobjs.c ftoutln.c\
          @@ -435,22 +549,43 @@ $ deck
           
           
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.bdf])
          +.ifdef X86
          +CXXFLAGS=$(CXXCOMP_FLAGS)$(DEBUG)/list/show=all/include=([],[--.include],[--.src.base])
          +.endif
           
          +.ifdef X86
          +.c.obj :
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
          +	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          +	cc$(CFLAGS)/warn=noinfo/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_64_cxx.obj $(MMS$TARGET_NAME)_64.c
          +	delete $(MMS$TARGET_NAME)_64.c;*
          +.else
           .c.obj :
           	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
           	$(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
          +.endif
           
           OBJS=bdf.obj
           
           OBJS64=bdf_64.obj
           
          +OBJSCXX=bdf_cxx.obj
          +
           all : $(OBJS)
                   library [--.lib]freetype.olb $(OBJS)
                   library [--.lib]freetype.olb $(OBJS64)
          +.ifdef X86
          +        library [--.lib]freetype_cxx.olb $(OBJSCXX)
          +        library [--.lib]freetype_cxx.olb $(OBJS64)
          +.endif
           
           # EOF
           $ eod
          @@ -476,22 +611,43 @@ $ deck
           
           
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.cache])/nowarn
          +.ifdef X86
          +CXXFLAGS=$(CXXCOMP_FLAGS)$(DEBUG)/list/show=all/include=([],[--.include],[--.src.base])
          +.endif
           
          +.ifdef X86
          +.c.obj :
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
          +	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          +	cc$(CFLAGS)/warn=noinfo/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_64_cxx.obj $(MMS$TARGET_NAME)_64.c
          +	delete $(MMS$TARGET_NAME)_64.c;*
          +.else
           .c.obj :
           	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
           	$(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
          +.endif
           
           OBJS=ftcache.obj
           
           OBJS64=ftcache_64.obj
           
          +OBJSCXX=ftcache_cxx.obj
          +
           all : $(OBJS)
                   library [--.lib]freetype.olb $(OBJS)
                   library [--.lib]freetype.olb $(OBJS64)
          +.ifdef X86
          +        library [--.lib]freetype_cxx.olb $(OBJSCXX)
          +        library [--.lib]freetype_cxx.olb $(OBJS64)
          +.endif
           
           ftcache.obj : ftcache.c ftcbasic.c ftccache.c ftccmap.c ftcglyph.c ftcimage.c \
           	ftcmanag.c ftcmru.c ftcsbits.c
          @@ -520,22 +676,43 @@ $ deck
           
           
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.cff])
          +.ifdef X86
          +CXXFLAGS=$(CXXCOMP_FLAGS)$(DEBUG)/list/show=all/include=([],[--.include],[--.src.base])
          +.endif
           
          +.ifdef X86
           .c.obj :
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c
           	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
          -	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_64_cxx.obj $(MMS$TARGET_NAME)_64.c
          +	delete $(MMS$TARGET_NAME)_64.c;*
          +.else
          +.c.obj :
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
          +	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
          +.endif
           
           OBJS=cff.obj
           
           OBJS64=cff_64.obj
           
          +OBJSCXX=cff_cxx.obj
          +
           all : $(OBJS)
                   library [--.lib]freetype.olb $(OBJS)
                   library [--.lib]freetype.olb $(OBJS64)
          +.ifdef X86
          +        library [--.lib]freetype_cxx.olb $(OBJSCXX)
          +        library [--.lib]freetype_cxx.olb $(OBJS64)
          +.endif
           
           # EOF
           $ eod
          @@ -561,22 +738,43 @@ $ deck
           
           
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.cid])
          +.ifdef X86
          +CXXFLAGS=$(CXXCOMP_FLAGS)$(DEBUG)/list/show=all/include=([],[--.include],[--.src.base])
          +.endif
           
          +.ifdef X86
           .c.obj :
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c
           	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
          -	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_64_cxx.obj $(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
          +.else
          +.c.obj :
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
          +	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
          +	delete $(MMS$TARGET_NAME)_64.c;*
          +.endif
           
           OBJS=type1cid.obj
           
           OBJS64=type1cid_64.obj
           
          +OBJSCXX=type1cid_cxx.obj
          +
           all : $(OBJS)
                   library [--.lib]freetype.olb $(OBJS)
                   library [--.lib]freetype.olb $(OBJS64)
          +.ifdef X86
          +        library [--.lib]freetype_cxx.olb $(OBJSCXX)
          +        library [--.lib]freetype_cxx.olb $(OBJS64)
          +.endif
           
           # EOF
           $ eod
          @@ -602,22 +800,43 @@ $ deck
           
           
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.gxvalid])
          +.ifdef X86
          +CXXFLAGS=$(CXXCOMP_FLAGS)$(DEBUG)/list/show=all/include=([],[--.include],[--.src.base])
          +.endif
           
          +.ifdef X86
           .c.obj :
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c
           	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
          -	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_64_cxx.obj $(MMS$TARGET_NAME)_64.c
          +	delete $(MMS$TARGET_NAME)_64.c;*
          +.else
          +.c.obj :
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
          +	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
          +.endif
           
           OBJS=gxvalid.obj
           
           OBJS64=gxvalid_64.obj
           
          +OBJSCXX=gxvalid_cxx.obj
          +
           all : $(OBJS)
                   library [--.lib]freetype.olb $(OBJS)
                   library [--.lib]freetype.olb $(OBJS64)
          +.ifdef X86
          +        library [--.lib]freetype_cxx.olb $(OBJSCXX)
          +        library [--.lib]freetype_cxx.olb $(OBJS64)
          +.endif
           
           # EOF
           $ eod
          @@ -642,26 +861,48 @@ $ deck
           # fully.
           $EOD
           $ write out "COMP_FLAGS = ", ccopt
          +$ if x86_64 then write out "CXXFLAGS = ", cxxopt
           $ copy sys$input: out
           $ deck
           
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.gzip])
          +.ifdef X86
          +CXXFLAGS=$(CXXCOMP_FLAGS)$(DEBUG)/list/show=all/include=([],[--.include],[--.src.base])
          +.endif
           
          +.ifdef X86
           .c.obj :
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c
           	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
          -	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_64_cxx.obj $(MMS$TARGET_NAME)_64.c
          +	delete $(MMS$TARGET_NAME)_64.c;*
          +.else
          +.c.obj :
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
          +	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
          +.endif
           
           OBJS=ftgzip.obj
           
           OBJS64=ftgzip_64.obj
           
          +OBJSCXX=ftgzip_cxx.obj
          +
           all : $(OBJS)
                   library [--.lib]freetype.olb $(OBJS)
                   library [--.lib]freetype.olb $(OBJS64)
          +.ifdef X86
          +        library [--.lib]freetype_cxx.olb $(OBJSCXX)
          +        library [--.lib]freetype_cxx.olb $(OBJS64)
          +.endif
           
           # EOF
           $ eod
          @@ -688,26 +929,48 @@ $ deck
           # fully.
           $EOD
           $ write out "COMP_FLAGS = ", ccopt
          +$ if x86_64 then write out "CXXFLAGS = ", cxxopt
           $ copy sys$input: out
           $ deck
           
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.bzip2])
          +.ifdef X86
          +CXXFLAGS=$(CXXCOMP_FLAGS)$(DEBUG)/list/show=all/include=([],[--.include],[--.src.base])
          +.endif
           
          +.ifdef X86
           .c.obj :
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c
           	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
          -	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_64_cxx.obj $(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
          +.else
          +.c.obj :
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
          +	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
          +	delete $(MMS$TARGET_NAME)_64.c;*
          +.endif
           
           OBJS=ftbzip2.obj
           
           OBJS64=ftbzip2_64.obj
           
          +OBJSCXX=ftbzip2_cxx.obj
          +
           all : $(OBJS)
                   library [--.lib]freetype.olb $(OBJS)
                   library [--.lib]freetype.olb $(OBJS64)
          +.ifdef X86
          +        library [--.lib]freetype_cxx.olb $(OBJSCXX)
          +        library [--.lib]freetype_cxx.olb $(OBJS64)
          +.endif
           
           # EOF
           $ eod
          @@ -732,26 +995,48 @@ $ deck
           # fully.
           $EOD
           $ write out "COMP_FLAGS = ", ccopt
          +$ if x86_64 then write out "CXXFLAGS = ", cxxopt
           $ copy sys$input: out
           $ deck
           
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.lzw])
          +.ifdef X86
          +CXXFLAGS=$(CXXCOMP_FLAGS)$(DEBUG)/list/show=all/include=([],[--.include],[--.src.base])
          +.endif
           
          +.ifdef X86
           .c.obj :
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c
           	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
          -	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_64_cxx.obj $(MMS$TARGET_NAME)_64.c
          +	delete $(MMS$TARGET_NAME)_64.c;*
          +.else
          +.c.obj :
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
          +	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
          +.endif
           
           OBJS=ftlzw.obj
           
           OBJS64=ftlzw_64.obj
           
          +OBJSCXX=ftlzw_cxx.obj
          +
           all : $(OBJS)
                   library [--.lib]freetype.olb $(OBJS)
                   library [--.lib]freetype.olb $(OBJS64)
          +.ifdef X86
          +        library [--.lib]freetype_cxx.olb $(OBJSCXX)
          +        library [--.lib]freetype_cxx.olb $(OBJS64)
          +.endif
           
           # EOF
           $ eod
          @@ -777,22 +1062,43 @@ $ deck
           
           
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.otvalid])
          +.ifdef X86
          +CXXFLAGS=$(CXXCOMP_FLAGS)$(DEBUG)/list/show=all/include=([],[--.include],[--.src.base])
          +.endif
           
          +.ifdef X86
           .c.obj :
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c
           	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
          -	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_64_cxx.obj $(MMS$TARGET_NAME)_64.c
          +	delete $(MMS$TARGET_NAME)_64.c;*
          +.else
          +.c.obj :
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
          +	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
          +.endif
           
           OBJS=otvalid.obj
           
           OBJS64=otvalid_64.obj
           
          +OBJSCXX=otvalid_cxx.obj
          +
           all : $(OBJS)
                   library [--.lib]freetype.olb $(OBJS)
                   library [--.lib]freetype.olb $(OBJS64)
          +.ifdef X86
          +        library [--.lib]freetype_cxx.olb $(OBJSCXX)
          +        library [--.lib]freetype_cxx.olb $(OBJS64)
          +.endif
           
           # EOF
           $ eod
          @@ -830,22 +1136,43 @@ $ deck
           
           
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.pcf])
          +.ifdef X86
          +CXXFLAGS=$(CXXCOMP_FLAGS)$(DEBUG)/list/show=all/include=([],[--.include],[--.src.base])
          +.endif
           
          +.ifdef X86
           .c.obj :
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c
           	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
          -	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
          +	cc$(CFLAGS)/warn=noinfo/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_64_cxx.obj $(MMS$TARGET_NAME)_64.c
          +	delete $(MMS$TARGET_NAME)_64.c;*
          +.else
          +.c.obj :
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
          +	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
          +.endif
           
           OBJS=pcf.obj
           
           OBJS64=pcf_64.obj
           
          +OBJSCXX=pcf_cxx.obj
          +
           all : $(OBJS)
                   library [--.lib]freetype.olb $(OBJS)
                   library [--.lib]freetype.olb $(OBJS64)
          +.ifdef X86
          +        library [--.lib]freetype_cxx.olb $(OBJSCXX)
          +        library [--.lib]freetype_cxx.olb $(OBJS64)
          +.endif
           
           # EOF
           $ eod
          @@ -871,22 +1198,43 @@ $ deck
           
           
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.pfr])
          +.ifdef X86
          +CXXFLAGS=$(CXXCOMP_FLAGS)$(DEBUG)/list/show=all/include=([],[--.include],[--.src.base])
          +.endif
           
          +.ifdef X86
           .c.obj :
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c
           	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
          -	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_64_cxx.obj $(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
          +.else
          +.c.obj :
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
          +	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
          +	delete $(MMS$TARGET_NAME)_64.c;*
          +.endif
           
           OBJS=pfr.obj
           
           OBJS64=pfr_64.obj
           
          +OBJSCXX=pfr_cxx.obj
          +
           all : $(OBJS)
                   library [--.lib]freetype.olb $(OBJS)
                   library [--.lib]freetype.olb $(OBJS64)
          +.ifdef X86
          +        library [--.lib]freetype_cxx.olb $(OBJSCXX)
          +        library [--.lib]freetype_cxx.olb $(OBJS64)
          +.endif
           
           # EOF
           $ eod
          @@ -912,22 +1260,43 @@ $ deck
           
           
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.psaux])
          +.ifdef X86
          +CXXFLAGS=$(CXXCOMP_FLAGS)$(DEBUG)/list/show=all/include=([],[--.include],[--.src.base])
          +.endif
           
          +.ifdef X86
           .c.obj :
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c
           	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
          -	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_64_cxx.obj $(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
          +.else
          +.c.obj :
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
          +	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
          +	delete $(MMS$TARGET_NAME)_64.c;*
          +.endif
           
           OBJS=psaux.obj
           
           OBJS64=psaux_64.obj
           
          +OBJSCXX=psaux_cxx.obj
          +
           all : $(OBJS)
                   library [--.lib]freetype.olb $(OBJS)
                   library [--.lib]freetype.olb $(OBJS64)
          +.ifdef X86
          +        library [--.lib]freetype_cxx.olb $(OBJSCXX)
          +        library [--.lib]freetype_cxx.olb $(OBJS64)
          +.endif
           
           # EOF
           $ eod
          @@ -953,22 +1322,43 @@ $ deck
           
           
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.psnames])
          +.ifdef X86
          +CXXFLAGS=$(CXXCOMP_FLAGS)$(DEBUG)/list/show=all/include=([],[--.include],[--.src.base])
          +.endif
           
          +.ifdef X86
           .c.obj :
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c
           	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
          -	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_64_cxx.obj $(MMS$TARGET_NAME)_64.c
          +	delete $(MMS$TARGET_NAME)_64.c;*
          +.else
          +.c.obj :
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
          +	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
          +.endif
           
           OBJS=pshinter.obj
           
           OBJS64=pshinter_64.obj
           
          +OBJSCXX=pshinter_cxx.obj
          +
           all : $(OBJS)
                   library [--.lib]freetype.olb $(OBJS)
                   library [--.lib]freetype.olb $(OBJS64)
          +.ifdef X86
          +        library [--.lib]freetype_cxx.olb $(OBJSCXX)
          +        library [--.lib]freetype_cxx.olb $(OBJS64)
          +.endif
           
           # EOF
           $ eod
          @@ -994,22 +1384,43 @@ $ deck
           
           
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.psnames])
          +.ifdef X86
          +CXXFLAGS=$(CXXCOMP_FLAGS)$(DEBUG)/list/show=all/include=([],[--.include],[--.src.base])
          +.endif
           
          +.ifdef X86
           .c.obj :
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c
           	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
          -	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_64_cxx.obj $(MMS$TARGET_NAME)_64.c
          +	delete $(MMS$TARGET_NAME)_64.c;*
          +.else
          +.c.obj :
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
          +	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
          +.endif
           
           OBJS=psnames.obj
           
           OBJS64=psnames_64.obj
           
          +OBJSCXX=psnames_cxx.obj
          +
           all : $(OBJS)
                   library [--.lib]freetype.olb $(OBJS)
                   library [--.lib]freetype.olb $(OBJS64)
          +.ifdef X86
          +        library [--.lib]freetype_cxx.olb $(OBJSCXX)
          +        library [--.lib]freetype_cxx.olb $(OBJS64)
          +.endif
           
           # EOF
           $ eod
          @@ -1035,22 +1446,43 @@ $ deck
           
           
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.raster])
          +.ifdef X86
          +CXXFLAGS=$(CXXCOMP_FLAGS)$(DEBUG)/list/show=all/include=([],[--.include],[--.src.base])
          +.endif
           
          +.ifdef X86
           .c.obj :
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c
           	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
          -	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_64_cxx.obj $(MMS$TARGET_NAME)_64.c
          +	delete $(MMS$TARGET_NAME)_64.c;*
          +.else
          +.c.obj :
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
          +	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
          +.endif
           
           OBJS=raster.obj
           
           OBJS64=raster_64.obj
           
          +OBJSCXX=raster_cxx.obj
          +
           all : $(OBJS)
                   library [--.lib]freetype.olb $(OBJS)
                   library [--.lib]freetype.olb $(OBJS64)
          +.ifdef X86
          +        library [--.lib]freetype_cxx.olb $(OBJSCXX)
          +        library [--.lib]freetype_cxx.olb $(OBJS64)
          +.endif
           
           # EOF
           $ eod
          @@ -1076,22 +1508,43 @@ $ deck
           
           
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.sfnt])
          +.ifdef X86
          +CXXFLAGS=$(CXXCOMP_FLAGS)$(DEBUG)/list/show=all/include=([],[--.include],[--.src.base])
          +.endif
           
          +.ifdef X86
           .c.obj :
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c
           	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
          -	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_64_cxx.obj $(MMS$TARGET_NAME)_64.c
          +	delete $(MMS$TARGET_NAME)_64.c;*
          +.else
          +.c.obj :
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
          +	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
          +.endif
           
           OBJS=sfnt.obj
           
           OBJS64=sfnt_64.obj
           
          +OBJSCXX=sfnt_cxx.obj
          +
           all : $(OBJS)
                   library [--.lib]freetype.olb $(OBJS)
                   library [--.lib]freetype.olb $(OBJS64)
          +.ifdef X86
          +        library [--.lib]freetype_cxx.olb $(OBJSCXX)
          +        library [--.lib]freetype_cxx.olb $(OBJS64)
          +.endif
           
           # EOF
           $ eod
          @@ -1117,22 +1570,43 @@ $ deck
           
           
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.smooth])
          +.ifdef X86
          +CXXFLAGS=$(CXXCOMP_FLAGS)$(DEBUG)/list/show=all/include=([],[--.include],[--.src.base])
          +.endif
           
          +.ifdef X86
          +.c.obj :
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
          +	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          +	cc$(CFLAGS)/warn=noinfo/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_64_cxx.obj $(MMS$TARGET_NAME)_64.c
          +	delete $(MMS$TARGET_NAME)_64.c;*
          +.else
           .c.obj :
           	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
           	$(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
          +.endif
           
           OBJS=smooth.obj
           
           OBJS64=smooth_64.obj
           
          +OBJSCXX=smooth_cxx.obj
          +
           all : $(OBJS)
                   library [--.lib]freetype.olb $(OBJS)
                   library [--.lib]freetype.olb $(OBJS64)
          +.ifdef X86
          +        library [--.lib]freetype_cxx.olb $(OBJSCXX)
          +        library [--.lib]freetype_cxx.olb $(OBJS64)
          +.endif
           
           # EOF
           $ eod
          @@ -1158,22 +1632,43 @@ $ deck
           
           
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.svg])
          +.ifdef X86
          +CXXFLAGS=$(CXXCOMP_FLAGS)$(DEBUG)/list/show=all/include=([],[--.include],[--.src.base])
          +.endif
           
          +.ifdef X86
           .c.obj :
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c
           	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	cc$(CFLAGS)/warn=noinfo/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
           	$(MMS$TARGET_NAME)_64.c
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_64_cxx.obj $(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
          +.else
          +.c.obj :
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
          +	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
          +	delete $(MMS$TARGET_NAME)_64.c;*
          +.endif
           
           OBJS=svg.obj
           
           OBJS64=svg_64.obj
           
          +OBJSCXX=svg_cxx.obj
          +
           all : $(OBJS)
                   library [--.lib]freetype.olb $(OBJS)
                   library [--.lib]freetype.olb $(OBJS64)
          +.ifdef X86
          +        library [--.lib]freetype_cxx.olb $(OBJSCXX)
          +        library [--.lib]freetype_cxx.olb $(OBJS64)
          +.endif
           
           # EOF
           $ eod
          @@ -1199,22 +1694,43 @@ $ deck
           
           
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.truetype])
          +.ifdef X86
          +CXXFLAGS=$(CXXCOMP_FLAGS)$(DEBUG)/list/show=all/include=([],[--.include],[--.src.base])
          +.endif
           
          +.ifdef X86
           .c.obj :
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c
           	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
          -	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_64_cxx.obj $(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
          +.else
          +.c.obj :
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
          +	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
          +	delete $(MMS$TARGET_NAME)_64.c;*
          +.endif
           
           OBJS=truetype.obj
           
           OBJS64=truetype_64.obj
           
          +OBJSCXX=truetype_cxx.obj
          +
           all : $(OBJS)
                   library [--.lib]freetype.olb $(OBJS)
                   library [--.lib]freetype.olb $(OBJS64)
          +.ifdef X86
          +        library [--.lib]freetype_cxx.olb $(OBJSCXX)
          +        library [--.lib]freetype_cxx.olb $(OBJS64)
          +.endif
           
           # EOF
           $ eod
          @@ -1240,22 +1756,43 @@ $ deck
           
           
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.type1])
          +.ifdef X86
          +CXXFLAGS=$(CXXCOMP_FLAGS)$(DEBUG)/list/show=all/include=([],[--.include],[--.src.base])
          +.endif
           
          +.ifdef X86
           .c.obj :
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c
           	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
          -	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_64_cxx.obj $(MMS$TARGET_NAME)_64.c
          +	delete $(MMS$TARGET_NAME)_64.c;*
          +.else
          +.c.obj :
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
          +	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
          +.endif
           
           OBJS=type1.obj
           
           OBJS64=type1_64.obj
           
          +OBJSCXX=type1_cxx.obj
          +
           all : $(OBJS)
                   library [--.lib]freetype.olb $(OBJS)
                   library [--.lib]freetype.olb $(OBJS64)
          +.ifdef X86
          +        library [--.lib]freetype_cxx.olb $(OBJSCXX)
          +        library [--.lib]freetype_cxx.olb $(OBJS64)
          +.endif
           
           type1.obj : type1.c t1parse.c t1load.c t1objs.c t1driver.c t1gload.c t1afm.c
           
          @@ -1283,22 +1820,43 @@ $ deck
           
           
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.type1])
          +.ifdef X86
          +CXXFLAGS=$(CXXCOMP_FLAGS)$(DEBUG)/list/show=all/include=([],[--.include],[--.src.base])
          +.endif
           
          +.ifdef X86
           .c.obj :
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c
           	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
          -	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
          +	cc$(CFLAGS)/warn=noinfo/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_64_cxx.obj $(MMS$TARGET_NAME)_64.c
          +	delete $(MMS$TARGET_NAME)_64.c;*
          +.else
          +.c.obj :
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
          +	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
          +.endif
           
           OBJS=sdf.obj
           
           OBJS64=sdf_64.obj
           
          +OBJSCXX=sdf_cxx.obj
          +
           all : $(OBJS)
                   library [--.lib]freetype.olb $(OBJS)
                   library [--.lib]freetype.olb $(OBJS64)
          +.ifdef X86
          +        library [--.lib]freetype_cxx.olb $(OBJSCXX)
          +        library [--.lib]freetype_cxx.olb $(OBJS64)
          +.endif
           
           sdf.obj : sdf.c ftbsdf.c ftsdf.c ftsdfcommon.c ftsdfrend.c
           
          @@ -1326,22 +1884,43 @@ $ deck
           
           
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.type42])
          +.ifdef X86
          +CXXFLAGS=$(CXXCOMP_FLAGS)$(DEBUG)/list/show=all/include=([],[--.include],[--.src.base])
          +.endif
           
          +.ifdef X86
           .c.obj :
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c
           	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
          -	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_64_cxx.obj $(MMS$TARGET_NAME)_64.c
          +	delete $(MMS$TARGET_NAME)_64.c;*
          +.else
          +.c.obj :
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
          +	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
          +.endif
           
           OBJS=type42.obj
           
           OBJS64=type42_64.obj
           
          +OBJSCXX=type42_cxx.obj
          +
           all : $(OBJS)
                   library [--.lib]freetype.olb $(OBJS)
                   library [--.lib]freetype.olb $(OBJS64)
          +.ifdef X86
          +        library [--.lib]freetype_cxx.olb $(OBJSCXX)
          +        library [--.lib]freetype_cxx.olb $(OBJS64)
          +.endif
           
           # EOF
           $ eod
          @@ -1367,22 +1946,43 @@ $ deck
           
           
           CFLAGS=$(COMP_FLAGS)$(DEBUG)/include=([--.include],[--.src.winfonts])
          +.ifdef X86
          +CXXFLAGS=$(CXXCOMP_FLAGS)$(DEBUG)/list/show=all/include=([],[--.include],[--.src.base])
          +.endif
           
          +.ifdef X86
           .c.obj :
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_cxx.obj $(MMS$TARGET_NAME).c
           	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
           	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
           	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          -	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64\
          -	/obj=$(MMS$TARGET_NAME)_64.obj $(MMS$TARGET_NAME)_64.c
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
          +	cxx$(CXXFLAGS)/warn=noinfo/obj=$(MMS$TARGET_NAME)_64_cxx.obj $(MMS$TARGET_NAME)_64.c
          +	delete $(MMS$TARGET_NAME)_64.c;*
          +.else
          +.c.obj :
          +	cc$(CFLAGS)/warn=noinfo/point=32/list/show=all $(MMS$TARGET_NAME).c
          +	pipe link/map/full/exec=nl: $(MMS$TARGET_NAME).obj | copy sys$input nl:
          +	mc sys$library:vms_auto64 $(MMS$TARGET_NAME).map
          +	cc$(CFLAGS)/warn=(noinfo,disable=(MAYLOSEDATA3))/point=64/obj=$(MMS$TARGET_NAME)_64.obj\
          +	$(MMS$TARGET_NAME)_64.c
           	delete $(MMS$TARGET_NAME)_64.c;*
          +.endif
           
           OBJS=winfnt.obj
           
           OBJS64=winfnt_64.obj
           
          +OBJSCXX=winfnt_cxx.obj
          +
           all : $(OBJS)
                   library [--.lib]freetype.olb $(OBJS)
                   library [--.lib]freetype.olb $(OBJS64)
          +.ifdef X86
          +        library [--.lib]freetype_cxx.olb $(OBJSCXX)
          +        library [--.lib]freetype_cxx.olb $(OBJS64)
          +.endif
           
           # EOF
           $ eod
          @@ -1401,6 +2001,7 @@ $   cparm = f$edit(p'i',"upcase")
           $   if cparm .eqs. "DEBUG"
           $   then
           $     ccopt = ccopt + "/noopt/deb"
          +$     if x86_64 then cxxopt = cxxopt + "/noopt/deb"
           $     lopts = lopts + "/deb"
           $   endif
           $   if f$locate("CCOPT=",cparm) .lt. f$length(cparm)
          @@ -1408,6 +2009,7 @@ $   then
           $     start = f$locate("=",cparm) + 1
           $     len   = f$length(cparm) - start
           $     ccopt = ccopt + f$extract(start,len,cparm)
          +$     if x86_64 then cxxopt = cxxopt + f$extract(start,len,cparm)
           $   endif
           $   if cparm .eqs. "LINK" then linkonly = true
           $   if f$locate("LOPTS=",cparm) .lt. f$length(cparm)
          -- 
          cgit v1.2.3
          
          
          From 5b7e45ac3488a688d08a57d0db5db907e032c6d4 Mon Sep 17 00:00:00 2001
          From: Alexei Podtelezhnikov 
          Date: Thu, 27 Jul 2023 15:06:38 +0000
          Subject: [truetype] Remove Infinality for good.
          
          Remove everything `#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY`,
          which was undefined for a while now.
          
          * include/freetype/internal/tttypes.h: Ditto.
          * src/truetype/truetype.c: Ditto.
          * src/truetype/ttdriver.c: Ditto.
          * src/truetype/ttgload.c: Ditto.
          * src/truetype/ttinterp.c: Ditto.
          * src/truetype/ttinterp.h: Ditto.
          * src/truetype/ttobjs.c: Ditto.
          * src/truetype/ttsubpix.[ch]: Remove files.
          * src/truetype/rules.mk: Don't mention "ttsubpix.c".
          ---
           include/freetype/internal/tttypes.h |    7 -
           src/truetype/rules.mk               |    3 +-
           src/truetype/truetype.c             |    1 -
           src/truetype/ttdriver.c             |    5 -
           src/truetype/ttgload.c              |  218 +-------
           src/truetype/ttinterp.c             |  832 +---------------------------
           src/truetype/ttinterp.h             |   74 ---
           src/truetype/ttobjs.c               |    3 -
           src/truetype/ttsubpix.c             | 1013 -----------------------------------
           src/truetype/ttsubpix.h             |  110 ----
           10 files changed, 23 insertions(+), 2243 deletions(-)
           delete mode 100644 src/truetype/ttsubpix.c
           delete mode 100644 src/truetype/ttsubpix.h
          
          diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h
          index 984121a0e..c821741f8 100644
          --- a/include/freetype/internal/tttypes.h
          +++ b/include/freetype/internal/tttypes.h
          @@ -1597,13 +1597,6 @@ FT_BEGIN_HEADER
               FT_ULong              horz_metrics_offset;
               FT_ULong              vert_metrics_offset;
           
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -    /* since 2.4.12 */
          -    FT_ULong              sph_found_func_flags; /* special functions found */
          -                                                /* for this face           */
          -    FT_Bool               sph_compatibility_mode;
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
          -
           #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
               /* since 2.7 */
               FT_ULong              ebdt_start;  /* either `CBDT', `EBDT', or `bdat' */
          diff --git a/src/truetype/rules.mk b/src/truetype/rules.mk
          index 23f6f006d..dde26de1c 100644
          --- a/src/truetype/rules.mk
          +++ b/src/truetype/rules.mk
          @@ -33,8 +33,7 @@ TT_DRV_SRC := $(TT_DIR)/ttdriver.c \
                         $(TT_DIR)/ttgxvar.c  \
                         $(TT_DIR)/ttinterp.c \
                         $(TT_DIR)/ttobjs.c   \
          -              $(TT_DIR)/ttpload.c  \
          -              $(TT_DIR)/ttsubpix.c
          +              $(TT_DIR)/ttpload.c
           
           # TrueType driver headers
           #
          diff --git a/src/truetype/truetype.c b/src/truetype/truetype.c
          index c5faa9627..fcc0ea334 100644
          --- a/src/truetype/truetype.c
          +++ b/src/truetype/truetype.c
          @@ -24,7 +24,6 @@
           #include "ttinterp.c"
           #include "ttobjs.c"     /* object manager      */
           #include "ttpload.c"    /* tables loader       */
          -#include "ttsubpix.c"
           
           
           /* END */
          diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c
          index 7151e8207..d1496fec7 100644
          --- a/src/truetype/ttdriver.c
          +++ b/src/truetype/ttdriver.c
          @@ -100,11 +100,6 @@
                   break;
           
                 case TT_INTERPRETER_VERSION_38:
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -        driver->interpreter_version = TT_INTERPRETER_VERSION_38;
          -      break;
          -#endif
          -
                 case TT_INTERPRETER_VERSION_40:
           #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
                   driver->interpreter_version = TT_INTERPRETER_VERSION_40;
          diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
          index d538e8ee8..5eedb5331 100644
          --- a/src/truetype/ttgload.c
          +++ b/src/truetype/ttgload.c
          @@ -35,7 +35,6 @@
           #endif
           
           #include "tterrors.h"
          -#include "ttsubpix.h"
           
           
             /**************************************************************************
          @@ -152,9 +151,6 @@
                             FT_UInt    glyph_index )
             {
               TT_Face    face   = loader->face;
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -    TT_Driver  driver = (TT_Driver)FT_FACE_DRIVER( face );
          -#endif
           
               FT_Error   error;
               FT_Stream  stream = loader->stream;
          @@ -183,20 +179,6 @@
               loader->top_bearing  = top_bearing;
               loader->vadvance     = advance_height;
           
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -    if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 &&
          -         loader->exec                                             )
          -    {
          -      loader->exec->sph_tweak_flags = 0;
          -
          -      /* 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 */
          -      /* backward compatibility mode on and off.                    */
          -      sph_set_tweaks( loader, glyph_index );
          -    }
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
          -
           #ifdef FT_CONFIG_OPTION_INCREMENTAL
               /* With the incremental interface, these values are set by  */
               /* a call to `tt_get_metrics_incremental'.                  */
          @@ -798,8 +780,7 @@
             TT_Hint_Glyph( TT_Loader  loader,
                            FT_Bool    is_composite )
             {
          -#if defined TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY || \
          -    defined TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
          +#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
               TT_Face    face   = loader->face;
               TT_Driver  driver = (TT_Driver)FT_FACE_DRIVER( face );
           #endif
          @@ -887,17 +868,6 @@
               }
           #endif
           
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -    if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 )
          -    {
          -      if ( exec->sph_tweak_flags & SPH_TWEAK_DEEMBOLDEN )
          -        FT_Outline_EmboldenXY( &loader->gloader->current.outline, -24, 0 );
          -
          -      else if ( exec->sph_tweak_flags & SPH_TWEAK_EMBOLDEN )
          -        FT_Outline_EmboldenXY( &loader->gloader->current.outline, 24, 0 );
          -    }
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
          -
               return FT_Err_Ok;
             }
           
          @@ -960,16 +930,6 @@
               }
           
               {
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -      TT_Face    face   = loader->face;
          -      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_String*  style          = face->root.style_name;
          -      FT_UInt     x_scale_factor = 1000;
          -#endif
          -
                 FT_Vector*  vec   = outline->points;
                 FT_Vector*  limit = outline->points + n_points;
           
          @@ -979,52 +939,6 @@
                 FT_Bool  do_scale = FALSE;
           
           
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -
          -      if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 )
          -      {
          -        /* scale, but only if enabled and only if TT hinting is being used */
          -        if ( IS_HINTED( loader->load_flags ) )
          -          x_scale_factor = sph_test_tweak_x_scaling( face,
          -                                                     family,
          -                                                     ppem,
          -                                                     style,
          -                                                     loader->glyph_index );
          -        /* scale the glyph */
          -        if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 ||
          -             x_scale_factor != 1000                         )
          -        {
          -          x_scale = FT_MulDiv( loader->size->metrics->x_scale,
          -                               (FT_Long)x_scale_factor, 1000 );
          -          y_scale = loader->size->metrics->y_scale;
          -
          -          /* compensate for any scaling by de/emboldening; */
          -          /* the amount was determined via experimentation */
          -          if ( x_scale_factor != 1000 && ppem > 11 )
          -          {
          -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
          -            FT_Vector*  orig_points = outline->points;
          -
          -
          -            if ( !IS_DEFAULT_INSTANCE( FT_FACE( loader->face ) ) )
          -              outline->points = unrounded;
          -#endif
          -            FT_Outline_EmboldenXY( outline,
          -                                   FT_MulFix( 1280 * ppem,
          -                                              1000 - x_scale_factor ),
          -                                   0 );
          -#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
          -            if ( !IS_DEFAULT_INSTANCE( FT_FACE( loader->face ) ) )
          -              outline->points = orig_points;
          -#endif
          -          }
          -          do_scale = TRUE;
          -        }
          -      }
          -      else
          -
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
          -
                 {
                   /* scale the glyph */
                   if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 )
          @@ -1460,15 +1374,6 @@
           #endif
           
           
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -    if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 )
          -    {
          -      subpixel_hinting = loader->exec ? loader->exec->subpixel_hinting
          -                                      : 0;
          -      grayscale        = loader->exec ? loader->exec->grayscale
          -                                      : 0;
          -    }
          -#endif
           #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
               if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 )
               {
          @@ -2277,8 +2182,7 @@
           #ifdef TT_USE_BYTECODE_INTERPRETER
               FT_Error   error;
               FT_Bool    pedantic = FT_BOOL( load_flags & FT_LOAD_PEDANTIC );
          -#if defined TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY || \
          -    defined TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
          +#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
               TT_Driver  driver   = (TT_Driver)FT_FACE_DRIVER( glyph->face );
           #endif
           #endif
          @@ -2298,20 +2202,6 @@
                 FT_Bool         grayscale_cleartype;
           #endif
           
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -      FT_Bool  subpixel_hinting = FALSE;
          -
          -#if 0
          -      /* not used yet */
          -      FT_Bool  compatible_widths;
          -      FT_Bool  symmetrical_smoothing;
          -      FT_Bool  bgr;
          -      FT_Bool  vertical_lcd;
          -      FT_Bool  subpixel_positioned;
          -      FT_Bool  gray_cleartype;
          -#endif
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
          -
                 FT_Bool  reexecute = FALSE;
           
           
          @@ -2356,65 +2246,6 @@
                 }
           #endif
           
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -
          -      if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 )
          -      {
          -        subpixel_hinting = FT_BOOL( ( FT_LOAD_TARGET_MODE( load_flags ) !=
          -                                      FT_RENDER_MODE_MONO               )  &&
          -                                    SPH_OPTION_SET_SUBPIXEL                );
          -
          -        if ( subpixel_hinting )
          -          grayscale = FALSE;
          -        else if ( SPH_OPTION_SET_GRAYSCALE )
          -        {
          -          grayscale        = TRUE;
          -          subpixel_hinting = FALSE;
          -        }
          -        else
          -          grayscale = FALSE;
          -
          -        if ( FT_IS_TRICKY( glyph->face ) )
          -          subpixel_hinting = FALSE;
          -
          -        exec->ignore_x_mode      = subpixel_hinting || grayscale;
          -        exec->rasterizer_version = SPH_OPTION_SET_RASTERIZER_VERSION;
          -        if ( exec->sph_tweak_flags & SPH_TWEAK_RASTERIZER_35 )
          -          exec->rasterizer_version = TT_INTERPRETER_VERSION_35;
          -
          -#if 1
          -        exec->compatible_widths     = SPH_OPTION_SET_COMPATIBLE_WIDTHS;
          -        exec->symmetrical_smoothing = TRUE;
          -        exec->bgr                   = FALSE;
          -        exec->vertical_lcd          = FALSE;
          -        exec->subpixel_positioned   = TRUE;
          -        exec->gray_cleartype        = FALSE;
          -#else /* 0 */
          -        exec->compatible_widths =
          -          FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
          -                   TT_LOAD_COMPATIBLE_WIDTHS );
          -        exec->symmetrical_smoothing =
          -          FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
          -                   TT_LOAD_SYMMETRICAL_SMOOTHING );
          -        exec->bgr =
          -          FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
          -                   TT_LOAD_BGR );
          -        exec->vertical_lcd =
          -          FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
          -                   TT_LOAD_VERTICAL_LCD );
          -        exec->subpixel_positioned =
          -          FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
          -                   TT_LOAD_SUBPIXEL_POSITIONED );
          -        exec->gray_cleartype =
          -          FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
          -                   TT_LOAD_GRAY_CLEARTYPE );
          -#endif /* 0 */
          -
          -      }
          -      else
          -
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
          -
           #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
                 if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 )
                   grayscale = FT_BOOL( !subpixel_hinting_lean               &&
          @@ -2429,36 +2260,6 @@
                 if ( error )
                   return error;
           
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -
          -      if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 )
          -      {
          -        /* a change from mono to subpixel rendering (and vice versa) */
          -        /* requires a re-execution of the CVT program                */
          -        if ( subpixel_hinting != exec->subpixel_hinting )
          -        {
          -          FT_TRACE4(( "tt_loader_init: subpixel hinting change,"
          -                      " re-executing `prep' table\n" ));
          -
          -          exec->subpixel_hinting = subpixel_hinting;
          -          reexecute              = TRUE;
          -        }
          -
          -        /* a change from mono to grayscale rendering (and vice versa) */
          -        /* requires a re-execution of the CVT program                 */
          -        if ( grayscale != exec->grayscale )
          -        {
          -          FT_TRACE4(( "tt_loader_init: grayscale hinting change,"
          -                      " re-executing `prep' table\n" ));
          -
          -          exec->grayscale = grayscale;
          -          reexecute       = TRUE;
          -        }
          -      }
          -      else
          -
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
          -
                 {
           
           #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
          @@ -2518,14 +2319,6 @@
                 if ( exec->GS.instruct_control & 2 )
                   exec->GS = tt_default_graphics_state;
           
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -      /* check whether we have a font hinted for ClearType --           */
          -      /* note that this flag can also be modified in a glyph's bytecode */
          -      if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 &&
          -           exec->GS.instruct_control & 4                            )
          -        exec->ignore_x_mode = FALSE;
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
          -
           #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
                 /*
                  * Toggle backward compatibility according to what font wants, except
          @@ -2561,13 +2354,6 @@
           #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
                      !( driver->interpreter_version == TT_INTERPRETER_VERSION_40  &&
                         exec->backward_compatibility                              ) &&
          -#endif
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -           !( driver->interpreter_version == TT_INTERPRETER_VERSION_38  &&
          -              !SPH_OPTION_BITMAP_WIDTHS                                 &&
          -              FT_LOAD_TARGET_MODE( loader->load_flags ) !=
          -                                                   FT_RENDER_MODE_MONO  &&
          -              exec->compatible_widths                                   ) &&
           #endif
                      !face->postscript.isFixedPitch                                 )
                 {
          diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
          index 34c3e6c92..93e89691d 100644
          --- a/src/truetype/ttinterp.c
          +++ b/src/truetype/ttinterp.c
          @@ -29,7 +29,6 @@
           
           #include "ttinterp.h"
           #include "tterrors.h"
          -#include "ttsubpix.h"
           #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
           #include "ttgxvar.h"
           #endif
          @@ -52,12 +51,6 @@
                     ( ((TT_Driver)FT_FACE_DRIVER( exc->face ))->interpreter_version == \
                       TT_INTERPRETER_VERSION_35 )
           
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -#define SUBPIXEL_HINTING_INFINALITY                                          \
          -          ( ((TT_Driver)FT_FACE_DRIVER( exc->face ))->interpreter_version == \
          -            TT_INTERPRETER_VERSION_38 )
          -#endif
          -
           #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
           #define SUBPIXEL_HINTING_MINIMAL                                             \
                     ( ((TT_Driver)FT_FACE_DRIVER( exc->face ))->interpreter_version == \
          @@ -1685,17 +1678,6 @@
           
               if ( v != 0 )
               {
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -      if ( SUBPIXEL_HINTING_INFINALITY                            &&
          -           ( !exc->ignore_x_mode                                ||
          -             ( exc->sph_tweak_flags & SPH_TWEAK_ALLOW_X_DMOVE ) ) )
          -        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 */
          -
           #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
                 /* Exception to the post-IUP curfew: Allow the x component of */
                 /* diagonal moves, but only post-IUP.  DejaVu tries to adjust */
          @@ -1801,12 +1783,6 @@
                            FT_UShort       point,
                            FT_F26Dot6      distance )
             {
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -    if ( SUBPIXEL_HINTING_INFINALITY && !exc->ignore_x_mode )
          -      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 = ADD_LONG( zone->cur[point].x, distance );
          @@ -3010,28 +2986,7 @@
                   args[0] = 0;
               }
               else
          -    {
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -      /* subpixel hinting - avoid Typeman Dstroke and */
          -      /* IStroke and Vacuform rounds                  */
          -      if ( SUBPIXEL_HINTING_INFINALITY                 &&
          -           exc->ignore_x_mode                          &&
          -           ( ( I == 24                             &&
          -               ( exc->face->sph_found_func_flags &
          -                 ( SPH_FDEF_SPACING_1 |
          -                   SPH_FDEF_SPACING_2 )          ) ) ||
          -             ( I == 22                      &&
          -               ( exc->sph_in_func_flags   &
          -                 SPH_FDEF_TYPEMAN_STROKES ) )        ||
          -             ( I == 8                              &&
          -               ( exc->face->sph_found_func_flags &
          -                 SPH_FDEF_VACUFORM_ROUND_1       ) &&
          -               exc->iup_called                     ) ) )
          -        args[0] = 0;
          -      else
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
          -        args[0] = exc->storage[I];
          -    }
          +      args[0] = exc->storage[I];
             }
           
           
          @@ -3545,107 +3500,6 @@
               TT_DefRecord*  rec;
               TT_DefRecord*  limit;
           
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -    /* arguments to opcodes are skipped by `SKIP_Code' */
          -    FT_Byte    opcode_pattern[9][12] =
          -               {
          -                 /* #0 inline delta function 1 */
          -                 {
          -                   0x4B, /* PPEM    */
          -                   0x53, /* GTEQ    */
          -                   0x23, /* SWAP    */
          -                   0x4B, /* PPEM    */
          -                   0x51, /* LTEQ    */
          -                   0x5A, /* AND     */
          -                   0x58, /* IF      */
          -                   0x38, /*   SHPIX */
          -                   0x1B, /* ELSE    */
          -                   0x21, /*   POP   */
          -                   0x21, /*   POP   */
          -                   0x59  /* EIF     */
          -                 },
          -                 /* #1 inline delta function 2 */
          -                 {
          -                   0x4B, /* PPEM    */
          -                   0x54, /* EQ      */
          -                   0x58, /* IF      */
          -                   0x38, /*   SHPIX */
          -                   0x1B, /* ELSE    */
          -                   0x21, /*   POP   */
          -                   0x21, /*   POP   */
          -                   0x59  /* EIF     */
          -                 },
          -                 /* #2 diagonal stroke function */
          -                 {
          -                   0x20, /* DUP     */
          -                   0x20, /* DUP     */
          -                   0xB0, /* PUSHB_1 */
          -                         /*   1     */
          -                   0x60, /* ADD     */
          -                   0x46, /* GC_cur  */
          -                   0xB0, /* PUSHB_1 */
          -                         /*   64    */
          -                   0x23, /* SWAP    */
          -                   0x42  /* WS      */
          -                 },
          -                 /* #3 VacuFormRound function */
          -                 {
          -                   0x45, /* RCVT    */
          -                   0x23, /* SWAP    */
          -                   0x46, /* GC_cur  */
          -                   0x60, /* ADD     */
          -                   0x20, /* DUP     */
          -                   0xB0  /* PUSHB_1 */
          -                         /*   38    */
          -                 },
          -                 /* #4 TTFautohint bytecode (old) */
          -                 {
          -                   0x20, /* DUP     */
          -                   0x64, /* ABS     */
          -                   0xB0, /* PUSHB_1 */
          -                         /*   32    */
          -                   0x60, /* ADD     */
          -                   0x66, /* FLOOR   */
          -                   0x23, /* SWAP    */
          -                   0xB0  /* PUSHB_1 */
          -                 },
          -                 /* #5 spacing function 1 */
          -                 {
          -                   0x01, /* SVTCA_x */
          -                   0xB0, /* PUSHB_1 */
          -                         /*   24    */
          -                   0x43, /* RS      */
          -                   0x58  /* IF      */
          -                 },
          -                 /* #6 spacing function 2 */
          -                 {
          -                   0x01, /* SVTCA_x */
          -                   0x18, /* RTG     */
          -                   0xB0, /* PUSHB_1 */
          -                         /*   24    */
          -                   0x43, /* RS      */
          -                   0x58  /* IF      */
          -                 },
          -                 /* #7 TypeMan Talk DiagEndCtrl function */
          -                 {
          -                   0x01, /* SVTCA_x */
          -                   0x20, /* DUP     */
          -                   0xB0, /* PUSHB_1 */
          -                         /*   3     */
          -                   0x25, /* CINDEX  */
          -                 },
          -                 /* #8 TypeMan Talk Align */
          -                 {
          -                   0x06, /* SPVTL   */
          -                   0x7D, /* RDTG    */
          -                 },
          -               };
          -    FT_UShort  opcode_patterns   = 9;
          -    FT_UShort  opcode_pointer[9] = {  0, 0, 0, 0, 0, 0, 0, 0, 0 };
          -    FT_UShort  opcode_size[9]    = { 12, 8, 8, 6, 7, 4, 5, 4, 2 };
          -    FT_UShort  i;
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
          -
           
               /* FDEF is only allowed in `prep' or `fpgm' */
               if ( exc->iniRange == tt_coderange_glyph )
          @@ -3696,130 +3550,11 @@
               if ( n > exc->maxFunc )
                 exc->maxFunc = (FT_UInt16)n;
           
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -    /* We don't know for sure these are typeman functions, */
          -    /* however they are only active when RS 22 is called   */
          -    if ( n >= 64 && n <= 66 )
          -      rec->sph_fdef_flags |= SPH_FDEF_TYPEMAN_STROKES;
          -#endif
          -
               /* Now skip the whole function definition. */
               /* We don't allow nested IDEFS & FDEFs.    */
           
               while ( SkipCode( exc ) == SUCCESS )
               {
          -
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -
          -      if ( SUBPIXEL_HINTING_INFINALITY )
          -      {
          -        for ( i = 0; i < opcode_patterns; i++ )
          -        {
          -          if ( opcode_pointer[i] < opcode_size[i]                  &&
          -               exc->opcode == opcode_pattern[i][opcode_pointer[i]] )
          -          {
          -            opcode_pointer[i] += 1;
          -
          -            if ( opcode_pointer[i] == opcode_size[i] )
          -            {
          -              FT_TRACE6(( "sph: Function %d, opcode ptrn: %ld, %s %s\n",
          -                          i, n,
          -                          exc->face->root.family_name,
          -                          exc->face->root.style_name ));
          -
          -              switch ( i )
          -              {
          -              case 0:
          -                rec->sph_fdef_flags             |= SPH_FDEF_INLINE_DELTA_1;
          -                exc->face->sph_found_func_flags |= SPH_FDEF_INLINE_DELTA_1;
          -                break;
          -
          -              case 1:
          -                rec->sph_fdef_flags             |= SPH_FDEF_INLINE_DELTA_2;
          -                exc->face->sph_found_func_flags |= SPH_FDEF_INLINE_DELTA_2;
          -                break;
          -
          -              case 2:
          -                switch ( n )
          -                {
          -                  /* needs to be implemented still */
          -                case 58:
          -                  rec->sph_fdef_flags             |= SPH_FDEF_DIAGONAL_STROKE;
          -                  exc->face->sph_found_func_flags |= SPH_FDEF_DIAGONAL_STROKE;
          -                }
          -                break;
          -
          -              case 3:
          -                switch ( n )
          -                {
          -                case 0:
          -                  rec->sph_fdef_flags             |= SPH_FDEF_VACUFORM_ROUND_1;
          -                  exc->face->sph_found_func_flags |= SPH_FDEF_VACUFORM_ROUND_1;
          -                }
          -                break;
          -
          -              case 4:
          -                /* probably not necessary to detect anymore */
          -                rec->sph_fdef_flags             |= SPH_FDEF_TTFAUTOHINT_1;
          -                exc->face->sph_found_func_flags |= SPH_FDEF_TTFAUTOHINT_1;
          -                break;
          -
          -              case 5:
          -                switch ( n )
          -                {
          -                case 0:
          -                case 1:
          -                case 2:
          -                case 4:
          -                case 7:
          -                case 8:
          -                  rec->sph_fdef_flags             |= SPH_FDEF_SPACING_1;
          -                  exc->face->sph_found_func_flags |= SPH_FDEF_SPACING_1;
          -                }
          -                break;
          -
          -              case 6:
          -                switch ( n )
          -                {
          -                case 0:
          -                case 1:
          -                case 2:
          -                case 4:
          -                case 7:
          -                case 8:
          -                  rec->sph_fdef_flags             |= SPH_FDEF_SPACING_2;
          -                  exc->face->sph_found_func_flags |= SPH_FDEF_SPACING_2;
          -                }
          -                break;
          -
          -               case 7:
          -                 rec->sph_fdef_flags             |= SPH_FDEF_TYPEMAN_DIAGENDCTRL;
          -                 exc->face->sph_found_func_flags |= SPH_FDEF_TYPEMAN_DIAGENDCTRL;
          -                 break;
          -
          -               case 8:
          -#if 0
          -                 rec->sph_fdef_flags             |= SPH_FDEF_TYPEMAN_DIAGENDCTRL;
          -                 exc->face->sph_found_func_flags |= SPH_FDEF_TYPEMAN_DIAGENDCTRL;
          -#endif
          -                 break;
          -              }
          -              opcode_pointer[i] = 0;
          -            }
          -          }
          -
          -          else
          -            opcode_pointer[i] = 0;
          -        }
          -
          -        /* Set sph_compatibility_mode only when deltas are detected */
          -        exc->face->sph_compatibility_mode =
          -          ( ( exc->face->sph_found_func_flags & SPH_FDEF_INLINE_DELTA_1 ) |
          -            ( exc->face->sph_found_func_flags & SPH_FDEF_INLINE_DELTA_2 ) );
          -      }
          -
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
          -
                 switch ( exc->opcode )
                 {
                 case 0x89:    /* IDEF */
          @@ -3847,10 +3582,6 @@
               TT_CallRec*  pRec;
           
           
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -    exc->sph_in_func_flags = 0x0000;
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
          -
               if ( exc->callTop <= 0 )     /* We encountered an ENDF without a call */
               {
                 exc->error = FT_THROW( ENDF_In_Exec_Stream );
          @@ -3938,17 +3669,6 @@
               if ( !def->active )
                 goto Fail;
           
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -    if ( SUBPIXEL_HINTING_INFINALITY                                    &&
          -         exc->ignore_x_mode                                             &&
          -         ( ( exc->iup_called                                        &&
          -             ( exc->sph_tweak_flags & SPH_TWEAK_NO_CALL_AFTER_IUP ) ) ||
          -           ( def->sph_fdef_flags & SPH_FDEF_VACUFORM_ROUND_1 )        ) )
          -      goto Fail;
          -    else
          -      exc->sph_in_func_flags = def->sph_fdef_flags;
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
          -
               /* check the call stack */
               if ( exc->callTop >= exc->callSize )
               {
          @@ -4026,15 +3746,6 @@
               if ( !def->active )
                 goto Fail;
           
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -    if ( SUBPIXEL_HINTING_INFINALITY                         &&
          -         exc->ignore_x_mode                                  &&
          -         ( def->sph_fdef_flags & SPH_FDEF_VACUFORM_ROUND_1 ) )
          -      goto Fail;
          -    else
          -      exc->sph_in_func_flags = def->sph_fdef_flags;
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
          -
               /* check stack */
               if ( exc->callTop >= exc->callSize )
               {
          @@ -4940,14 +4651,6 @@
                 }
               }
           
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -    /* Disable Type 2 Vacuform Rounds - e.g. Arial Narrow */
          -    if ( SUBPIXEL_HINTING_INFINALITY         &&
          -         exc->ignore_x_mode                  &&
          -         ( D < 0 ? NEG_LONG( D ) : D ) == 64 )
          -      D += 1;
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
          -
               args[0] = D;
             }
           
          @@ -5209,13 +4912,6 @@
               /* except to change the subpixel flags temporarily */
               else if ( exc->iniRange == tt_coderange_glyph && K == 3 )
               {
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -      /* INSTCTRL modifying flag 3 also has an effect */
          -      /* outside of the CVT program                   */
          -      if ( SUBPIXEL_HINTING_INFINALITY )
          -        exc->ignore_x_mode = !FT_BOOL( L == 4 );
          -#endif
          -
           #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
                 /* Native ClearType fonts sign a waiver that turns off all backward  */
                 /* compatibility hacks and lets them program points to the grid like */
          @@ -5547,12 +5243,6 @@
                   }
                 }
                 else
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -      /* doesn't follow Cleartype spec but produces better result */
          -      if ( SUBPIXEL_HINTING_INFINALITY && exc->ignore_x_mode )
          -        Move_Zp2_Point( exc, point, 0, dy, TRUE );
          -      else
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
                   Move_Zp2_Point( exc, point, dx, dy, TRUE );
           
                 exc->GS.loop--;
          @@ -5713,76 +5403,6 @@
                   }
                 }
                 else
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -      if ( SUBPIXEL_HINTING_INFINALITY &&
          -           exc->ignore_x_mode          )
          -      {
          -        FT_Int  B1, B2;
          -
          -
          -        /*  If not using ignore_x_mode rendering, allow ZP2 move.        */
          -        /*  If inline deltas aren't allowed, skip ZP2 move.              */
          -        /*  If using ignore_x_mode rendering, allow ZP2 point move if:   */
          -        /*   - freedom vector is y and sph_compatibility_mode is off     */
          -        /*   - the glyph is composite and the move is in the Y direction */
          -        /*   - the glyph is specifically set to allow SHPIX moves        */
          -        /*   - the move is on a previously Y-touched point               */
          -
          -        /* save point for later comparison */
          -        B1 = exc->zp2.cur[point].y;
          -
          -        if ( exc->face->sph_compatibility_mode )
          -        {
          -          if ( exc->sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES )
          -            dy = FT_PIX_ROUND( B1 + dy ) - B1;
          -
          -          /* skip post-iup deltas */
          -          if ( exc->iup_called                                          &&
          -               ( ( exc->sph_in_func_flags & SPH_FDEF_INLINE_DELTA_1 ) ||
          -                 ( exc->sph_in_func_flags & SPH_FDEF_INLINE_DELTA_2 ) ) )
          -            goto Skip;
          -
          -          if ( !( exc->sph_tweak_flags & SPH_TWEAK_ALWAYS_SKIP_DELTAP ) &&
          -                ( ( exc->is_composite && exc->GS.freeVector.y != 0 ) ||
          -                  ( exc->zp2.tags[point] & FT_CURVE_TAG_TOUCH_Y )    ||
          -                  ( exc->sph_tweak_flags & SPH_TWEAK_DO_SHPIX )      )  )
          -            Move_Zp2_Point( exc, point, 0, dy, TRUE );
          -
          -          /* save new point */
          -          if ( exc->GS.freeVector.y != 0 )
          -          {
          -            B2 = exc->zp2.cur[point].y;
          -
          -            /* reverse any disallowed moves */
          -            if ( ( B1 & 63 ) == 0 &&
          -                 ( B2 & 63 ) != 0 &&
          -                 B1 != B2         )
          -              Move_Zp2_Point( exc, point, 0, NEG_LONG( dy ), TRUE );
          -          }
          -        }
          -        else if ( exc->GS.freeVector.y != 0 )
          -        {
          -          Move_Zp2_Point( exc, point, dx, dy, TRUE );
          -
          -          /* save new point */
          -          B2 = exc->zp2.cur[point].y;
          -
          -          /* reverse any disallowed moves */
          -          if ( ( exc->sph_tweak_flags & SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES ) &&
          -               ( B1 & 63 ) != 0                                           &&
          -               ( B2 & 63 ) != 0                                           &&
          -               B1 != B2                                                   )
          -            Move_Zp2_Point( exc,
          -                            point,
          -                            NEG_LONG( dx ),
          -                            NEG_LONG( dy ),
          -                            TRUE );
          -        }
          -        else if ( exc->sph_in_func_flags & SPH_FDEF_TYPEMAN_DIAGENDCTRL )
          -          Move_Zp2_Point( exc, point, dx, dy, TRUE );
          -      }
          -      else
          -#endif
           #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
                 if ( SUBPIXEL_HINTING_MINIMAL    &&
                      exc->backward_compatibility )
          @@ -5802,9 +5422,6 @@
           #endif
                   Move_Zp2_Point( exc, point, dx, dy, TRUE );
           
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -    Skip:
          -#endif
                 exc->GS.loop--;
               }
           
          @@ -5849,28 +5466,6 @@
           
               distance = PROJECT( exc->zp1.cur + point, exc->zp0.cur + exc->GS.rp0 );
           
          -#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_F26Dot6  control_value_cutin = exc->GS.control_value_cutin;
          -      FT_F26Dot6  delta;
          -
          -
          -      if ( !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
          -        control_value_cutin = 0;
          -
          -      delta = SUB_LONG( distance, args[1] );
          -      if ( delta < 0 )
          -        delta = NEG_LONG( delta );
          -
          -      if ( delta >= control_value_cutin )
          -        distance = args[1];
          -    }
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
          -
               exc->func_move( exc,
                               &exc->zp1,
                               point,
          @@ -5911,14 +5506,7 @@
               if ( ( exc->opcode & 1 ) != 0 )
               {
                 cur_dist = FAST_PROJECT( &exc->zp0.cur[point] );
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -      if ( SUBPIXEL_HINTING_INFINALITY &&
          -           exc->ignore_x_mode          &&
          -           exc->GS.freeVector.x != 0   )
          -        distance = SUB_LONG( Round_None( exc, cur_dist, 3 ), cur_dist );
          -      else
          -#endif
          -        distance = SUB_LONG( exc->func_round( exc, cur_dist, 3 ), cur_dist );
          +      distance = SUB_LONG( exc->func_round( exc, cur_dist, 3 ), cur_dist );
               }
               else
                 distance = 0;
          @@ -5981,27 +5569,12 @@
           
               if ( exc->GS.gep0 == 0 )   /* If in twilight zone */
               {
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -      /* Only adjust if not in sph_compatibility_mode or ignore_x_mode. */
          -      /* Determined via experimentation and may be incorrect...         */
          -      if ( !( SUBPIXEL_HINTING_INFINALITY           &&
          -              ( exc->ignore_x_mode                &&
          -                exc->face->sph_compatibility_mode ) ) )
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
          -        exc->zp0.org[point].x = TT_MulFix14( distance,
          +      exc->zp0.org[point].x = TT_MulFix14( distance,
                                                        exc->GS.freeVector.x );
                 exc->zp0.org[point].y = TT_MulFix14( distance,
                                                      exc->GS.freeVector.y );
                 exc->zp0.cur[point]   = exc->zp0.org[point];
               }
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -    if ( SUBPIXEL_HINTING_INFINALITY                    &&
          -         exc->ignore_x_mode                             &&
          -         ( exc->sph_tweak_flags & SPH_TWEAK_MIAP_HACK ) &&
          -         distance > 0                                   &&
          -         exc->GS.freeVector.y != 0                      )
          -      distance = 0;
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
           
               org_dist = FAST_PROJECT( &exc->zp0.cur[point] );
           
          @@ -6011,15 +5584,6 @@
                 FT_F26Dot6  delta;
           
           
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -      if ( SUBPIXEL_HINTING_INFINALITY                        &&
          -           exc->ignore_x_mode                                 &&
          -           exc->GS.freeVector.x != 0                          &&
          -           exc->GS.freeVector.y == 0                          &&
          -           !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
          -        control_value_cutin = 0;
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
          -
                 delta = SUB_LONG( distance, org_dist );
                 if ( delta < 0 )
                   delta = NEG_LONG( delta );
          @@ -6027,14 +5591,7 @@
                 if ( delta > control_value_cutin )
                   distance = org_dist;
           
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -      if ( SUBPIXEL_HINTING_INFINALITY &&
          -           exc->ignore_x_mode          &&
          -           exc->GS.freeVector.x != 0   )
          -        distance = Round_None( exc, distance, 3 );
          -      else
          -#endif
          -        distance = exc->func_round( exc, distance, 3 );
          +      distance = exc->func_round( exc, distance, 3 );
               }
           
               exc->func_move( exc, &exc->zp0, point, SUB_LONG( distance, org_dist ) );
          @@ -6127,14 +5684,7 @@
           
               if ( ( exc->opcode & 4 ) != 0 )
               {
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -      if ( SUBPIXEL_HINTING_INFINALITY &&
          -           exc->ignore_x_mode          &&
          -           exc->GS.freeVector.x != 0   )
          -        distance = Round_None( exc, org_dist, exc->opcode & 3 );
          -      else
          -#endif
          -        distance = exc->func_round( exc, org_dist, exc->opcode & 3 );
          +      distance = exc->func_round( exc, org_dist, exc->opcode & 3 );
               }
               else
                 distance = Round_None( exc, org_dist, exc->opcode & 3 );
          @@ -6146,14 +5696,6 @@
                 FT_F26Dot6  minimum_distance = exc->GS.minimum_distance;
           
           
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -      if ( SUBPIXEL_HINTING_INFINALITY                        &&
          -           exc->ignore_x_mode                                 &&
          -           exc->GS.freeVector.x != 0                          &&
          -           !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
          -        minimum_distance = 0;
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
          -
                 if ( org_dist >= 0 )
                 {
                   if ( distance < minimum_distance )
          @@ -6296,41 +5838,7 @@
                 distance = exc->func_round( exc, cvt_dist, exc->opcode & 3 );
               }
               else
          -    {
          -
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -      /* do cvt cut-in always in MIRP for sph */
          -      if ( SUBPIXEL_HINTING_INFINALITY  &&
          -           exc->ignore_x_mode           &&
          -           exc->GS.gep0 == exc->GS.gep1 )
          -      {
          -        FT_F26Dot6  control_value_cutin = exc->GS.control_value_cutin;
          -
          -
          -        if ( exc->GS.freeVector.x != 0                          &&
          -             !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
          -          control_value_cutin = 0;
          -
          -        if ( exc->GS.freeVector.y != 0                                 &&
          -             ( exc->sph_tweak_flags & SPH_TWEAK_TIMES_NEW_ROMAN_HACK ) )
          -        {
          -          if ( cur_dist < -64 )
          -            cvt_dist -= 16;
          -          else if ( cur_dist > 64 && cur_dist < 84 )
          -            cvt_dist += 32;
          -        }
          -
          -        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 */
          -
                 distance = Round_None( exc, cvt_dist, exc->opcode & 3 );
          -    }
           
               /* minimum distance test */
           
          @@ -6339,14 +5847,6 @@
                 FT_F26Dot6  minimum_distance    = exc->GS.minimum_distance;
           
           
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -      if ( SUBPIXEL_HINTING_INFINALITY                        &&
          -           exc->ignore_x_mode                                 &&
          -           exc->GS.freeVector.x != 0                          &&
          -           !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) )
          -        minimum_distance = 0;
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
          -
                 if ( org_dist >= 0 )
                 {
                   if ( distance < minimum_distance )
          @@ -6359,51 +5859,10 @@
                 }
               }
           
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -    if ( SUBPIXEL_HINTING_INFINALITY &&
          -         exc->ignore_x_mode          &&
          -         exc->GS.freeVector.y != 0   )
          -    {
          -      FT_Int   B1, B2;
          -
          -
          -      B1 = exc->zp1.cur[point].y;
          -
          -      /* Round moves if necessary */
          -      if ( exc->sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES )
          -        distance = FT_PIX_ROUND( B1 + distance - cur_dist ) - B1 + cur_dist;
          -
          -      if ( ( exc->opcode & 16 ) == 0                               &&
          -           ( exc->opcode & 8 ) == 0                                &&
          -           ( exc->sph_tweak_flags & SPH_TWEAK_COURIER_NEW_2_HACK ) )
          -        distance += 64;
          -
          -      exc->func_move( exc,
          -                      &exc->zp1,
          -                      point,
          -                      SUB_LONG( distance, cur_dist ) );
          -
          -      B2 = exc->zp1.cur[point].y;
          -
          -      /* Reverse move if necessary */
          -      if ( ( exc->face->sph_compatibility_mode &&
          -             ( B1 & 63 ) == 0                  &&
          -             ( B2 & 63 ) != 0                  )                          ||
          -           ( ( exc->sph_tweak_flags & SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES ) &&
          -             ( B1 & 63 ) != 0                                           &&
          -             ( B2 & 63 ) != 0                                           ) )
          -        exc->func_move( exc,
          -                        &exc->zp1,
          -                        point,
          -                        SUB_LONG( cur_dist, distance ) );
          -    }
          -    else
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
          -
          -      exc->func_move( exc,
          -                      &exc->zp1,
          -                      point,
          -                      SUB_LONG( distance, cur_dist ) );
          +    exc->func_move( exc,
          +                    &exc->zp1,
          +                    point,
          +                    SUB_LONG( distance, cur_dist ) );
           
             Fail:
               exc->GS.rp1 = exc->GS.rp0;
          @@ -6428,17 +5887,6 @@
               FT_F26Dot6  distance;
           
           
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -    if ( SUBPIXEL_HINTING_INFINALITY                               &&
          -         exc->ignore_x_mode                                        &&
          -         exc->iup_called                                           &&
          -         ( exc->sph_tweak_flags & SPH_TWEAK_NO_ALIGNRP_AFTER_IUP ) )
          -    {
          -      exc->error = FT_THROW( Invalid_Reference );
          -      goto Fail;
          -    }
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
          -
               if ( exc->top < exc->GS.loop                  ||
                    BOUNDS( exc->GS.rp0, exc->zp0.n_points ) )
               {
          @@ -6997,16 +6445,6 @@
               contour = 0;
               point   = 0;
           
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -    if ( SUBPIXEL_HINTING_INFINALITY &&
          -         exc->ignore_x_mode          )
          -    {
          -      exc->iup_called = TRUE;
          -      if ( exc->sph_tweak_flags & SPH_TWEAK_SKIP_IUP )
          -        return;
          -    }
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
          -
               do
               {
                 end_point   = exc->pts.contours[contour] - exc->pts.first_point;
          @@ -7079,14 +6517,6 @@
               FT_Long    B;
           
           
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -    if ( SUBPIXEL_HINTING_INFINALITY                              &&
          -         exc->ignore_x_mode                                       &&
          -         exc->iup_called                                          &&
          -         ( exc->sph_tweak_flags & SPH_TWEAK_NO_DELTAP_AFTER_IUP ) )
          -      goto Fail;
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
          -
               P    = (FT_ULong)exc->func_cur_ppem( exc );
               nump = (FT_ULong)args[0];   /* some points theoretically may occur more
                                              than once, thus UShort isn't enough */
          @@ -7139,87 +6569,21 @@
                       B++;
                     B *= 1L << ( 6 - exc->GS.delta_shift );
           
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
           
          -          if ( SUBPIXEL_HINTING_INFINALITY )
          +#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
          +          /* See `ttinterp.h' for details on backward compatibility */
          +          /* mode.                                                  */
          +          if ( SUBPIXEL_HINTING_MINIMAL    &&
          +               exc->backward_compatibility )
                     {
          -            /*
          -             * Allow delta move if
          -             *
          -             * - not using ignore_x_mode rendering,
          -             * - glyph is specifically set to allow it, or
          -             * - glyph is composite and freedom vector is not in subpixel
          -             *   direction.
          -             */
          -            if ( !exc->ignore_x_mode                                   ||
          -                 ( exc->sph_tweak_flags & SPH_TWEAK_ALWAYS_DO_DELTAP ) ||
          -                 ( exc->is_composite && exc->GS.freeVector.y != 0 )    )
          +            if ( !( exc->iupx_called && exc->iupy_called )              &&
          +                 ( ( exc->is_composite && exc->GS.freeVector.y != 0 ) ||
          +                   ( exc->zp0.tags[A] & FT_CURVE_TAG_TOUCH_Y )        ) )
                         exc->func_move( exc, &exc->zp0, A, B );
          -
          -            /* Otherwise, apply subpixel hinting and compatibility mode */
          -            /* rules, always skipping deltas in subpixel direction.     */
          -            else if ( exc->ignore_x_mode && exc->GS.freeVector.y != 0 )
          -            {
          -              FT_UShort  B1, B2;
          -
          -
          -              /* save the y value of the point now; compare after move */
          -              B1 = (FT_UShort)exc->zp0.cur[A].y;
          -
          -              /* Standard subpixel hinting: Allow y move for y-touched */
          -              /* points.  This messes up DejaVu ...                    */
          -              if ( !exc->face->sph_compatibility_mode          &&
          -                   ( exc->zp0.tags[A] & FT_CURVE_TAG_TOUCH_Y ) )
          -                exc->func_move( exc, &exc->zp0, A, B );
          -
          -              /* compatibility mode */
          -              else if ( exc->face->sph_compatibility_mode                        &&
          -                        !( exc->sph_tweak_flags & SPH_TWEAK_ALWAYS_SKIP_DELTAP ) )
          -              {
          -                if ( exc->sph_tweak_flags & SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES )
          -                  B = FT_PIX_ROUND( B1 + B ) - B1;
          -
          -                /* Allow delta move if using sph_compatibility_mode,   */
          -                /* IUP has not been called, and point is touched on Y. */
          -                if ( !exc->iup_called                            &&
          -                     ( exc->zp0.tags[A] & FT_CURVE_TAG_TOUCH_Y ) )
          -                  exc->func_move( exc, &exc->zp0, A, B );
          -              }
          -
          -              B2 = (FT_UShort)exc->zp0.cur[A].y;
          -
          -              /* Reverse this move if it results in a disallowed move */
          -              if ( exc->GS.freeVector.y != 0                          &&
          -                   ( ( exc->face->sph_compatibility_mode          &&
          -                       ( B1 & 63 ) == 0                           &&
          -                       ( B2 & 63 ) != 0                           ) ||
          -                     ( ( exc->sph_tweak_flags                   &
          -                         SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES_DELTAP ) &&
          -                       ( B1 & 63 ) != 0                           &&
          -                       ( B2 & 63 ) != 0                           ) ) )
          -                exc->func_move( exc, &exc->zp0, A, NEG_LONG( B ) );
          -            }
                     }
                     else
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
          -
          -          {
          -
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
          -            /* 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 ) ||
          -                     ( exc->zp0.tags[A] & FT_CURVE_TAG_TOUCH_Y )        ) )
          -                exc->func_move( exc, &exc->zp0, A, B );
          -            }
          -            else
           #endif
          -              exc->func_move( exc, &exc->zp0, A, B );
          -          }
          +            exc->func_move( exc, &exc->zp0, A, B );
                   }
                 }
                 else
          @@ -7333,31 +6697,8 @@
           
               K = 0;
           
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -    /*********************************
          -     * RASTERIZER VERSION
          -     * Selector Bit:  0
          -     * Return Bit(s): 0-7
          -     */
          -    if ( SUBPIXEL_HINTING_INFINALITY &&
          -         ( args[0] & 1 ) != 0        &&
          -         exc->subpixel_hinting       )
          -    {
          -      if ( exc->ignore_x_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",
          -                    exc->rasterizer_version ));
          -      }
          -      else
          -        K = TT_INTERPRETER_VERSION_38;
          -    }
          -    else
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
          -      if ( ( args[0] & 1 ) != 0 )
          -        K = driver->interpreter_version;
          +    if ( ( args[0] & 1 ) != 0 )
          +      K = driver->interpreter_version;
           
               /*********************************
                * GLYPH ROTATED
          @@ -7454,89 +6795,6 @@
               }
           #endif
           
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -
          -    if ( SUBPIXEL_HINTING_INFINALITY                          &&
          -         exc->rasterizer_version >= TT_INTERPRETER_VERSION_35 )
          -    {
          -
          -      if ( exc->rasterizer_version >= 37 )
          -      {
          -        /*********************************
          -         * HINTING FOR SUBPIXEL
          -         * Selector Bit:  6
          -         * Return Bit(s): 13
          -         */
          -        if ( ( args[0] & 64 ) != 0 && exc->subpixel_hinting )
          -          K |= 1 << 13;
          -
          -        /*********************************
          -         * COMPATIBLE WIDTHS ENABLED
          -         * Selector Bit:  7
          -         * Return Bit(s): 14
          -         *
          -         * Functionality still needs to be added
          -         */
          -        if ( ( args[0] & 128 ) != 0 && exc->compatible_widths )
          -          K |= 1 << 14;
          -
          -        /*********************************
          -         * VERTICAL LCD SUBPIXELS?
          -         * Selector Bit:  8
          -         * Return Bit(s): 15
          -         *
          -         * Functionality still needs to be added
          -         */
          -        if ( ( args[0] & 256 ) != 0 && exc->vertical_lcd )
          -          K |= 1 << 15;
          -
          -        /*********************************
          -         * HINTING FOR BGR?
          -         * Selector Bit:  9
          -         * Return Bit(s): 16
          -         *
          -         * Functionality still needs to be added
          -         */
          -        if ( ( args[0] & 512 ) != 0 && exc->bgr )
          -          K |= 1 << 16;
          -
          -        if ( exc->rasterizer_version >= 38 )
          -        {
          -          /*********************************
          -           * SUBPIXEL POSITIONED?
          -           * Selector Bit:  10
          -           * Return Bit(s): 17
          -           *
          -           * Functionality still needs to be added
          -           */
          -          if ( ( args[0] & 1024 ) != 0 && exc->subpixel_positioned )
          -            K |= 1 << 17;
          -
          -          /*********************************
          -           * SYMMETRICAL SMOOTHING
          -           * Selector Bit:  11
          -           * Return Bit(s): 18
          -           *
          -           * Functionality still needs to be added
          -           */
          -          if ( ( args[0] & 2048 ) != 0 && exc->symmetrical_smoothing )
          -            K |= 1 << 18;
          -
          -          /*********************************
          -           * GRAY CLEARTYPE
          -           * Selector Bit:  12
          -           * Return Bit(s): 19
          -           *
          -           * Functionality still needs to be added
          -           */
          -          if ( ( args[0] & 4096 ) != 0 && exc->gray_cleartype )
          -            K |= 1 << 19;
          -        }
          -      }
          -    }
          -
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
          -
               args[0] = K;
             }
           
          @@ -7679,20 +6937,6 @@
               FT_ULong   num_twilight_points;
               FT_UShort  i;
           
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -    FT_Byte    opcode_pattern[1][2] =
          -               {
          -                 /* #8 TypeMan Talk Align */
          -                 {
          -                   0x06, /* SPVTL   */
          -                   0x7D, /* RDTG    */
          -                 },
          -               };
          -    FT_UShort  opcode_patterns   = 1;
          -    FT_UShort  opcode_pointer[1] = { 0 };
          -    FT_UShort  opcode_size[1]    = { 1 };
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
          -
           
               /* We restrict the number of twilight points to a reasonable,     */
               /* heuristic value to avoid slow execution of malformed bytecode. */
          @@ -7770,9 +7014,6 @@
               Compute_Round( exc, (FT_Byte)exc->GS.round_state );
           
               /* These flags cancel execution of some opcodes after IUP is called */
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -    exc->iup_called  = FALSE;
          -#endif
           #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
               exc->iupx_called = FALSE;
               exc->iupy_called = FALSE;
          @@ -7862,39 +7103,6 @@
                 exc->step_ins = TRUE;
                 exc->error    = FT_Err_Ok;
           
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -
          -      if ( SUBPIXEL_HINTING_INFINALITY )
          -      {
          -        for ( i = 0; i < opcode_patterns; i++ )
          -        {
          -          if ( opcode_pointer[i] < opcode_size[i]                  &&
          -               exc->opcode == opcode_pattern[i][opcode_pointer[i]] )
          -          {
          -            opcode_pointer[i] += 1;
          -
          -            if ( opcode_pointer[i] == opcode_size[i] )
          -            {
          -              FT_TRACE6(( "sph: opcode ptrn: %d, %s %s\n",
          -                          i,
          -                          exc->face->root.family_name,
          -                          exc->face->root.style_name ));
          -
          -              switch ( i )
          -              {
          -              case 0:
          -                break;
          -              }
          -              opcode_pointer[i] = 0;
          -            }
          -          }
          -          else
          -            opcode_pointer[i] = 0;
          -        }
          -      }
          -
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
          -
                 {
                   FT_Long*  args   = exc->stack + exc->args;
                   FT_Byte   opcode = exc->opcode;
          diff --git a/src/truetype/ttinterp.h b/src/truetype/ttinterp.h
          index 48d493af8..e98e258fe 100644
          --- a/src/truetype/ttinterp.h
          +++ b/src/truetype/ttinterp.h
          @@ -98,48 +98,6 @@ FT_BEGIN_HEADER
             } TT_CallRec, *TT_CallStack;
           
           
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -
          -  /**************************************************************************
          -   *
          -   * These structures define rules used to tweak subpixel hinting for
          -   * various fonts.  "", 0, "", NULL value indicates to match any value.
          -   */
          -
          -#define SPH_MAX_NAME_SIZE      32
          -#define SPH_MAX_CLASS_MEMBERS  100
          -
          -  typedef struct  SPH_TweakRule_
          -  {
          -    const char      family[SPH_MAX_NAME_SIZE];
          -    const FT_UInt   ppem;
          -    const char      style[SPH_MAX_NAME_SIZE];
          -    const FT_ULong  glyph;
          -
          -  } SPH_TweakRule;
          -
          -
          -  typedef struct  SPH_ScaleRule_
          -  {
          -    const char      family[SPH_MAX_NAME_SIZE];
          -    const FT_UInt   ppem;
          -    const char      style[SPH_MAX_NAME_SIZE];
          -    const FT_ULong  glyph;
          -    const FT_ULong  scale;
          -
          -  } SPH_ScaleRule;
          -
          -
          -  typedef struct  SPH_Font_Class_
          -  {
          -    const char  name[SPH_MAX_NAME_SIZE];
          -    const char  member[SPH_MAX_CLASS_MEMBERS][SPH_MAX_NAME_SIZE];
          -
          -  } SPH_Font_Class;
          -
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
          -
          -
             /**************************************************************************
              *
              * The main structure for the interpreter which collects all necessary
          @@ -399,38 +357,6 @@ FT_BEGIN_HEADER
               FT_Bool            grayscale_cleartype;
           #endif /* TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL */
           
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -    TT_Round_Func      func_round_sphn;   /* subpixel rounding function */
          -
          -    FT_Bool            subpixel_hinting;  /* Using subpixel hinting?       */
          -    FT_Bool            ignore_x_mode;     /* Standard rendering mode for   */
          -                                          /* subpixel hinting.  On if gray */
          -                                          /* or subpixel hinting is on.    */
          -
          -    /* The following 6 aren't fully implemented but here for MS rasterizer */
          -    /* compatibility.                                                      */
          -    FT_Bool            compatible_widths;     /* compatible widths?        */
          -    FT_Bool            symmetrical_smoothing; /* symmetrical_smoothing?    */
          -    FT_Bool            bgr;                   /* bgr instead of rgb?       */
          -    FT_Bool            vertical_lcd;          /* long side of LCD subpixel */
          -                                              /* rectangles is horizontal  */
          -    FT_Bool            subpixel_positioned;   /* subpixel positioned       */
          -                                              /* (DirectWrite ClearType)?  */
          -    FT_Bool            gray_cleartype;        /* ClearType hinting but     */
          -                                              /* grayscale rendering       */
          -
          -    FT_Int             rasterizer_version;    /* MS rasterizer version     */
          -
          -    FT_Bool            iup_called;            /* IUP called for glyph?     */
          -
          -    FT_ULong           sph_tweak_flags;       /* flags to control          */
          -                                              /* hint tweaks               */
          -
          -    FT_ULong           sph_in_func_flags;     /* flags to indicate if in   */
          -                                              /* special functions         */
          -
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
          -
               /* We maintain two counters (in addition to the instruction counter) */
               /* that act as loop detectors for LOOPCALL and jump opcodes with     */
               /* negative arguments.                                               */
          diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c
          index 958fa54d4..5b56af711 100644
          --- a/src/truetype/ttobjs.c
          +++ b/src/truetype/ttobjs.c
          @@ -1481,9 +1481,6 @@
               TT_Driver  driver = (TT_Driver)ttdriver;
           
               driver->interpreter_version = TT_INTERPRETER_VERSION_35;
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -    driver->interpreter_version = TT_INTERPRETER_VERSION_38;
          -#endif
           #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
               driver->interpreter_version = TT_INTERPRETER_VERSION_40;
           #endif
          diff --git a/src/truetype/ttsubpix.c b/src/truetype/ttsubpix.c
          deleted file mode 100644
          index aed4a1a27..000000000
          --- a/src/truetype/ttsubpix.c
          +++ /dev/null
          @@ -1,1013 +0,0 @@
          -/****************************************************************************
          - *
          - * ttsubpix.c
          - *
          - *   TrueType Subpixel Hinting.
          - *
          - * Copyright (C) 2010-2023 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 
          -#include 
          -#include 
          -#include 
          -#include 
          -#include 
          -#include 
          -
          -#include "ttsubpix.h"
          -
          -
          -#if defined( TT_USE_BYTECODE_INTERPRETER )            && \
          -    defined( TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY )
          -
          -  /**************************************************************************
          -   *
          -   * These rules affect how the TT Interpreter does hinting, with the
          -   * goal of doing subpixel hinting by (in general) ignoring x moves.
          -   * Some of these rules are fixes that go above and beyond the
          -   * stated techniques in the MS whitepaper on Cleartype, due to
          -   * artifacts in many glyphs.  So, these rules make some glyphs render
          -   * better than they do in the MS rasterizer.
          -   *
          -   * "" string or 0 int/char indicates to apply to all glyphs.
          -   * "-" used as dummy placeholders, but any non-matching string works.
          -   *
          -   * Some of this could arguably be implemented in fontconfig, however:
          -   *
          -   * - Fontconfig can't set things on a glyph-by-glyph basis.
          -   * - The tweaks that happen here are very low-level, from an average
          -   *   user's point of view and are best implemented in the hinter.
          -   *
          -   * The goal is to make the subpixel hinting techniques as generalized
          -   * as possible across all fonts to prevent the need for extra rules such
          -   * as these.
          -   *
          -   * The rule structure is designed so that entirely new rules can easily
          -   * be added when a new compatibility feature is discovered.
          -   *
          -   * The rule structures could also use some enhancement to handle ranges.
          -   *
          -   *     ****************** WORK IN PROGRESS *******************
          -   */
          -
          -  /* These are `classes' of fonts that can be grouped together and used in */
          -  /* rules below.  A blank entry "" is required at the end of these!       */
          -#define FAMILY_CLASS_RULES_SIZE  7
          -
          -  static const SPH_Font_Class  FAMILY_CLASS_Rules
          -                               [FAMILY_CLASS_RULES_SIZE] =
          -  {
          -    { "MS Legacy Fonts",
          -      { "Aharoni",
          -        "Andale Mono",
          -        "Andalus",
          -        "Angsana New",
          -        "AngsanaUPC",
          -        "Arabic Transparent",
          -        "Arial Black",
          -        "Arial Narrow",
          -        "Arial Unicode MS",
          -        "Arial",
          -        "Batang",
          -        "Browallia New",
          -        "BrowalliaUPC",
          -        "Comic Sans MS",
          -        "Cordia New",
          -        "CordiaUPC",
          -        "Courier New",
          -        "DFKai-SB",
          -        "David Transparent",
          -        "David",
          -        "DilleniaUPC",
          -        "Estrangelo Edessa",
          -        "EucrosiaUPC",
          -        "FangSong_GB2312",
          -        "Fixed Miriam Transparent",
          -        "FrankRuehl",
          -        "Franklin Gothic Medium",
          -        "FreesiaUPC",
          -        "Garamond",
          -        "Gautami",
          -        "Georgia",
          -        "Gulim",
          -        "Impact",
          -        "IrisUPC",
          -        "JasmineUPC",
          -        "KaiTi_GB2312",
          -        "KodchiangUPC",
          -        "Latha",
          -        "Levenim MT",
          -        "LilyUPC",
          -        "Lucida Console",
          -        "Lucida Sans Unicode",
          -        "MS Gothic",
          -        "MS Mincho",
          -        "MV Boli",
          -        "Mangal",
          -        "Marlett",
          -        "Microsoft Sans Serif",
          -        "Mingliu",
          -        "Miriam Fixed",
          -        "Miriam Transparent",
          -        "Miriam",
          -        "Narkisim",
          -        "Palatino Linotype",
          -        "Raavi",
          -        "Rod Transparent",
          -        "Rod",
          -        "Shruti",
          -        "SimHei",
          -        "Simplified Arabic Fixed",
          -        "Simplified Arabic",
          -        "Simsun",
          -        "Sylfaen",
          -        "Symbol",
          -        "Tahoma",
          -        "Times New Roman",
          -        "Traditional Arabic",
          -        "Trebuchet MS",
          -        "Tunga",
          -        "Verdana",
          -        "Webdings",
          -        "Wingdings",
          -        "",
          -      },
          -    },
          -    { "Core MS Legacy Fonts",
          -      { "Arial Black",
          -        "Arial Narrow",
          -        "Arial Unicode MS",
          -        "Arial",
          -        "Comic Sans MS",
          -        "Courier New",
          -        "Garamond",
          -        "Georgia",
          -        "Impact",
          -        "Lucida Console",
          -        "Lucida Sans Unicode",
          -        "Microsoft Sans Serif",
          -        "Palatino Linotype",
          -        "Tahoma",
          -        "Times New Roman",
          -        "Trebuchet MS",
          -        "Verdana",
          -        "",
          -      },
          -    },
          -    { "Apple Legacy Fonts",
          -      { "Geneva",
          -        "Times",
          -        "Monaco",
          -        "Century",
          -        "Chalkboard",
          -        "Lobster",
          -        "Century Gothic",
          -        "Optima",
          -        "Lucida Grande",
          -        "Gill Sans",
          -        "Baskerville",
          -        "Helvetica",
          -        "Helvetica Neue",
          -        "",
          -      },
          -    },
          -    { "Legacy Sans Fonts",
          -      { "Andale Mono",
          -        "Arial Unicode MS",
          -        "Arial",
          -        "Century Gothic",
          -        "Comic Sans MS",
          -        "Franklin Gothic Medium",
          -        "Geneva",
          -        "Lucida Console",
          -        "Lucida Grande",
          -        "Lucida Sans Unicode",
          -        "Lucida Sans Typewriter",
          -        "Microsoft Sans Serif",
          -        "Monaco",
          -        "Tahoma",
          -        "Trebuchet MS",
          -        "Verdana",
          -        "",
          -      },
          -    },
          -
          -    { "Misc Legacy Fonts",
          -      { "Dark Courier", "", }, },
          -    { "Verdana Clones",
          -      { "DejaVu Sans",
          -        "Bitstream Vera Sans", "", }, },
          -    { "Verdana and Clones",
          -      { "DejaVu Sans",
          -        "Bitstream Vera Sans",
          -        "Verdana", "", }, },
          -  };
          -
          -
          -  /* Define this to force natural (i.e. not bitmap-compatible) widths.     */
          -  /* The default leans strongly towards natural widths except for a few    */
          -  /* legacy fonts where a selective combination produces nicer results.    */
          -/* #define FORCE_NATURAL_WIDTHS   */
          -
          -
          -  /* Define `classes' of styles that can be grouped together and used in   */
          -  /* rules below.  A blank entry "" is required at the end of these!       */
          -#define STYLE_CLASS_RULES_SIZE  5
          -
          -  static const SPH_Font_Class  STYLE_CLASS_Rules
          -                               [STYLE_CLASS_RULES_SIZE] =
          -  {
          -    { "Regular Class",
          -      { "Regular",
          -        "Book",
          -        "Medium",
          -        "Roman",
          -        "Normal",
          -        "",
          -      },
          -    },
          -    { "Regular/Italic Class",
          -      { "Regular",
          -        "Book",
          -        "Medium",
          -        "Italic",
          -        "Oblique",
          -        "Roman",
          -        "Normal",
          -        "",
          -      },
          -    },
          -    { "Bold/BoldItalic Class",
          -      { "Bold",
          -        "Bold Italic",
          -        "Black",
          -        "",
          -      },
          -    },
          -    { "Bold/Italic/BoldItalic Class",
          -      { "Bold",
          -        "Bold Italic",
          -        "Black",
          -        "Italic",
          -        "Oblique",
          -        "",
          -      },
          -    },
          -    { "Regular/Bold Class",
          -      { "Regular",
          -        "Book",
          -        "Medium",
          -        "Normal",
          -        "Roman",
          -        "Bold",
          -        "Black",
          -        "",
          -      },
          -    },
          -  };
          -
          -
          -  /* Force special legacy fixes for fonts.                                 */
          -#define COMPATIBILITY_MODE_RULES_SIZE  1
          -
          -  static const SPH_TweakRule  COMPATIBILITY_MODE_Rules
          -                              [COMPATIBILITY_MODE_RULES_SIZE] =
          -  {
          -    { "Verdana Clones", 0, "", 0 },
          -  };
          -
          -
          -  /* Don't do subpixel (ignore_x_mode) hinting; do normal hinting.         */
          -#define PIXEL_HINTING_RULES_SIZE  2
          -
          -  static const SPH_TweakRule  PIXEL_HINTING_Rules
          -                              [PIXEL_HINTING_RULES_SIZE] =
          -  {
          -    /* these characters are almost always safe */
          -    { "Courier New", 12, "Italic", 'z' },
          -    { "Courier New", 11, "Italic", 'z' },
          -  };
          -
          -
          -  /* Subpixel hinting ignores SHPIX rules on X.  Force SHPIX for these.    */
          -#define DO_SHPIX_RULES_SIZE  1
          -
          -  static const SPH_TweakRule  DO_SHPIX_Rules
          -                              [DO_SHPIX_RULES_SIZE] =
          -  {
          -    { "-", 0, "", 0 },
          -  };
          -
          -
          -  /* Skip Y moves that start with a point that is not on a Y pixel         */
          -  /* boundary and don't move that point to a Y pixel boundary.             */
          -#define SKIP_NONPIXEL_Y_MOVES_RULES_SIZE  4
          -
          -  static const SPH_TweakRule  SKIP_NONPIXEL_Y_MOVES_Rules
          -                              [SKIP_NONPIXEL_Y_MOVES_RULES_SIZE] =
          -  {
          -    /* fix vwxyz thinness */
          -    { "Consolas", 0, "", 0 },
          -    /* Fix thin middle stems */
          -    { "Core MS Legacy Fonts", 0, "Regular", 0 },
          -    /* Cyrillic small letter I */
          -    { "Legacy Sans Fonts", 0, "", 0 },
          -    /* Fix artifacts with some Regular & Bold */
          -    { "Verdana Clones", 0, "", 0 },
          -  };
          -
          -
          -#define SKIP_NONPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE  1
          -
          -  static const SPH_TweakRule  SKIP_NONPIXEL_Y_MOVES_Rules_Exceptions
          -                              [SKIP_NONPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE] =
          -  {
          -    /* Fixes < and > */
          -    { "Courier New", 0, "Regular", 0 },
          -  };
          -
          -
          -  /* Skip Y moves that start with a point that is not on a Y pixel         */
          -  /* boundary and don't move that point to a Y pixel boundary.             */
          -#define SKIP_NONPIXEL_Y_MOVES_DELTAP_RULES_SIZE  2
          -
          -  static const SPH_TweakRule  SKIP_NONPIXEL_Y_MOVES_DELTAP_Rules
          -                              [SKIP_NONPIXEL_Y_MOVES_DELTAP_RULES_SIZE] =
          -  {
          -    /* Maintain thickness of diagonal in 'N' */
          -    { "Times New Roman", 0, "Regular/Bold Class", 'N' },
          -    { "Georgia", 0, "Regular/Bold Class", 'N' },
          -  };
          -
          -
          -  /* Skip Y moves that move a point off a Y pixel boundary.                */
          -#define SKIP_OFFPIXEL_Y_MOVES_RULES_SIZE  1
          -
          -  static const SPH_TweakRule  SKIP_OFFPIXEL_Y_MOVES_Rules
          -                              [SKIP_OFFPIXEL_Y_MOVES_RULES_SIZE] =
          -  {
          -    { "-", 0, "", 0 },
          -  };
          -
          -
          -#define SKIP_OFFPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE  1
          -
          -  static const SPH_TweakRule  SKIP_OFFPIXEL_Y_MOVES_Rules_Exceptions
          -                              [SKIP_OFFPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE] =
          -  {
          -    { "-", 0, "", 0 },
          -  };
          -
          -
          -  /* Round moves that don't move a point to a Y pixel boundary.            */
          -#define ROUND_NONPIXEL_Y_MOVES_RULES_SIZE  2
          -
          -  static const SPH_TweakRule  ROUND_NONPIXEL_Y_MOVES_Rules
          -                              [ROUND_NONPIXEL_Y_MOVES_RULES_SIZE] =
          -  {
          -    /* Droid font instructions don't snap Y to pixels */
          -    { "Droid Sans", 0, "Regular/Italic Class", 0 },
          -    { "Droid Sans Mono", 0, "", 0 },
          -  };
          -
          -
          -#define ROUND_NONPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE  1
          -
          -  static const SPH_TweakRule  ROUND_NONPIXEL_Y_MOVES_Rules_Exceptions
          -                              [ROUND_NONPIXEL_Y_MOVES_RULES_EXCEPTIONS_SIZE] =
          -  {
          -    { "-", 0, "", 0 },
          -  };
          -
          -
          -  /* Allow a Direct_Move along X freedom vector if matched.                */
          -#define ALLOW_X_DMOVE_RULES_SIZE  1
          -
          -  static const SPH_TweakRule  ALLOW_X_DMOVE_Rules
          -                              [ALLOW_X_DMOVE_RULES_SIZE] =
          -  {
          -    /* Fixes vanishing diagonal in 4 */
          -    { "Verdana", 0, "Regular", '4' },
          -  };
          -
          -
          -  /* Return MS rasterizer version 35 if matched.                           */
          -#define RASTERIZER_35_RULES_SIZE  8
          -
          -  static const SPH_TweakRule  RASTERIZER_35_Rules
          -                              [RASTERIZER_35_RULES_SIZE] =
          -  {
          -    /* This seems to be the only way to make these look good */
          -    { "Times New Roman", 0, "Regular", 'i' },
          -    { "Times New Roman", 0, "Regular", 'j' },
          -    { "Times New Roman", 0, "Regular", 'm' },
          -    { "Times New Roman", 0, "Regular", 'r' },
          -    { "Times New Roman", 0, "Regular", 'a' },
          -    { "Times New Roman", 0, "Regular", 'n' },
          -    { "Times New Roman", 0, "Regular", 'p' },
          -    { "Times", 0, "", 0 },
          -  };
          -
          -
          -  /* Don't round to the subpixel grid.  Round to pixel grid.               */
          -#define NORMAL_ROUND_RULES_SIZE  1
          -
          -  static const SPH_TweakRule  NORMAL_ROUND_Rules
          -                              [NORMAL_ROUND_RULES_SIZE] =
          -  {
          -    /* Fix serif thickness for certain ppems */
          -    /* Can probably be generalized somehow   */
          -    { "Courier New", 0, "", 0 },
          -  };
          -
          -
          -  /* Skip IUP instructions if matched.                                     */
          -#define SKIP_IUP_RULES_SIZE  1
          -
          -  static const SPH_TweakRule  SKIP_IUP_Rules
          -                              [SKIP_IUP_RULES_SIZE] =
          -  {
          -    { "Arial", 13, "Regular", 'a' },
          -  };
          -
          -
          -  /* Skip MIAP Twilight hack if matched.                                   */
          -#define MIAP_HACK_RULES_SIZE  1
          -
          -  static const SPH_TweakRule  MIAP_HACK_Rules
          -                              [MIAP_HACK_RULES_SIZE] =
          -  {
          -    { "Geneva", 12, "", 0 },
          -  };
          -
          -
          -  /* Skip DELTAP instructions if matched.                                  */
          -#define ALWAYS_SKIP_DELTAP_RULES_SIZE  23
          -
          -  static const SPH_TweakRule  ALWAYS_SKIP_DELTAP_Rules
          -                              [ALWAYS_SKIP_DELTAP_RULES_SIZE] =
          -  {
          -    { "Georgia", 0, "Regular", 'k' },
          -    /* fix various problems with e in different versions */
          -    { "Trebuchet MS", 14, "Regular", 'e' },
          -    { "Trebuchet MS", 13, "Regular", 'e' },
          -    { "Trebuchet MS", 15, "Regular", 'e' },
          -    { "Trebuchet MS", 0, "Italic", 'v' },
          -    { "Trebuchet MS", 0, "Italic", 'w' },
          -    { "Trebuchet MS", 0, "Regular", 'Y' },
          -    { "Arial", 11, "Regular", 's' },
          -    /* prevent problems with '3' and others */
          -    { "Verdana", 10, "Regular", 0 },
          -    { "Verdana", 9, "Regular", 0 },
          -    /* Cyrillic small letter short I */
          -    { "Legacy Sans Fonts", 0, "", 0x438 },
          -    { "Legacy Sans Fonts", 0, "", 0x439 },
          -    { "Arial", 10, "Regular", '6' },
          -    { "Arial", 0, "Bold/BoldItalic Class", 'a' },
          -    /* Make horizontal stems consistent with the rest */
          -    { "Arial", 24, "Bold", 'a' },
          -    { "Arial", 25, "Bold", 'a' },
          -    { "Arial", 24, "Bold", 's' },
          -    { "Arial", 25, "Bold", 's' },
          -    { "Arial", 34, "Bold", 's' },
          -    { "Arial", 35, "Bold", 's' },
          -    { "Arial", 36, "Bold", 's' },
          -    { "Arial", 25, "Regular", 's' },
          -    { "Arial", 26, "Regular", 's' },
          -  };
          -
          -
          -  /* Always do DELTAP instructions if matched.                             */
          -#define ALWAYS_DO_DELTAP_RULES_SIZE  1
          -
          -  static const SPH_TweakRule  ALWAYS_DO_DELTAP_Rules
          -                              [ALWAYS_DO_DELTAP_RULES_SIZE] =
          -  {
          -    { "-", 0, "", 0 },
          -  };
          -
          -
          -  /* Don't allow ALIGNRP after IUP.                                        */
          -#define NO_ALIGNRP_AFTER_IUP_RULES_SIZE  1
          -
          -  static const SPH_TweakRule  NO_ALIGNRP_AFTER_IUP_Rules
          -                              [NO_ALIGNRP_AFTER_IUP_RULES_SIZE] =
          -  {
          -    /* Prevent creation of dents in outline */
          -    { "-", 0, "", 0 },
          -  };
          -
          -
          -  /* Don't allow DELTAP after IUP.                                         */
          -#define NO_DELTAP_AFTER_IUP_RULES_SIZE  1
          -
          -  static const SPH_TweakRule  NO_DELTAP_AFTER_IUP_Rules
          -                              [NO_DELTAP_AFTER_IUP_RULES_SIZE] =
          -  {
          -    { "-", 0, "", 0 },
          -  };
          -
          -
          -  /* Don't allow CALL after IUP.                                           */
          -#define NO_CALL_AFTER_IUP_RULES_SIZE  1
          -
          -  static const SPH_TweakRule  NO_CALL_AFTER_IUP_Rules
          -                              [NO_CALL_AFTER_IUP_RULES_SIZE] =
          -  {
          -    /* Prevent creation of dents in outline */
          -    { "-", 0, "", 0 },
          -  };
          -
          -
          -  /* De-embolden these glyphs slightly.                                    */
          -#define DEEMBOLDEN_RULES_SIZE  9
          -
          -  static const SPH_TweakRule  DEEMBOLDEN_Rules
          -                              [DEEMBOLDEN_RULES_SIZE] =
          -  {
          -    { "Courier New", 0, "Bold", 'A' },
          -    { "Courier New", 0, "Bold", 'W' },
          -    { "Courier New", 0, "Bold", 'w' },
          -    { "Courier New", 0, "Bold", 'M' },
          -    { "Courier New", 0, "Bold", 'X' },
          -    { "Courier New", 0, "Bold", 'K' },
          -    { "Courier New", 0, "Bold", 'x' },
          -    { "Courier New", 0, "Bold", 'z' },
          -    { "Courier New", 0, "Bold", 'v' },
          -  };
          -
          -
          -  /* Embolden these glyphs slightly.                                       */
          -#define EMBOLDEN_RULES_SIZE  2
          -
          -  static const SPH_TweakRule  EMBOLDEN_Rules
          -                              [EMBOLDEN_RULES_SIZE] =
          -  {
          -    { "Courier New", 0, "Regular", 0 },
          -    { "Courier New", 0, "Italic", 0 },
          -  };
          -
          -
          -  /* This is a CVT hack that makes thick horizontal stems on 2, 5, 7       */
          -  /* similar to Windows XP.                                                */
          -#define TIMES_NEW_ROMAN_HACK_RULES_SIZE  12
          -
          -  static const SPH_TweakRule  TIMES_NEW_ROMAN_HACK_Rules
          -                              [TIMES_NEW_ROMAN_HACK_RULES_SIZE] =
          -  {
          -    { "Times New Roman", 16, "Italic", '2' },
          -    { "Times New Roman", 16, "Italic", '5' },
          -    { "Times New Roman", 16, "Italic", '7' },
          -    { "Times New Roman", 16, "Regular", '2' },
          -    { "Times New Roman", 16, "Regular", '5' },
          -    { "Times New Roman", 16, "Regular", '7' },
          -    { "Times New Roman", 17, "Italic", '2' },
          -    { "Times New Roman", 17, "Italic", '5' },
          -    { "Times New Roman", 17, "Italic", '7' },
          -    { "Times New Roman", 17, "Regular", '2' },
          -    { "Times New Roman", 17, "Regular", '5' },
          -    { "Times New Roman", 17, "Regular", '7' },
          -  };
          -
          -
          -  /* This fudges distance on 2 to get rid of the vanishing stem issue.     */
          -  /* A real solution to this is certainly welcome.                         */
          -#define COURIER_NEW_2_HACK_RULES_SIZE  15
          -
          -  static const SPH_TweakRule  COURIER_NEW_2_HACK_Rules
          -                              [COURIER_NEW_2_HACK_RULES_SIZE] =
          -  {
          -    { "Courier New", 10, "Regular", '2' },
          -    { "Courier New", 11, "Regular", '2' },
          -    { "Courier New", 12, "Regular", '2' },
          -    { "Courier New", 13, "Regular", '2' },
          -    { "Courier New", 14, "Regular", '2' },
          -    { "Courier New", 15, "Regular", '2' },
          -    { "Courier New", 16, "Regular", '2' },
          -    { "Courier New", 17, "Regular", '2' },
          -    { "Courier New", 18, "Regular", '2' },
          -    { "Courier New", 19, "Regular", '2' },
          -    { "Courier New", 20, "Regular", '2' },
          -    { "Courier New", 21, "Regular", '2' },
          -    { "Courier New", 22, "Regular", '2' },
          -    { "Courier New", 23, "Regular", '2' },
          -    { "Courier New", 24, "Regular", '2' },
          -  };
          -
          -
          -#ifndef FORCE_NATURAL_WIDTHS
          -
          -  /* Use compatible widths with these glyphs.  Compatible widths is always */
          -  /* on when doing B/W TrueType instructing, but is used selectively here, */
          -  /* typically on glyphs with 3 or more vertical stems.                    */
          -#define COMPATIBLE_WIDTHS_RULES_SIZE  38
          -
          -  static const SPH_TweakRule  COMPATIBLE_WIDTHS_Rules
          -                              [COMPATIBLE_WIDTHS_RULES_SIZE] =
          -  {
          -    { "Arial Unicode MS", 12, "Regular Class", 'm' },
          -    { "Arial Unicode MS", 14, "Regular Class", 'm' },
          -    /* Cyrillic small letter sha */
          -    { "Arial", 10, "Regular Class", 0x448 },
          -    { "Arial", 11, "Regular Class", 'm' },
          -    { "Arial", 12, "Regular Class", 'm' },
          -    /* Cyrillic small letter sha */
          -    { "Arial", 12, "Regular Class", 0x448 },
          -    { "Arial", 13, "Regular Class", 0x448 },
          -    { "Arial", 14, "Regular Class", 'm' },
          -    /* Cyrillic small letter sha */
          -    { "Arial", 14, "Regular Class", 0x448 },
          -    { "Arial", 15, "Regular Class", 0x448 },
          -    { "Arial", 17, "Regular Class", 'm' },
          -    { "DejaVu Sans", 15, "Regular Class", 0 },
          -    { "Microsoft Sans Serif", 11, "Regular Class", 0 },
          -    { "Microsoft Sans Serif", 12, "Regular Class", 0 },
          -    { "Segoe UI", 11, "Regular Class", 0 },
          -    { "Monaco", 0, "Regular Class", 0 },
          -    { "Segoe UI", 12, "Regular Class", 'm' },
          -    { "Segoe UI", 14, "Regular Class", 'm' },
          -    { "Tahoma", 11, "Regular Class", 0 },
          -    { "Times New Roman", 16, "Regular Class", 'c' },
          -    { "Times New Roman", 16, "Regular Class", 'm' },
          -    { "Times New Roman", 16, "Regular Class", 'o' },
          -    { "Times New Roman", 16, "Regular Class", 'w' },
          -    { "Trebuchet MS", 11, "Regular Class", 0 },
          -    { "Trebuchet MS", 12, "Regular Class", 0 },
          -    { "Trebuchet MS", 14, "Regular Class", 0 },
          -    { "Trebuchet MS", 15, "Regular Class", 0 },
          -    { "Ubuntu", 12, "Regular Class", 'm' },
          -    /* Cyrillic small letter sha */
          -    { "Verdana", 10, "Regular Class", 0x448 },
          -    { "Verdana", 11, "Regular Class", 0x448 },
          -    { "Verdana and Clones", 12, "Regular Class", 'i' },
          -    { "Verdana and Clones", 12, "Regular Class", 'j' },
          -    { "Verdana and Clones", 12, "Regular Class", 'l' },
          -    { "Verdana and Clones", 12, "Regular Class", 'm' },
          -    { "Verdana and Clones", 13, "Regular Class", 'i' },
          -    { "Verdana and Clones", 13, "Regular Class", 'j' },
          -    { "Verdana and Clones", 13, "Regular Class", 'l' },
          -    { "Verdana and Clones", 14, "Regular Class", 'm' },
          -  };
          -
          -
          -  /* Scaling slightly in the x-direction prior to hinting results in       */
          -  /* more visually pleasing glyphs in certain cases.                       */
          -  /* This sometimes needs to be coordinated with compatible width rules.   */
          -  /* A value of 1000 corresponds to a scaled value of 1.0.                 */
          -
          -#define X_SCALING_RULES_SIZE  50
          -
          -  static const SPH_ScaleRule  X_SCALING_Rules[X_SCALING_RULES_SIZE] =
          -  {
          -    { "DejaVu Sans", 12, "Regular Class", 'm', 950 },
          -    { "Verdana and Clones", 12, "Regular Class", 'a', 1100 },
          -    { "Verdana and Clones", 13, "Regular Class", 'a', 1050 },
          -    { "Arial", 11, "Regular Class", 'm', 975 },
          -    { "Arial", 12, "Regular Class", 'm', 1050 },
          -    /* Cyrillic small letter el */
          -    { "Arial", 13, "Regular Class", 0x43B, 950 },
          -    { "Arial", 13, "Regular Class", 'o', 950 },
          -    { "Arial", 13, "Regular Class", 'e', 950 },
          -    { "Arial", 14, "Regular Class", 'm', 950 },
          -    /* Cyrillic small letter el */
          -    { "Arial", 15, "Regular Class", 0x43B, 925 },
          -    { "Bitstream Vera Sans", 10, "Regular/Italic Class", 0, 1100 },
          -    { "Bitstream Vera Sans", 12, "Regular/Italic Class", 0, 1050 },
          -    { "Bitstream Vera Sans", 16, "Regular Class", 0, 1050 },
          -    { "Bitstream Vera Sans", 9, "Regular/Italic Class", 0, 1050 },
          -    { "DejaVu Sans", 12, "Regular Class", 'l', 975 },
          -    { "DejaVu Sans", 12, "Regular Class", 'i', 975 },
          -    { "DejaVu Sans", 12, "Regular Class", 'j', 975 },
          -    { "DejaVu Sans", 13, "Regular Class", 'l', 950 },
          -    { "DejaVu Sans", 13, "Regular Class", 'i', 950 },
          -    { "DejaVu Sans", 13, "Regular Class", 'j', 950 },
          -    { "DejaVu Sans", 10, "Regular/Italic Class", 0, 1100 },
          -    { "DejaVu Sans", 12, "Regular/Italic Class", 0, 1050 },
          -    { "Georgia", 10, "", 0, 1050 },
          -    { "Georgia", 11, "", 0, 1100 },
          -    { "Georgia", 12, "", 0, 1025 },
          -    { "Georgia", 13, "", 0, 1050 },
          -    { "Georgia", 16, "", 0, 1050 },
          -    { "Georgia", 17, "", 0, 1030 },
          -    { "Liberation Sans", 12, "Regular Class", 'm', 1100 },
          -    { "Lucida Grande", 11, "Regular Class", 'm', 1100 },
          -    { "Microsoft Sans Serif", 11, "Regular Class", 'm', 950 },
          -    { "Microsoft Sans Serif", 12, "Regular Class", 'm', 1050 },
          -    { "Segoe UI", 12, "Regular Class", 'H', 1050 },
          -    { "Segoe UI", 12, "Regular Class", 'm', 1050 },
          -    { "Segoe UI", 14, "Regular Class", 'm', 1050 },
          -    { "Tahoma", 11, "Regular Class", 'i', 975 },
          -    { "Tahoma", 11, "Regular Class", 'l', 975 },
          -    { "Tahoma", 11, "Regular Class", 'j', 900 },
          -    { "Tahoma", 11, "Regular Class", 'm', 918 },
          -    { "Verdana", 10, "Regular/Italic Class", 0, 1100 },
          -    { "Verdana", 12, "Regular Class", 'm', 975 },
          -    { "Verdana", 12, "Regular/Italic Class", 0, 1050 },
          -    { "Verdana", 13, "Regular/Italic Class", 'i', 950 },
          -    { "Verdana", 13, "Regular/Italic Class", 'j', 950 },
          -    { "Verdana", 13, "Regular/Italic Class", 'l', 950 },
          -    { "Verdana", 16, "Regular Class", 0, 1050 },
          -    { "Verdana", 9, "Regular/Italic Class", 0, 1050 },
          -    { "Times New Roman", 16, "Regular Class", 'm', 918 },
          -    { "Trebuchet MS", 11, "Regular Class", 'm', 800 },
          -    { "Trebuchet MS", 12, "Regular Class", 'm', 800 },
          -  };
          -
          -#else
          -
          -#define COMPATIBLE_WIDTHS_RULES_SIZE  1
          -
          -  static const SPH_TweakRule  COMPATIBLE_WIDTHS_Rules
          -                              [COMPATIBLE_WIDTHS_RULES_SIZE] =
          -  {
          -    { "-", 0, "", 0 },
          -  };
          -
          -
          -#define X_SCALING_RULES_SIZE  1
          -
          -  static const SPH_ScaleRule  X_SCALING_Rules
          -                              [X_SCALING_RULES_SIZE] =
          -  {
          -    { "-", 0, "", 0, 1000 },
          -  };
          -
          -#endif /* FORCE_NATURAL_WIDTHS */
          -
          -
          -  static FT_Bool
          -  is_member_of_family_class( const FT_String*  detected_font_name,
          -                             const FT_String*  rule_font_name )
          -  {
          -    FT_UInt  i, j;
          -
          -
          -    /* Does font name match rule family? */
          -    if ( ft_strcmp( detected_font_name, rule_font_name ) == 0 )
          -      return TRUE;
          -
          -    /* Is font name a wildcard ""? */
          -    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 ( ft_strcmp( FAMILY_CLASS_Rules[i].name, rule_font_name ) == 0 )
          -      {
          -        for ( j = 0; j < SPH_MAX_CLASS_MEMBERS; j++ )
          -        {
          -          if ( ft_strcmp( FAMILY_CLASS_Rules[i].member[j], "" ) == 0 )
          -            continue;
          -          if ( ft_strcmp( FAMILY_CLASS_Rules[i].member[j],
          -                          detected_font_name ) == 0 )
          -            return TRUE;
          -        }
          -      }
          -    }
          -
          -    return FALSE;
          -  }
          -
          -
          -  static FT_Bool
          -  is_member_of_style_class( const FT_String*  detected_font_style,
          -                            const FT_String*  rule_font_style )
          -  {
          -    FT_UInt  i, j;
          -
          -
          -    /* Does font style match rule style? */
          -    if ( ft_strcmp( detected_font_style, rule_font_style ) == 0 )
          -      return TRUE;
          -
          -    /* Is font style a wildcard ""? */
          -    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 ( ft_strcmp( STYLE_CLASS_Rules[i].name, rule_font_style ) == 0 )
          -      {
          -        for ( j = 0; j < SPH_MAX_CLASS_MEMBERS; j++ )
          -        {
          -          if ( ft_strcmp( STYLE_CLASS_Rules[i].member[j], "" ) == 0 )
          -            continue;
          -          if ( ft_strcmp( STYLE_CLASS_Rules[i].member[j],
          -                          detected_font_style ) == 0 )
          -            return TRUE;
          -        }
          -      }
          -    }
          -
          -    return FALSE;
          -  }
          -
          -
          -  FT_LOCAL_DEF( FT_Bool )
          -  sph_test_tweak( TT_Face               face,
          -                  const FT_String*      family,
          -                  FT_UInt               ppem,
          -                  const FT_String*      style,
          -                  FT_UInt               glyph_index,
          -                  const SPH_TweakRule*  rule,
          -                  FT_UInt               num_rules )
          -  {
          -    FT_UInt  i;
          -
          -
          -    /* rule checks may be able to be optimized further */
          -    for ( i = 0; i < num_rules; i++ )
          -    {
          -      if ( family                                                   &&
          -           ( is_member_of_family_class ( family, rule[i].family ) ) )
          -        if ( rule[i].ppem == 0    ||
          -             rule[i].ppem == ppem )
          -          if ( style                                             &&
          -               is_member_of_style_class ( style, rule[i].style ) )
          -            if ( rule[i].glyph == 0                                ||
          -                 FT_Get_Char_Index( (FT_Face)face,
          -                                    rule[i].glyph ) == glyph_index )
          -        return TRUE;
          -    }
          -
          -    return FALSE;
          -  }
          -
          -
          -  static FT_UInt
          -  scale_test_tweak( TT_Face               face,
          -                    const FT_String*      family,
          -                    FT_UInt               ppem,
          -                    const FT_String*      style,
          -                    FT_UInt               glyph_index,
          -                    const SPH_ScaleRule*  rule,
          -                    FT_UInt               num_rules )
          -  {
          -    FT_UInt  i;
          -
          -
          -    /* rule checks may be able to be optimized further */
          -    for ( i = 0; i < num_rules; i++ )
          -    {
          -      if ( family                                                   &&
          -           ( is_member_of_family_class ( family, rule[i].family ) ) )
          -        if ( rule[i].ppem == 0    ||
          -             rule[i].ppem == ppem )
          -          if ( style                                            &&
          -               is_member_of_style_class( style, rule[i].style ) )
          -            if ( rule[i].glyph == 0                                ||
          -                 FT_Get_Char_Index( (FT_Face)face,
          -                                    rule[i].glyph ) == glyph_index )
          -        return rule[i].scale;
          -    }
          -
          -    return 1000;
          -  }
          -
          -
          -  FT_LOCAL_DEF( FT_UInt )
          -  sph_test_tweak_x_scaling( TT_Face           face,
          -                            const FT_String*  family,
          -                            FT_UInt           ppem,
          -                            const FT_String*  style,
          -                            FT_UInt           glyph_index )
          -  {
          -    return scale_test_tweak( face, family, ppem, style, glyph_index,
          -                             X_SCALING_Rules, X_SCALING_RULES_SIZE );
          -  }
          -
          -
          -#define TWEAK_RULES( x )                                       \
          -  if ( sph_test_tweak( face, family, ppem, style, glyph_index, \
          -                       x##_Rules, x##_RULES_SIZE ) )           \
          -    loader->exec->sph_tweak_flags |= SPH_TWEAK_##x
          -
          -#define TWEAK_RULES_EXCEPTIONS( x )                                        \
          -  if ( sph_test_tweak( face, family, ppem, style, glyph_index,             \
          -                       x##_Rules_Exceptions, x##_RULES_EXCEPTIONS_SIZE ) ) \
          -    loader->exec->sph_tweak_flags &= ~SPH_TWEAK_##x
          -
          -
          -  FT_LOCAL_DEF( void )
          -  sph_set_tweaks( TT_Loader  loader,
          -                  FT_UInt    glyph_index )
          -  {
          -    TT_Face     face   = loader->face;
          -    FT_String*  family = face->root.family_name;
          -    FT_UInt     ppem   = loader->size->metrics->x_ppem;
          -    FT_String*  style  = face->root.style_name;
          -
          -
          -    /* don't apply rules if style isn't set */
          -    if ( !face->root.style_name )
          -      return;
          -
          -#ifdef SPH_DEBUG_MORE_VERBOSE
          -    printf( "%s,%d,%s,%c=%d ",
          -            family, ppem, style, glyph_index, glyph_index );
          -#endif
          -
          -    TWEAK_RULES( PIXEL_HINTING );
          -
          -    if ( loader->exec->sph_tweak_flags & SPH_TWEAK_PIXEL_HINTING )
          -    {
          -      loader->exec->ignore_x_mode = FALSE;
          -      return;
          -    }
          -
          -    TWEAK_RULES( ALLOW_X_DMOVE );
          -    TWEAK_RULES( ALWAYS_DO_DELTAP );
          -    TWEAK_RULES( ALWAYS_SKIP_DELTAP );
          -    TWEAK_RULES( DEEMBOLDEN );
          -    TWEAK_RULES( DO_SHPIX );
          -    TWEAK_RULES( EMBOLDEN );
          -    TWEAK_RULES( MIAP_HACK );
          -    TWEAK_RULES( NORMAL_ROUND );
          -    TWEAK_RULES( NO_ALIGNRP_AFTER_IUP );
          -    TWEAK_RULES( NO_CALL_AFTER_IUP );
          -    TWEAK_RULES( NO_DELTAP_AFTER_IUP );
          -    TWEAK_RULES( RASTERIZER_35 );
          -    TWEAK_RULES( SKIP_IUP );
          -
          -    TWEAK_RULES( SKIP_OFFPIXEL_Y_MOVES );
          -    TWEAK_RULES_EXCEPTIONS( SKIP_OFFPIXEL_Y_MOVES );
          -
          -    TWEAK_RULES( SKIP_NONPIXEL_Y_MOVES_DELTAP );
          -
          -    TWEAK_RULES( SKIP_NONPIXEL_Y_MOVES );
          -    TWEAK_RULES_EXCEPTIONS( SKIP_NONPIXEL_Y_MOVES );
          -
          -    TWEAK_RULES( ROUND_NONPIXEL_Y_MOVES );
          -    TWEAK_RULES_EXCEPTIONS( ROUND_NONPIXEL_Y_MOVES );
          -
          -    if ( loader->exec->sph_tweak_flags & SPH_TWEAK_RASTERIZER_35 )
          -    {
          -      if ( loader->exec->rasterizer_version != TT_INTERPRETER_VERSION_35 )
          -      {
          -        loader->exec->rasterizer_version = TT_INTERPRETER_VERSION_35;
          -        loader->exec->size->cvt_ready    = -1;
          -
          -        tt_size_ready_bytecode(
          -          loader->exec->size,
          -          FT_BOOL( loader->load_flags & FT_LOAD_PEDANTIC ) );
          -      }
          -      else
          -        loader->exec->rasterizer_version = TT_INTERPRETER_VERSION_35;
          -    }
          -    else
          -    {
          -      if ( loader->exec->rasterizer_version  !=
          -           SPH_OPTION_SET_RASTERIZER_VERSION )
          -      {
          -        loader->exec->rasterizer_version = SPH_OPTION_SET_RASTERIZER_VERSION;
          -        loader->exec->size->cvt_ready    = -1;
          -
          -        tt_size_ready_bytecode(
          -          loader->exec->size,
          -          FT_BOOL( loader->load_flags & FT_LOAD_PEDANTIC ) );
          -      }
          -      else
          -        loader->exec->rasterizer_version = SPH_OPTION_SET_RASTERIZER_VERSION;
          -    }
          -
          -    if ( IS_HINTED( loader->load_flags ) )
          -    {
          -      TWEAK_RULES( TIMES_NEW_ROMAN_HACK );
          -      TWEAK_RULES( COURIER_NEW_2_HACK );
          -    }
          -
          -    if ( sph_test_tweak( face, family, ppem, style, glyph_index,
          -           COMPATIBILITY_MODE_Rules, COMPATIBILITY_MODE_RULES_SIZE ) )
          -      loader->exec->face->sph_compatibility_mode = TRUE;
          -
          -
          -    if ( IS_HINTED( loader->load_flags ) )
          -    {
          -      if ( sph_test_tweak( face, family, ppem, style, glyph_index,
          -             COMPATIBLE_WIDTHS_Rules, COMPATIBLE_WIDTHS_RULES_SIZE ) )
          -        loader->exec->compatible_widths |= TRUE;
          -    }
          -  }
          -
          -#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_USE_BYTECODE_INTERPRETER &&          */
          -       /*   TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY) */
          -
          -
          -/* END */
          diff --git a/src/truetype/ttsubpix.h b/src/truetype/ttsubpix.h
          deleted file mode 100644
          index 62af4c272..000000000
          --- a/src/truetype/ttsubpix.h
          +++ /dev/null
          @@ -1,110 +0,0 @@
          -/****************************************************************************
          - *
          - * ttsubpix.h
          - *
          - *   TrueType Subpixel Hinting.
          - *
          - * Copyright (C) 2010-2023 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 TTSUBPIX_H_
          -#define TTSUBPIX_H_
          -
          -#include "ttobjs.h"
          -#include "ttinterp.h"
          -
          -
          -FT_BEGIN_HEADER
          -
          -
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
          -
          -  /**************************************************************************
          -   *
          -   * ID flags to identify special functions at FDEF and runtime.
          -   *
          -   */
          -#define SPH_FDEF_INLINE_DELTA_1       0x0000001
          -#define SPH_FDEF_INLINE_DELTA_2       0x0000002
          -#define SPH_FDEF_DIAGONAL_STROKE      0x0000004
          -#define SPH_FDEF_VACUFORM_ROUND_1     0x0000008
          -#define SPH_FDEF_TTFAUTOHINT_1        0x0000010
          -#define SPH_FDEF_SPACING_1            0x0000020
          -#define SPH_FDEF_SPACING_2            0x0000040
          -#define SPH_FDEF_TYPEMAN_STROKES      0x0000080
          -#define SPH_FDEF_TYPEMAN_DIAGENDCTRL  0x0000100
          -
          -
          -  /**************************************************************************
          -   *
          -   * Tweak flags that are set for each glyph by the below rules.
          -   *
          -   */
          -#define SPH_TWEAK_ALLOW_X_DMOVE                   0x0000001UL
          -#define SPH_TWEAK_ALWAYS_DO_DELTAP                0x0000002UL
          -#define SPH_TWEAK_ALWAYS_SKIP_DELTAP              0x0000004UL
          -#define SPH_TWEAK_COURIER_NEW_2_HACK              0x0000008UL
          -#define SPH_TWEAK_DEEMBOLDEN                      0x0000010UL
          -#define SPH_TWEAK_DO_SHPIX                        0x0000020UL
          -#define SPH_TWEAK_EMBOLDEN                        0x0000040UL
          -#define SPH_TWEAK_MIAP_HACK                       0x0000080UL
          -#define SPH_TWEAK_NORMAL_ROUND                    0x0000100UL
          -#define SPH_TWEAK_NO_ALIGNRP_AFTER_IUP            0x0000200UL
          -#define SPH_TWEAK_NO_CALL_AFTER_IUP               0x0000400UL
          -#define SPH_TWEAK_NO_DELTAP_AFTER_IUP             0x0000800UL
          -#define SPH_TWEAK_PIXEL_HINTING                   0x0001000UL
          -#define SPH_TWEAK_RASTERIZER_35                   0x0002000UL
          -#define SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES          0x0004000UL
          -#define SPH_TWEAK_SKIP_IUP                        0x0008000UL
          -#define SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES           0x0010000UL
          -#define SPH_TWEAK_SKIP_OFFPIXEL_Y_MOVES           0x0020000UL
          -#define SPH_TWEAK_TIMES_NEW_ROMAN_HACK            0x0040000UL
          -#define SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES_DELTAP    0x0080000UL
          -
          -
          -  FT_LOCAL( FT_Bool )
          -  sph_test_tweak( TT_Face               face,
          -                  const FT_String*      family,
          -                  FT_UInt               ppem,
          -                  const FT_String*      style,
          -                  FT_UInt               glyph_index,
          -                  const SPH_TweakRule*  rule,
          -                  FT_UInt               num_rules );
          -
          -  FT_LOCAL( FT_UInt )
          -  sph_test_tweak_x_scaling( TT_Face           face,
          -                            const FT_String*  family,
          -                            FT_UInt           ppem,
          -                            const FT_String*  style,
          -                            FT_UInt           glyph_index );
          -
          -  FT_LOCAL( void )
          -  sph_set_tweaks( TT_Loader  loader,
          -                  FT_UInt    glyph_index );
          -
          -
          -  /* These macros are defined absent a method for setting them */
          -#define SPH_OPTION_BITMAP_WIDTHS           FALSE
          -#define SPH_OPTION_SET_SUBPIXEL            TRUE
          -#define SPH_OPTION_SET_GRAYSCALE           FALSE
          -#define SPH_OPTION_SET_COMPATIBLE_WIDTHS   FALSE
          -#define SPH_OPTION_SET_RASTERIZER_VERSION  38
          -
          -#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
          -
          -
          -FT_END_HEADER
          -
          -#endif /* TTSUBPIX_H_ */
          -
          -
          -/* END */
          -- 
          cgit v1.2.3
          
          
          From 1ecfd2199012edb403605c7f68618a761eaf1193 Mon Sep 17 00:00:00 2001
          From: Alexei Podtelezhnikov 
          Date: Thu, 27 Jul 2023 16:12:28 +0000
          Subject: [truetype] Remove Infinality for good (remaining bits).
          
          * src/truetype/ttobjs.h: Remove remaining fields.
          * src/truetype/ttinterp.c: Do not initialize them.
          * include/freetype/internal/tttypes.h: Remove descriptions.
          ---
           include/freetype/internal/tttypes.h | 8 --------
           src/truetype/ttinterp.c             | 2 --
           src/truetype/ttobjs.h               | 2 --
           3 files changed, 12 deletions(-)
          
          diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h
          index c821741f8..b9788c783 100644
          --- a/include/freetype/internal/tttypes.h
          +++ b/include/freetype/internal/tttypes.h
          @@ -1394,14 +1394,6 @@ FT_BEGIN_HEADER
              *   vert_metrics_offset ::
              *     The file offset of the 'vmtx' table.
              *
          -   *   sph_found_func_flags ::
          -   *     Flags identifying special bytecode functions (used by the v38
          -   *     implementation of the bytecode interpreter).
          -   *
          -   *   sph_compatibility_mode ::
          -   *     This flag is set if we are in ClearType backward compatibility mode
          -   *     (used by the v38 implementation of the bytecode interpreter).
          -   *
              *   ebdt_start ::
              *     The file offset of the sbit data table (CBDT, bdat, etc.).
              *
          diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
          index 93e89691d..79df4555d 100644
          --- a/src/truetype/ttinterp.c
          +++ b/src/truetype/ttinterp.c
          @@ -3544,8 +3544,6 @@
               rec->opc            = (FT_UInt16)n;
               rec->start          = exc->IP + 1;
               rec->active         = TRUE;
          -    rec->inline_delta   = FALSE;
          -    rec->sph_fdef_flags = 0x0000;
           
               if ( n > exc->maxFunc )
                 exc->maxFunc = (FT_UInt16)n;
          diff --git a/src/truetype/ttobjs.h b/src/truetype/ttobjs.h
          index d1834c046..40eb37b4c 100644
          --- a/src/truetype/ttobjs.h
          +++ b/src/truetype/ttobjs.h
          @@ -162,8 +162,6 @@ FT_BEGIN_HEADER
               FT_Long   end;            /* where does it end?                     */
               FT_UInt   opc;            /* function #, or instruction code        */
               FT_Bool   active;         /* is it active?                          */
          -    FT_Bool   inline_delta;   /* is function that defines inline delta? */
          -    FT_ULong  sph_fdef_flags; /* flags to identify special functions    */
           
             } TT_DefRecord, *TT_DefArray;
           
          -- 
          cgit v1.2.3
          
          
          From b2584c738f1a92e6369890cff0504cc044315b38 Mon Sep 17 00:00:00 2001
          From: Alexei Podtelezhnikov 
          Date: Fri, 28 Jul 2023 22:35:58 -0400
          Subject: [truetype] Reduce v40 footprint.
          
          *  src/truetype/ttgload.c (TT_HInt_Glyph, tt_loader_set_pp,
          tt_loader_init): Refactor code.
          ---
           src/truetype/ttgload.c | 75 +++++++++++++++++++++-----------------------------
           1 file changed, 31 insertions(+), 44 deletions(-)
          
          diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
          index 5eedb5331..dc427e8a1 100644
          --- a/src/truetype/ttgload.c
          +++ b/src/truetype/ttgload.c
          @@ -852,22 +852,21 @@
           
           #endif
           
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
               /* 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 &&
          -            exec->backward_compatibility ) )
          -    {
          -#endif
          -      loader->pp1 = zone->cur[zone->n_points - 4];
          -      loader->pp2 = zone->cur[zone->n_points - 3];
          -      loader->pp3 = zone->cur[zone->n_points - 2];
          -      loader->pp4 = zone->cur[zone->n_points - 1];
          +
           #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
          -    }
          +    if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 &&
          +         exec->backward_compatibility )
          +      return FT_Err_Ok;
           #endif
           
          +    loader->pp1 = zone->cur[zone->n_points - 4];
          +    loader->pp2 = zone->cur[zone->n_points - 3];
          +    loader->pp3 = zone->cur[zone->n_points - 2];
          +    loader->pp4 = zone->cur[zone->n_points - 1];
          +
               return FT_Err_Ok;
             }
           
          @@ -1365,36 +1364,31 @@
             static void
             tt_loader_set_pp( TT_Loader  loader )
             {
          -    FT_Bool  subpixel_hinting = 0;
          -    FT_Bool  grayscale        = 0;
          -    FT_Bool  use_aw_2         = 0;
          -
          -#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
          -    TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( loader->face );
          -#endif
          -
          -
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
          -    if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 )
          -    {
          -      subpixel_hinting = loader->exec ? loader->exec->subpixel_hinting_lean
          -                                      : 0;
          -      grayscale        = loader->exec ? loader->exec->grayscale_cleartype
          -                                      : 0;
          -    }
          -#endif
          -
          -    use_aw_2 = FT_BOOL( subpixel_hinting && grayscale );
          -
               loader->pp1.x = loader->bbox.xMin - loader->left_bearing;
               loader->pp1.y = 0;
               loader->pp2.x = loader->pp1.x + loader->advance;
               loader->pp2.y = 0;
           
          -    loader->pp3.x = use_aw_2 ? loader->advance / 2 : 0;
          +    loader->pp3.x = 0;
               loader->pp3.y = loader->bbox.yMax + loader->top_bearing;
          -    loader->pp4.x = use_aw_2 ? loader->advance / 2 : 0;
          +    loader->pp4.x = 0;
               loader->pp4.y = loader->pp3.y - loader->vadvance;
          +
          +#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
          +    {
          +      TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( loader->face );
          +
          +
          +      if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 &&
          +           loader->exec                                             &&
          +           loader->exec->subpixel_hinting_lean                      &&
          +           loader->exec->grayscale_cleartype                        )
          +      {
          +        loader->pp3.x = loader->advance / 2;
          +        loader->pp4.x = loader->advance / 2;
          +      }
          +    }
          +#endif
             }
           
           
          @@ -2221,6 +2215,9 @@
                 if ( !exec )
                   return FT_THROW( Could_Not_Find_Context );
           
          +      grayscale = FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
          +                             FT_RENDER_MODE_MONO             );
          +
           #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
                 if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 )
                 {
          @@ -2237,6 +2234,7 @@
                     FT_BOOL( subpixel_hinting_lean    &&
                              ( load_flags           &
                                FT_LOAD_TARGET_LCD_V ) );
          +        grayscale = FT_BOOL( grayscale && !subpixel_hinting_lean );
                 }
                 else
                 {
          @@ -2246,22 +2244,11 @@
                 }
           #endif
           
          -#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
          -      if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 )
          -        grayscale = FT_BOOL( !subpixel_hinting_lean               &&
          -                             FT_LOAD_TARGET_MODE( load_flags ) !=
          -                               FT_RENDER_MODE_MONO                );
          -      else
          -#endif
          -        grayscale = FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
          -                               FT_RENDER_MODE_MONO             );
          -
                 error = TT_Load_Context( exec, face, size );
                 if ( error )
                   return error;
           
                 {
          -
           #ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
                   if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 )
                   {
          -- 
          cgit v1.2.3
          
          
          From 95a872085e5a79cf710acf6389dbd55b6e728aac Mon Sep 17 00:00:00 2001
          From: Alexei Podtelezhnikov 
          Date: Tue, 1 Aug 2023 22:48:31 -0400
          Subject: * src/base/ftobjs.c (open_face_from_buffer): Silence
           `maybe-uninitialized`.
          
          We never call this function without a `driver_name` (#1245).
          ---
           src/base/ftobjs.c | 3 ++-
           1 file changed, 2 insertions(+), 1 deletion(-)
          
          diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
          index abfa3ab0e..89a25bc73 100644
          --- a/src/base/ftobjs.c
          +++ b/src/base/ftobjs.c
          @@ -1747,7 +1747,8 @@
               FT_Memory     memory = library->memory;
           
           
          -    args.flags = 0;
          +    args.driver = NULL;
          +    args.flags  = 0;
           
               if ( driver_name )
               {
          -- 
          cgit v1.2.3
          
          
          From 3829fdaae5f12590f93807e9bcb866be131a201a Mon Sep 17 00:00:00 2001
          From: Ben Wagner 
          Date: Fri, 4 Aug 2023 11:41:23 -0400
          Subject: Avoid overflow in COLR bounds checks.
          
          The values read into `base_glyphs_offset_v1` and `layer_offset_v1` may
          be in the range 0xFFFFFFFD-0xFFFFFFFF. On systems where `unsigned long`
          is 32 bits adding 4 to such values will wrap and pass bounds checks but
          accessing values at such offsets will be out of bounds.
          
          On the other hand `table_size` has already been tested to be at least
          `COLRV1_HEADER_SIZE` (34) so it is safe to subtract 4 from it.
          
          * src/sfnt/ttcolr.c (tt_face_load_colr): subtract 4 from `table_size`
          instead of adding 4 to font data offsets in bounds checks
          
          Fixes: https://crbug.com/1469348
          ---
           src/sfnt/ttcolr.c | 4 ++--
           1 file changed, 2 insertions(+), 2 deletions(-)
          
          diff --git a/src/sfnt/ttcolr.c b/src/sfnt/ttcolr.c
          index 69ccf0ee7..281e7135e 100644
          --- a/src/sfnt/ttcolr.c
          +++ b/src/sfnt/ttcolr.c
          @@ -229,7 +229,7 @@
           
                 base_glyphs_offset_v1 = FT_NEXT_ULONG( p );
           
          -      if ( base_glyphs_offset_v1 + 4 >= table_size )
          +      if ( base_glyphs_offset_v1 >= table_size - 4 )
                   goto InvalidTable;
           
                 p1                 = (FT_Byte*)( table + base_glyphs_offset_v1 );
          @@ -249,7 +249,7 @@
           
                 if ( layer_offset_v1 )
                 {
          -        if ( layer_offset_v1 + 4 >= table_size )
          +        if ( layer_offset_v1 >= table_size - 4 )
                     goto InvalidTable;
           
                   p1            = (FT_Byte*)( table + layer_offset_v1 );
          -- 
          cgit v1.2.3
          
          
          From a20de84e1608f9eb1d0391d7322b2e0e0f235aba Mon Sep 17 00:00:00 2001
          From: Werner Lemberg 
          Date: Sat, 12 Aug 2023 11:47:41 +0200
          Subject: Fix warnings in tracing messages for 32bit compilation.
          
          Since we now require C99, use `%td` for `ptrdiff_t` and `%zu` for `size_t`.
          ---
           src/autofit/afcjk.c   |  6 +++---
           src/autofit/aflatin.c | 38 +++++++++++++++++++-------------------
           src/psaux/cffdecode.c |  6 +++---
           src/psaux/pshints.c   |  2 +-
           src/psaux/t1decode.c  |  4 ++--
           src/smooth/ftgrays.c  |  2 +-
           src/type1/t1load.c    |  4 ++--
           src/type42/t42parse.c |  2 +-
           8 files changed, 32 insertions(+), 32 deletions(-)
          
          diff --git a/src/autofit/afcjk.c b/src/autofit/afcjk.c
          index af775b190..f414289ad 100644
          --- a/src/autofit/afcjk.c
          +++ b/src/autofit/afcjk.c
          @@ -1634,7 +1634,7 @@
           
               stem_edge->pos = base_edge->pos + fitted_width;
           
          -    FT_TRACE5(( "  CJKLINK: edge %ld @%d (opos=%.2f) linked to %.2f,"
          +    FT_TRACE5(( "  CJKLINK: edge %td @%d (opos=%.2f) linked to %.2f,"
                           " dist was %.2f, now %.2f\n",
                           stem_edge - hints->axis[dim].edges, stem_edge->fpos,
                           (double)stem_edge->opos / 64,
          @@ -1858,7 +1858,7 @@
                     continue;
           
           #ifdef FT_DEBUG_LEVEL_TRACE
          -        FT_TRACE5(( "  CJKBLUE: edge %ld @%d (opos=%.2f) snapped to %.2f,"
          +        FT_TRACE5(( "  CJKBLUE: edge %td @%d (opos=%.2f) snapped to %.2f,"
                               " was %.2f\n",
                               edge1 - edges, edge1->fpos, (double)edge1->opos / 64,
                               (double)blue->fit / 64, (double)edge1->pos / 64 ));
          @@ -1922,7 +1922,7 @@
                 /* this should not happen, but it's better to be safe */
                 if ( edge2->blue_edge )
                 {
          -        FT_TRACE5(( "ASSERTION FAILED for edge %ld\n", edge2-edges ));
          +        FT_TRACE5(( "ASSERTION FAILED for edge %td\n", edge2 - edges ));
           
                   af_cjk_align_linked_edge( hints, dim, edge2, edge );
                   edge->flags |= AF_EDGE_DONE;
          diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c
          index 46c6e450a..b86367aa9 100644
          --- a/src/autofit/aflatin.c
          +++ b/src/autofit/aflatin.c
          @@ -1022,7 +1022,7 @@
                   {
                     *a = *b;
                     FT_TRACE5(( "blue zone overlap:"
          -                      " adjusting %s %ld to %ld\n",
          +                      " adjusting %s %td to %ld\n",
                                 a_is_top ? "overshoot" : "reference",
                                 blue_sorted[i] - axis->blues,
                                 *a ));
          @@ -2960,7 +2960,7 @@
           
               stem_edge->pos = base_edge->pos + fitted_width;
           
          -    FT_TRACE5(( "  LINK: edge %ld (opos=%.2f) linked to %.2f,"
          +    FT_TRACE5(( "  LINK: edge %td (opos=%.2f) linked to %.2f,"
                           " dist was %.2f, now %.2f\n",
                           stem_edge - hints->axis[dim].edges,
                           (double)stem_edge->opos / 64, (double)stem_edge->pos / 64,
          @@ -3085,13 +3085,13 @@
           
           #ifdef FT_DEBUG_LEVEL_TRACE
                   if ( !anchor )
          -          FT_TRACE5(( "  BLUE_ANCHOR: edge %ld (opos=%.2f) snapped to %.2f,"
          -                      " was %.2f (anchor=edge %ld)\n",
          +          FT_TRACE5(( "  BLUE_ANCHOR: edge %td (opos=%.2f) snapped to %.2f,"
          +                      " was %.2f (anchor=edge %td)\n",
                                 edge1 - edges,
                                 (double)edge1->opos / 64, (double)blue->fit / 64,
                                 (double)edge1->pos / 64, edge - edges ));
                   else
          -          FT_TRACE5(( "  BLUE: edge %ld (opos=%.2f) snapped to %.2f,"
          +          FT_TRACE5(( "  BLUE: edge %td (opos=%.2f) snapped to %.2f,"
                                 " was %.2f\n",
                                 edge1 - edges,
                                 (double)edge1->opos / 64, (double)blue->fit / 64,
          @@ -3141,7 +3141,7 @@
                 /* this should not happen, but it's better to be safe */
                 if ( edge2->blue_edge )
                 {
          -        FT_TRACE5(( "  ASSERTION FAILED for edge %ld\n", edge2 - edges ));
          +        FT_TRACE5(( "  ASSERTION FAILED for edge %td\n", edge2 - edges ));
           
                   af_latin_align_linked_edge( hints, dim, edge2, edge );
                   edge->flags |= AF_EDGE_DONE;
          @@ -3209,7 +3209,7 @@
                   anchor       = edge;
                   edge->flags |= AF_EDGE_DONE;
           
          -        FT_TRACE5(( "  ANCHOR: edge %ld (opos=%.2f) and %ld (opos=%.2f)"
          +        FT_TRACE5(( "  ANCHOR: edge %td (opos=%.2f) and %td (opos=%.2f)"
                               " snapped to %.2f and %.2f\n",
                               edge - edges, (double)edge->opos / 64,
                               edge2 - edges, (double)edge2->opos / 64,
          @@ -3238,7 +3238,7 @@
           
                   if ( edge2->flags & AF_EDGE_DONE )
                   {
          -          FT_TRACE5(( "  ADJUST: edge %ld (pos=%.2f) moved to %.2f\n",
          +          FT_TRACE5(( "  ADJUST: edge %td (pos=%.2f) moved to %.2f\n",
                                 edge - edges, (double)edge->pos / 64,
                                 (double)( edge2->pos - cur_len ) / 64 ));
           
          @@ -3279,7 +3279,7 @@
                     edge->pos  = cur_pos1 - cur_len / 2;
                     edge2->pos = cur_pos1 + cur_len / 2;
           
          -          FT_TRACE5(( "  STEM: edge %ld (opos=%.2f) linked to %ld (opos=%.2f)"
          +          FT_TRACE5(( "  STEM: edge %td (opos=%.2f) linked to %td (opos=%.2f)"
                                 " snapped to %.2f and %.2f\n",
                                 edge - edges, (double)edge->opos / 64,
                                 edge2 - edges, (double)edge2->opos / 64,
          @@ -3310,7 +3310,7 @@
                     edge->pos  = ( delta1 < delta2 ) ? cur_pos1 : cur_pos2;
                     edge2->pos = edge->pos + cur_len;
           
          -          FT_TRACE5(( "  STEM: edge %ld (opos=%.2f) linked to %ld (opos=%.2f)"
          +          FT_TRACE5(( "  STEM: edge %td (opos=%.2f) linked to %td (opos=%.2f)"
                                 " snapped to %.2f and %.2f\n",
                                 edge - edges, (double)edge->opos / 64,
                                 edge2 - edges, (double)edge2->opos / 64,
          @@ -3333,7 +3333,7 @@
                     if ( edge->link && FT_ABS( edge->link->pos - edge[-1].pos ) > 16 )
                     {
           #ifdef FT_DEBUG_LEVEL_TRACE
          -            FT_TRACE5(( "  BOUND: edge %ld (pos=%.2f) moved to %.2f\n",
          +            FT_TRACE5(( "  BOUND: edge %td (pos=%.2f) moved to %.2f\n",
                                   edge - edges,
                                   (double)edge->pos / 64,
                                   (double)edge[-1].pos / 64 ));
          @@ -3435,7 +3435,7 @@
                   if ( delta < 64 + 16 )
                   {
                     af_latin_align_serif_edge( hints, edge->serif, edge );
          -          FT_TRACE5(( "  SERIF: edge %ld (opos=%.2f) serif to %ld (opos=%.2f)"
          +          FT_TRACE5(( "  SERIF: edge %td (opos=%.2f) serif to %td (opos=%.2f)"
                                 " aligned to %.2f\n",
                                 edge - edges, (double)edge->opos / 64,
                                 edge->serif - edges, (double)edge->serif->opos / 64,
          @@ -3445,9 +3445,9 @@
                   {
                     edge->pos = FT_PIX_ROUND( edge->opos );
                     anchor    = edge;
          -          FT_TRACE5(( "  SERIF_ANCHOR: edge %ld (opos=%.2f)"
          +          FT_TRACE5(( "  SERIF_ANCHOR: edge %td (opos=%.2f)"
                                 " snapped to %.2f\n",
          -                      edge-edges,
          +                      edge - edges,
                                 (double)edge->opos / 64, (double)edge->pos / 64 ));
                   }
                   else
          @@ -3474,8 +3474,8 @@
                                                after->pos - before->pos,
                                                after->opos - before->opos );
           
          -            FT_TRACE5(( "  SERIF_LINK1: edge %ld (opos=%.2f) snapped to %.2f"
          -                        " from %ld (opos=%.2f)\n",
          +            FT_TRACE5(( "  SERIF_LINK1: edge %td (opos=%.2f) snapped to %.2f"
          +                        " from %td (opos=%.2f)\n",
                                   edge - edges, (double)edge->opos / 64,
                                   (double)edge->pos / 64,
                                   before - edges, (double)before->opos / 64 ));
          @@ -3484,7 +3484,7 @@
                     {
                       edge->pos = anchor->pos +
                                   ( ( edge->opos - anchor->opos + 16 ) & ~31 );
          -            FT_TRACE5(( "  SERIF_LINK2: edge %ld (opos=%.2f)"
          +            FT_TRACE5(( "  SERIF_LINK2: edge %td (opos=%.2f)"
                                   " snapped to %.2f\n",
                                   edge - edges,
                                   (double)edge->opos / 64, (double)edge->pos / 64 ));
          @@ -3505,7 +3505,7 @@
                     if ( edge->link && FT_ABS( edge->link->pos - edge[-1].pos ) > 16 )
                     {
           #ifdef FT_DEBUG_LEVEL_TRACE
          -            FT_TRACE5(( "  BOUND: edge %ld (pos=%.2f) moved to %.2f\n",
          +            FT_TRACE5(( "  BOUND: edge %td (pos=%.2f) moved to %.2f\n",
                                   edge - edges,
                                   (double)edge->pos / 64,
                                   (double)edge[-1].pos / 64 ));
          @@ -3526,7 +3526,7 @@
                     if ( edge->link && FT_ABS( edge->link->pos - edge[-1].pos ) > 16 )
                     {
           #ifdef FT_DEBUG_LEVEL_TRACE
          -            FT_TRACE5(( "  BOUND: edge %ld (pos=%.2f) moved to %.2f\n",
          +            FT_TRACE5(( "  BOUND: edge %td (pos=%.2f) moved to %.2f\n",
                                   edge - edges,
                                   (double)edge->pos / 64,
                                   (double)edge[1].pos / 64 ));
          diff --git a/src/psaux/cffdecode.c b/src/psaux/cffdecode.c
          index 2cd91c96f..562d17d22 100644
          --- a/src/psaux/cffdecode.c
          +++ b/src/psaux/cffdecode.c
          @@ -2153,7 +2153,7 @@
                                                 decoder->locals_bias );
           
           
          -            FT_TRACE4(( " callsubr (idx %d, entering level %ld)\n",
          +            FT_TRACE4(( " callsubr (idx %d, entering level %td)\n",
                                   idx,
                                   zone - decoder->zones + 1 ));
           
          @@ -2197,7 +2197,7 @@
                                                 decoder->globals_bias );
           
           
          -            FT_TRACE4(( " callgsubr (idx %d, entering level %ld)\n",
          +            FT_TRACE4(( " callgsubr (idx %d, entering level %td)\n",
                                   idx,
                                   zone - decoder->zones + 1 ));
           
          @@ -2236,7 +2236,7 @@
                     break;
           
                   case cff_op_return:
          -          FT_TRACE4(( " return (leaving level %ld)\n",
          +          FT_TRACE4(( " return (leaving level %td)\n",
                                 decoder->zone - decoder->zones ));
           
                     if ( decoder->zone <= decoder->zones )
          diff --git a/src/psaux/pshints.c b/src/psaux/pshints.c
          index 6f44d0adb..7bd08a9c9 100644
          --- a/src/psaux/pshints.c
          +++ b/src/psaux/pshints.c
          @@ -310,7 +310,7 @@
                 CF2_Hint  hint = &hintmap->edge[i];
           
           
          -      FT_TRACE6(( "  %3ld    %7.2f  %7.2f  %5d  %s%s%s%s\n",
          +      FT_TRACE6(( "  %3zu    %7.2f  %7.2f  %5d  %s%s%s%s\n",
                             hint->index,
                             hint->csCoord / 65536.0,
                             hint->dsCoord / ( hint->scale * 1.0 ),
          diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c
          index bfed45b53..4b6b969bc 100644
          --- a/src/psaux/t1decode.c
          +++ b/src/psaux/t1decode.c
          @@ -520,7 +520,7 @@
           #ifdef FT_DEBUG_LEVEL_TRACE
                 if ( bol )
                 {
          -        FT_TRACE5(( " (%ld)", decoder->top - decoder->stack ));
          +        FT_TRACE5(( " (%td)", decoder->top - decoder->stack ));
                   bol = FALSE;
                 }
           #endif
          @@ -1165,7 +1165,7 @@
                     if ( top - decoder->stack != num_args )
                       FT_TRACE0(( "t1_decoder_parse_charstrings:"
                                   " too much operands on the stack"
          -                        " (seen %ld, expected %d)\n",
          +                        " (seen %td, expected %d)\n",
                                   top - decoder->stack, num_args ));
                     break;
                   }
          diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
          index 55628af9e..0918272f8 100644
          --- a/src/smooth/ftgrays.c
          +++ b/src/smooth/ftgrays.c
          @@ -1934,7 +1934,7 @@ typedef ptrdiff_t  FT_PtrDist;
                 if ( continued )
                   FT_Trace_Enable();
           
          -      FT_TRACE7(( "band [%d..%d]: %ld cell%s remaining/\n",
          +      FT_TRACE7(( "band [%d..%d]: %td cell%s remaining/\n",
                             ras.min_ey,
                             ras.max_ey,
                             ras.cell_null - ras.cell_free,
          diff --git a/src/type1/t1load.c b/src/type1/t1load.c
          index b292a3cc0..be7cd0fd5 100644
          --- a/src/type1/t1load.c
          +++ b/src/type1/t1load.c
          @@ -1773,7 +1773,7 @@
                  */
           
                 FT_TRACE0(( "parse_subrs: adjusting number of subroutines"
          -                  " (from %d to %ld)\n",
          +                  " (from %d to %zu)\n",
                             num_subrs,
                             ( parser->root.limit - parser->root.cursor ) >> 3 ));
                 num_subrs = ( parser->root.limit - parser->root.cursor ) >> 3;
          @@ -1948,7 +1948,7 @@
               if ( num_glyphs > ( limit - cur ) >> 3 )
               {
                 FT_TRACE0(( "parse_charstrings: adjusting number of glyphs"
          -                  " (from %d to %ld)\n",
          +                  " (from %d to %zu)\n",
                             num_glyphs, ( limit - cur ) >> 3 ));
                 num_glyphs = ( limit - cur ) >> 3;
               }
          diff --git a/src/type42/t42parse.c b/src/type42/t42parse.c
          index 764bbd4c4..f96a43b14 100644
          --- a/src/type42/t42parse.c
          +++ b/src/type42/t42parse.c
          @@ -872,7 +872,7 @@
                 if ( loader->num_glyphs > ( limit - parser->root.cursor ) >> 2 )
                 {
                   FT_TRACE0(( "t42_parse_charstrings: adjusting number of glyphs"
          -                    " (from %d to %ld)\n",
          +                    " (from %d to %zu)\n",
                               loader->num_glyphs,
                               ( limit - parser->root.cursor ) >> 2 ));
                   loader->num_glyphs = ( limit - parser->root.cursor ) >> 2;
          -- 
          cgit v1.2.3
          
          
          From a9793feacefac6d44b761bed12566029f5811063 Mon Sep 17 00:00:00 2001
          From: Ben Wagner 
          Date: Tue, 15 Aug 2023 11:30:26 -0400
          Subject: [base] Avoid UB with memcpy
          
          `FT_NEW_ARRAY(p, 0)` sets `p` to `NULL`. `FT_Stream_ReadAt` with a
          memory based stream uses `FT_MEM_COPY` which is `memcpy` which specifies
          that it is undefined behavior for either the `src` or `dst` to be
          `NULL`. Instead of forcing all callers work around calling
          `FT_Stream_Read` when `buffer == NULL && count == 0` do the check in
          `FT_StreamRead`. This allows any call with `count == 0` to succesfully
          read zero bytes without UB.
          
          * src/base/ftstream.c (FT_Stream_ReadAt): skip `FT_MEM_COPY` when
          `count == 0`. (FT_Stream_TryRead): ditto
          
          Fixes: #1250
          ---
           src/base/ftstream.c | 8 ++++++--
           1 file changed, 6 insertions(+), 2 deletions(-)
          
          diff --git a/src/base/ftstream.c b/src/base/ftstream.c
          index 05c563757..64826aceb 100644
          --- a/src/base/ftstream.c
          +++ b/src/base/ftstream.c
          @@ -141,7 +141,9 @@
                 if ( read_bytes > count )
                   read_bytes = count;
           
          -      FT_MEM_COPY( buffer, stream->base + pos, read_bytes );
          +      /* Allow "reading" zero bytes without UB even if buffer is NULL */
          +      if ( count )
          +        FT_MEM_COPY( buffer, stream->base + pos, read_bytes );
               }
           
               stream->pos = pos + read_bytes;
          @@ -178,7 +180,9 @@
                 if ( read_bytes > count )
                   read_bytes = count;
           
          -      FT_MEM_COPY( buffer, stream->base + stream->pos, read_bytes );
          +      /* Allow "reading" zero bytes without UB even if buffer is NULL */
          +      if ( count )
          +        FT_MEM_COPY( buffer, stream->base + stream->pos, read_bytes );
               }
           
               stream->pos += read_bytes;
          -- 
          cgit v1.2.3
          
          
          From e907eef6b2d1a2606748598a4736d054dd3ef34f Mon Sep 17 00:00:00 2001
          From: Hugh McMaster 
          Date: Sat, 19 Aug 2023 22:02:14 +1000
          Subject: builds/freetype.mk: Invoke `mkdocs` as a Python module
          
          FreeType's `refdoc` target currently allows users to override the
          default Python path, which is useful for testing and development.
          
          In contrast, `mkdocs` is invoked via the default Python path.
          
          Invoking `mkdocs` via Python's module syntax allows for greater
          flexibility, although there is no change for the default use case.
          ---
           builds/freetype.mk | 2 +-
           1 file changed, 1 insertion(+), 1 deletion(-)
          
          diff --git a/builds/freetype.mk b/builds/freetype.mk
          index d96ded072..b3fac80fd 100644
          --- a/builds/freetype.mk
          +++ b/builds/freetype.mk
          @@ -299,7 +299,7 @@ refdoc:
                             $(PUBLIC_DIR)/config/*.h \
                             $(PUBLIC_DIR)/cache/*.h
           	@echo Building static site...
          -	cd $(DOC_DIR) && mkdocs build
          +	cd $(DOC_DIR) && $(PYTHON) -m mkdocs build
           	@echo Done.
           
           # Variables for running `refdoc' with Python's `virtualenv'.  The
          -- 
          cgit v1.2.3
          
          
          From a3f44aadbc5797b3e7a5a9f38473985eaf23d4cb Mon Sep 17 00:00:00 2001
          From: Werner Lemberg 
          Date: Tue, 22 Aug 2023 12:20:56 +0200
          Subject: builds/toplevel.mk: Don't use `\#` in functions.
          
          The behaviour changed in GNU make 4.3, where `#` (without the backslash)
          would be necessary.  Using a variable instead the code works with both older
          and newer GNU make versions.
          
          Fixes #1252.
          ---
           builds/toplevel.mk | 8 +++++---
           1 file changed, 5 insertions(+), 3 deletions(-)
          
          diff --git a/builds/toplevel.mk b/builds/toplevel.mk
          index 5a3ff2abd..7530be753 100644
          --- a/builds/toplevel.mk
          +++ b/builds/toplevel.mk
          @@ -201,21 +201,23 @@ include $(TOP_DIR)/builds/modules.mk
           # get FreeType version string, using a
           # poor man's `sed' emulation with make's built-in string functions
           #
          +hash := \#
          +
           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))
          +work := $(subst $(hash)define|FREETYPE_MAJOR|,$(space),$(work))
           work := $(word 2,$(work))
           major := $(subst |,$(space),$(work))
           major := $(firstword $(major))
           
          -work := $(subst \#define|FREETYPE_MINOR|,$(space),$(work))
          +work := $(subst $(hash)define|FREETYPE_MINOR|,$(space),$(work))
           work := $(word 2,$(work))
           minor := $(subst |,$(space),$(work))
           minor := $(firstword $(minor))
           
          -work := $(subst \#define|FREETYPE_PATCH|,$(space),$(work))
          +work := $(subst $(hash)define|FREETYPE_PATCH|,$(space),$(work))
           work := $(word 2,$(work))
           patch := $(subst |,$(space),$(work))
           patch := $(firstword $(patch))
          -- 
          cgit v1.2.3
          
          
          From 97251fd5aa2a90041cf4f397a5e887b8d60ab0c2 Mon Sep 17 00:00:00 2001
          From: Alexei Podtelezhnikov 
          Date: Mon, 21 Aug 2023 23:23:22 -0400
          Subject: [base] Improve the matrix degeneracy check.
          
          Also fixes #1251.
          
          * src/base/ftcalc.c (FT_Matrix_Check): To avoid overflow, scale by shifting.
          * include/freetype/internal/ftcalc.h (FT_Matrix_Check): Update description.
          ---
           include/freetype/internal/ftcalc.h |  4 +--
           src/base/ftcalc.c                  | 70 +++++++++++++-------------------------
           2 files changed, 26 insertions(+), 48 deletions(-)
          
          diff --git a/include/freetype/internal/ftcalc.h b/include/freetype/internal/ftcalc.h
          index d1baa392b..d9aea2360 100644
          --- a/include/freetype/internal/ftcalc.h
          +++ b/include/freetype/internal/ftcalc.h
          @@ -332,9 +332,9 @@ FT_BEGIN_HEADER
              * Based on geometric considerations we use the following inequality to
              * identify a degenerate matrix.
              *
          -   *   50 * abs(xx*yy - xy*yx) < xx^2 + xy^2 + yx^2 + yy^2
          +   *   32 * abs(xx*yy - xy*yx) < xx^2 + xy^2 + yx^2 + yy^2
              *
          -   * Value 50 is heuristic.
          +   * Value 32 is heuristic.
              */
             FT_BASE( FT_Bool )
             FT_Matrix_Check( const FT_Matrix*  matrix );
          diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c
          index 442b08ddf..9e87abd09 100644
          --- a/src/base/ftcalc.c
          +++ b/src/base/ftcalc.c
          @@ -749,65 +749,43 @@
             FT_BASE_DEF( FT_Bool )
             FT_Matrix_Check( const FT_Matrix*  matrix )
             {
          -    FT_Matrix  m;
          -    FT_Fixed   val[4];
          -    FT_Fixed   nonzero_minval, maxval;
          -    FT_Fixed   temp1, temp2;
          -    FT_UInt    i;
          +    FT_Fixed  xx, xy, yx, yy;
          +    FT_Fixed  val;
          +    FT_Int    shift;
          +    FT_ULong  temp1, temp2;
           
           
               if ( !matrix )
                 return 0;
           
          -    val[0] = FT_ABS( matrix->xx );
          -    val[1] = FT_ABS( matrix->xy );
          -    val[2] = FT_ABS( matrix->yx );
          -    val[3] = FT_ABS( matrix->yy );
          -
          -    /*
          -     * To avoid overflow, we ensure that each value is not larger than
          -     *
          -     *   int(sqrt(2^31 / 4)) = 23170  ;
          -     *
          -     * we also check that no value becomes zero if we have to scale.
          -     */
          -
          -    maxval         = 0;
          -    nonzero_minval = FT_LONG_MAX;
          +    xx  = matrix->xx;
          +    xy  = matrix->xy;
          +    yx  = matrix->yx;
          +    yy  = matrix->yy;
          +    val = FT_ABS( xx ) | FT_ABS( xy ) | FT_ABS( yx ) | FT_ABS( yy );
           
          -    for ( i = 0; i < 4; i++ )
          -    {
          -      if ( val[i] > maxval )
          -        maxval = val[i];
          -      if ( val[i] && val[i] < nonzero_minval )
          -        nonzero_minval = val[i];
          -    }
          -
          -    /* we only handle 32bit values */
          -    if ( maxval > 0x7FFFFFFFL )
          +    /* we only handle non-zero 32-bit values */
          +    if ( !val || val > 0x7FFFFFFFL )
                 return 0;
           
          -    if ( maxval > 23170 )
          -    {
          -      FT_Fixed  scale = FT_DivFix( maxval, 23170 );
          -
          +    /* Scale matrix to avoid the temp1 overflow, which is */
          +    /* more stringent than avoiding the temp2 overflow.   */
           
          -      if ( !FT_DivFix( nonzero_minval, scale ) )
          -        return 0;    /* value range too large */
          +    shift = FT_MSB( val ) - 12;
           
          -      m.xx = FT_DivFix( matrix->xx, scale );
          -      m.xy = FT_DivFix( matrix->xy, scale );
          -      m.yx = FT_DivFix( matrix->yx, scale );
          -      m.yy = FT_DivFix( matrix->yy, scale );
          +    if ( shift > 0 )
          +    {
          +      xx >>= shift;
          +      xy >>= shift;
          +      yx >>= shift;
          +      yy >>= shift;
               }
          -    else
          -      m = *matrix;
           
          -    temp1 = FT_ABS( m.xx * m.yy - m.xy * m.yx );
          -    temp2 = m.xx * m.xx + m.xy * m.xy + m.yx * m.yx + m.yy * m.yy;
          +    temp1 = 32U * (FT_ULong)FT_ABS( xx * yy - xy * yx );
          +    temp2 = (FT_ULong)( xx * xx ) + (FT_ULong)( xy * xy ) +
          +            (FT_ULong)( yx * yx ) + (FT_ULong)( yy * yy );
           
          -    if ( temp1 == 0         ||
          -         temp2 / temp1 > 50 )
          +    if ( temp1 <= temp2 )
                 return 0;
           
               return 1;
          -- 
          cgit v1.2.3
          
          
          From 00b07598d96f7c6c96d2d32dbbb9cd11b3adeacd Mon Sep 17 00:00:00 2001
          From: Alexei Podtelezhnikov 
          Date: Thu, 24 Aug 2023 08:13:18 -0400
          Subject: * builds/toplevel.mk: Simplify version extraction.
          
          ---
           builds/toplevel.mk | 29 +++++++++++------------------
           1 file changed, 11 insertions(+), 18 deletions(-)
          
          diff --git a/builds/toplevel.mk b/builds/toplevel.mk
          index 7530be753..8d5063ebb 100644
          --- a/builds/toplevel.mk
          +++ b/builds/toplevel.mk
          @@ -198,29 +198,22 @@ modules:
           include $(TOP_DIR)/builds/modules.mk
           
           
          -# get FreeType version string, using a
          -# poor man's `sed' emulation with make's built-in string functions
          +# get FreeType version string using built-in string functions
           #
           hash := \#
           
           work := $(strip $(shell $(CAT) \
                             $(subst /,$(SEP),$(TOP_DIR)/include/freetype/freetype.h)))
          -work := $(subst |,x,$(work))
          -work := $(subst $(space),|,$(work))
          -work := $(subst $(hash)define|FREETYPE_MAJOR|,$(space),$(work))
          -work := $(word 2,$(work))
          -major := $(subst |,$(space),$(work))
          -major := $(firstword $(major))
          -
          -work := $(subst $(hash)define|FREETYPE_MINOR|,$(space),$(work))
          -work := $(word 2,$(work))
          -minor := $(subst |,$(space),$(work))
          -minor := $(firstword $(minor))
          -
          -work := $(subst $(hash)define|FREETYPE_PATCH|,$(space),$(work))
          -work := $(word 2,$(work))
          -patch := $(subst |,$(space),$(work))
          -patch := $(firstword $(patch))
          +
          +work := $(subst $(hash)define$(space)FREETYPE_MAJOR$(space),MAjOR=,$(work))
          +work := $(subst $(hash)define$(space)FREETYPE_MINOR$(space),MInOR=,$(work))
          +work := $(subst $(hash)define$(space)FREETYPE_PATCH$(space),PAtCH=,$(work))
          +
          +major := $(subst MAjOR=,,$(filter MAjOR=%,$(work)))
          +minor := $(subst MInOR=,,$(filter MInOR=%,$(work)))
          +patch := $(subst PAtCH=,,$(filter PAtCH=%,$(work)))
          +
          +work :=
           
           # ifneq ($(findstring x0x,x$(patch)x),)
           #   version := $(major).$(minor)
          -- 
          cgit v1.2.3
          
          
          From e3ada2f70d9ca1f43f29f0e895136266499e55e0 Mon Sep 17 00:00:00 2001
          From: Hugh McMaster 
          Date: Mon, 21 Aug 2023 14:33:24 +1000
          Subject: builds/unix/configure.raw: Use variable to specify minimum Python
           version.
          
          ---
           builds/unix/configure.raw | 6 +++---
           1 file changed, 3 insertions(+), 3 deletions(-)
          
          diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw
          index 2c152022f..e3bacef9b 100644
          --- a/builds/unix/configure.raw
          +++ b/builds/unix/configure.raw
          @@ -966,14 +966,14 @@ esac
           AX_PTHREAD([have_pthread=yes], [have_pthread=no])
           
           # Check for Python and docwriter
          -
          +PYTHON_MIN_VERSION=3.5
           have_py3=no
           have_docwriter=no
           PIP=pip
           
           AC_CHECK_PROGS([PYTHON], [python3 python], [missing])
           if test "x$PYTHON" != "xmissing"; then
          -  AX_PROG_PYTHON_VERSION([3.5], [have_py3=yes], [])
          +  AX_PROG_PYTHON_VERSION([$PYTHON_MIN_VERSION], [have_py3=yes], [])
           
             if test "x$have_py3" = "xyes"; then
               PIP="$PYTHON -m $PIP"
          @@ -1162,7 +1162,7 @@ if test $have_docwriter = no; then
             `make refdoc' will fail since pip package `docwriter' is not installed.
             To install, run `$PIP install docwriter', or to use a Python
             virtual environment, run `make refdoc-venv' (requires pip package
          -  `virtualenv').  These operations require Python >= 3.5.
          +  `virtualenv').  These operations require Python >= $PYTHON_MIN_VERSION.
             ])
           fi
           
          -- 
          cgit v1.2.3
          
          
          From aa5f00187491f839bbeec32706afb9f32e4a0879 Mon Sep 17 00:00:00 2001
          From: Werner Lemberg 
          Date: Thu, 24 Aug 2023 20:46:48 +0200
          Subject: * subprojects/*.wrap: Updated.
          
          ---
           subprojects/libpng.wrap | 18 +++++++++---------
           subprojects/zlib.wrap   | 18 +++++++++---------
           2 files changed, 18 insertions(+), 18 deletions(-)
          
          diff --git a/subprojects/libpng.wrap b/subprojects/libpng.wrap
          index 68abec897..eb0785d9d 100644
          --- a/subprojects/libpng.wrap
          +++ b/subprojects/libpng.wrap
          @@ -1,13 +1,13 @@
           [wrap-file]
          -directory = libpng-1.6.39
          -source_url = https://github.com/glennrp/libpng/archive/v1.6.39.tar.gz
          -source_filename = libpng-1.6.39.tar.gz
          -source_hash = a00e9d2f2f664186e4202db9299397f851aea71b36a35e74910b8820e380d441
          -patch_filename = libpng_1.6.39-3_patch.zip
          -patch_url = https://wrapdb.mesonbuild.com/v2/libpng_1.6.39-3/get_patch
          -patch_hash = 6af2a8d464e3f1d2e2832580896323ac7b0b786806c75f0eff0c8ec82dd603ec
          -source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/libpng_1.6.39-3/libpng-1.6.39.tar.gz
          -wrapdb_version = 1.6.39-3
          +directory = libpng-1.6.40
          +source_url = https://github.com/glennrp/libpng/archive/v1.6.40.tar.gz
          +source_filename = libpng-1.6.40.tar.gz
          +source_hash = 62d25af25e636454b005c93cae51ddcd5383c40fa14aa3dae8f6576feb5692c2
          +patch_filename = libpng_1.6.40-1_patch.zip
          +patch_url = https://wrapdb.mesonbuild.com/v2/libpng_1.6.40-1/get_patch
          +patch_hash = bad558070e0a82faa5c0ae553bcd12d49021fc4b628f232a8e58c3fbd281aae1
          +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/libpng_1.6.40-1/libpng-1.6.40.tar.gz
          +wrapdb_version = 1.6.40-1
           
           [provide]
           libpng = libpng_dep
          diff --git a/subprojects/zlib.wrap b/subprojects/zlib.wrap
          index 4f19672e4..f9f118038 100644
          --- a/subprojects/zlib.wrap
          +++ b/subprojects/zlib.wrap
          @@ -1,13 +1,13 @@
           [wrap-file]
          -directory = zlib-1.2.13
          -source_url = http://zlib.net/fossils/zlib-1.2.13.tar.gz
          -source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/zlib_1.2.13-4/zlib-1.2.13.tar.gz
          -source_filename = zlib-1.2.13.tar.gz
          -source_hash = b3a24de97a8fdbc835b9833169501030b8977031bcb54b3b3ac13740f846ab30
          -patch_filename = zlib_1.2.13-4_patch.zip
          -patch_url = https://wrapdb.mesonbuild.com/v2/zlib_1.2.13-4/get_patch
          -patch_hash = 19636b7807e679b92240bc7a99aed85d1be908a45430b12c7687a825cb499d5e
          -wrapdb_version = 1.2.13-4
          +directory = zlib-1.3
          +source_url = http://zlib.net/fossils/zlib-1.3.tar.gz
          +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/zlib_1.3-1/zlib-1.3.tar.gz
          +source_filename = zlib-1.3.tar.gz
          +source_hash = ff0ba4c292013dbc27530b3a81e1f9a813cd39de01ca5e0f8bf355702efa593e
          +patch_filename = zlib_1.3-1_patch.zip
          +patch_url = https://wrapdb.mesonbuild.com/v2/zlib_1.3-1/get_patch
          +patch_hash = ab9d6b8167bb34a7c52b60b0cd6138aa4e0c2d31f997343a5f506f3b97b32008
          +wrapdb_version = 1.3-1
           
           [provide]
           zlib = zlib_dep
          -- 
          cgit v1.2.3
          
          
          From d42679b93d5e77fe769591cd1d04522225940556 Mon Sep 17 00:00:00 2001
          From: Werner Lemberg 
          Date: Fri, 25 Aug 2023 18:05:01 +0200
          Subject: Fix clang warnings.
          
          * src/cffload.c (cff_blend_doBlend): Fix type of `sum`.
          * src/truetype/ttgxvar.c (tt_var_load_item_variation_store): Fix type of
            `word_delta_count`.
          ---
           src/cff/cffload.c      | 2 +-
           src/truetype/ttgxvar.c | 8 ++++----
           2 files changed, 5 insertions(+), 5 deletions(-)
          
          diff --git a/src/cff/cffload.c b/src/cff/cffload.c
          index bee89f0c6..af79082e9 100644
          --- a/src/cff/cffload.c
          +++ b/src/cff/cffload.c
          @@ -1361,7 +1361,7 @@
               for ( i = 0; i < numBlends; i++ )
               {
                 const FT_Int32*  weight = &blend->BV[1];
          -      FT_UInt32        sum;
          +      FT_Fixed         sum;
           
           
                 /* convert inputs to 16.16 fixed point */
          diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c
          index 8c713f1b6..ad4f266b2 100644
          --- a/src/truetype/ttgxvar.c
          +++ b/src/truetype/ttgxvar.c
          @@ -621,10 +621,10 @@
               {
                 GX_ItemVarData  varData = &itemStore->varData[i];
           
          -      FT_UInt  item_count;
          -      FT_UInt  word_delta_count;
          -      FT_UInt  region_idx_count;
          -      FT_UInt  per_region_size;
          +      FT_UInt    item_count;
          +      FT_UShort  word_delta_count;
          +      FT_UInt    region_idx_count;
          +      FT_UInt    per_region_size;
           
           
                 if ( FT_STREAM_SEEK( offset + dataOffsetArray[i] ) )
          -- 
          cgit v1.2.3
          
          
          From 0c817334b708a83425ce5b86448c4d6a26ebbc76 Mon Sep 17 00:00:00 2001
          From: Alexei Podtelezhnikov 
          Date: Fri, 25 Aug 2023 17:57:47 +0000
          Subject: * src/base/ftcalc.c (FT_MulAddFix): Simplify 32-bit rounding.
          
          ---
           src/base/ftcalc.c | 12 +++---------
           1 file changed, 3 insertions(+), 9 deletions(-)
          
          diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c
          index 9e87abd09..c5bc7e3b1 100644
          --- a/src/base/ftcalc.c
          +++ b/src/base/ftcalc.c
          @@ -1070,9 +1070,6 @@
             {
               FT_UInt   i;
               FT_Int64  temp;
          -#ifndef FT_INT64
          -    FT_Int64  halfUnit;
          -#endif
           
           
           #ifdef FT_INT64
          @@ -1117,13 +1114,10 @@
                 FT_Add64( &temp, &multResult, &temp );
               }
           
          -    /* Round value. */
          -    halfUnit.hi = 0;
          -    halfUnit.lo = 0x8000;
          -    FT_Add64( &temp, &halfUnit, &temp );
          +    /* Shift and round value. */
          +    return (FT_Int32)( ( ( temp.hi << 16 ) | ( temp.lo >> 16 ) )
          +                                     + ( 1 & ( temp.lo >> 15 ) ) );
           
          -    return (FT_Int32)( ( (FT_Int32)( temp.hi & 0xFFFF ) << 16 ) |
          -                                   ( temp.lo >> 16 )            );
           
           #endif /* !FT_INT64 */
           
          -- 
          cgit v1.2.3
          
          
          From 920c5502cc3ddda88f6c7d85ee834ac611bb11cc Mon Sep 17 00:00:00 2001
          From: Werner Lemberg 
          Date: Fri, 25 Aug 2023 19:51:30 +0200
          Subject: * Version 2.13.2 released. ==========================
          
          Tag sources with `VER-2-13-2'.
          
          * docs/VERSION.TXT: Add entry for version 2.13.2.
          * docs/CHANGES: Updated.
          * docs/release, docs/README, builds/macs/README: Updated.
          
          * README, src/base/ftver.rc, builds/windows/vc2010/index.html,
          builds/windows/visualc/index.html, builds/windows/visualce/index.html,
          builds/wince/vc2005-ce/index.html, builds/wince/vc2008-ce/index.html,
          docs/freetype-config.1: s/2.13.1/2.13.2/, s/2131/2132/.
          
          * include/freetype/freetype.h (FREETYPE_PATCH): Set to 2.
          
          * builds/unix/configure.raw (version_info): Set to 26:1:20.
          * CMakeLists.txt (VERSION_PATCH): Set to 2.
          ---
           CMakeLists.txt                     |  2 +-
           README                             |  8 ++++----
           builds/unix/configure.raw          |  2 +-
           builds/wince/vc2005-ce/index.html  |  2 +-
           builds/wince/vc2008-ce/index.html  |  2 +-
           builds/windows/vc2010/index.html   |  2 +-
           builds/windows/visualc/index.html  |  2 +-
           builds/windows/visualce/index.html |  2 +-
           docs/CHANGES                       | 14 ++++++++++++++
           docs/VERSIONS.TXT                  |  1 +
           docs/freetype-config.1             |  2 +-
           include/freetype/freetype.h        |  2 +-
           src/base/ftver.rc                  |  4 ++--
           13 files changed, 30 insertions(+), 15 deletions(-)
          
          diff --git a/CMakeLists.txt b/CMakeLists.txt
          index d31ab175d..8dbca01e6 100644
          --- a/CMakeLists.txt
          +++ b/CMakeLists.txt
          @@ -164,7 +164,7 @@ project(freetype C)
           
           set(VERSION_MAJOR "2")
           set(VERSION_MINOR "13")
          -set(VERSION_PATCH "1")
          +set(VERSION_PATCH "2")
           
           # Generate LIBRARY_VERSION and LIBRARY_SOVERSION.
           set(LIBTOOL_REGEX "version_info='([0-9]+):([0-9]+):([0-9]+)'")
          diff --git a/README b/README
          index eb48e7e18..cd4c1d7d1 100644
          --- a/README
          +++ b/README
          @@ -1,4 +1,4 @@
          -FreeType 2.13.1
          +FreeType 2.13.2
           ===============
           
           Homepage: https://www.freetype.org
          @@ -32,9 +32,9 @@ sites.  Go to
           
           and download one of the following files.
           
          -  freetype-doc-2.13.1.tar.xz
          -  freetype-doc-2.13.1.tar.gz
          -  ftdoc2131.zip
          +  freetype-doc-2.13.2.tar.xz
          +  freetype-doc-2.13.2.tar.gz
          +  ftdoc2132.zip
           
           To view the documentation online, go to
           
          diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw
          index e3bacef9b..dc7426ee0 100644
          --- a/builds/unix/configure.raw
          +++ b/builds/unix/configure.raw
          @@ -17,7 +17,7 @@ AC_CONFIG_SRCDIR([ftconfig.h.in])
           
           # Don't forget to update `docs/VERSIONS.TXT'!
           
          -version_info='26:0:20'
          +version_info='26:1:20'
           AC_SUBST([version_info])
           ft_version=`echo $version_info | tr : .`
           AC_SUBST([ft_version])
          diff --git a/builds/wince/vc2005-ce/index.html b/builds/wince/vc2005-ce/index.html
          index cef32c12e..8ea6cfded 100644
          --- a/builds/wince/vc2005-ce/index.html
          +++ b/builds/wince/vc2005-ce/index.html
          @@ -21,7 +21,7 @@ the following targets:
             
        • PPC/SP WM6 (Windows Mobile 6)
        -It compiles the following libraries from the FreeType 2.13.1 sources:

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

          diff --git a/builds/wince/vc2008-ce/index.html b/builds/wince/vc2008-ce/index.html
          index 1d36f6021..a6e74f893 100644
          --- a/builds/wince/vc2008-ce/index.html
          +++ b/builds/wince/vc2008-ce/index.html
          @@ -21,7 +21,7 @@ the following targets:
             
        • PPC/SP WM6 (Windows Mobile 6)
        -It compiles the following libraries from the FreeType 2.13.1 sources:

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

          diff --git a/builds/windows/vc2010/index.html b/builds/windows/vc2010/index.html
          index 95e27e628..ee9b59a2b 100644
          --- a/builds/windows/vc2010/index.html
          +++ b/builds/windows/vc2010/index.html
          @@ -12,7 +12,7 @@
           

          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.13.1 sources:

          +from the FreeType 2.13.2 sources:

          • freetype.dll using 'Release' or 'Debug' configurations
          • diff --git a/builds/windows/visualc/index.html b/builds/windows/visualc/index.html index de957a61a..816605e07 100644 --- a/builds/windows/visualc/index.html +++ b/builds/windows/visualc/index.html @@ -12,7 +12,7 @@

            This directory contains project files freetype.dsp for Visual C++ 6.0, and freetype.vcproj for Visual C++ 2002 through 2008, which you might need to upgrade automatically. -It compiles the following libraries from the FreeType 2.13.1 sources:

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

            • freetype.dll using 'Release' or 'Debug' configurations
            • diff --git a/builds/windows/visualce/index.html b/builds/windows/visualce/index.html index 706924a74..d9c8fe475 100644 --- a/builds/windows/visualce/index.html +++ b/builds/windows/visualce/index.html @@ -21,7 +21,7 @@ the following targets:
            • PPC/SP WM6 (Windows Mobile 6)
            -It compiles the following libraries from the FreeType 2.13.1 sources:

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

              diff --git a/docs/CHANGES b/docs/CHANGES
              index b6ad1ce5d..96cf607d7 100644
              --- a/docs/CHANGES
              +++ b/docs/CHANGES
              @@ -1,3 +1,17 @@
              +CHANGES BETWEEN 2.13.1 and 2.13.2 (2023-Aug-25)
              +
              +  I. MISCELLANEOUS
              +
              +  - Better support for CFF2 variation fonts.
              +
              +  - TrueType interpreter  version 38 (also known  as 'Infinality') has
              +    been removed.
              +
              +  - Improved OpenVMS support.
              +
              +
              +======================================================================
              +
               CHANGES BETWEEN 2.13.0 and 2.13.1 (2023-Jun-24)
               
                 I. MISCELLANEOUS
              diff --git a/docs/VERSIONS.TXT b/docs/VERSIONS.TXT
              index eb71fd051..8b43c1583 100644
              --- a/docs/VERSIONS.TXT
              +++ b/docs/VERSIONS.TXT
              @@ -60,6 +60,7 @@ found on _most_ systems, but not all of them:
               
                   release     libtool     so
                 -------------------------------
              +     2.13.2     26.1.20   6.20.1
                    2.13.1     26.0.20   6.20.0
                    2.13.0     25.0.19   6.19.0
                    2.12.1     24.3.18   6.18.3
              diff --git a/docs/freetype-config.1 b/docs/freetype-config.1
              index cc6f3006d..6ef1ac8f3 100644
              --- a/docs/freetype-config.1
              +++ b/docs/freetype-config.1
              @@ -1,4 +1,4 @@
              -.TH FREETYPE-CONFIG 1 "June 2023" "FreeType 2.13.1"
              +.TH FREETYPE-CONFIG 1 "August 2023" "FreeType 2.13.2"
               .
               .
               .SH NAME
              diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
              index 4a074a444..92acf3794 100644
              --- a/include/freetype/freetype.h
              +++ b/include/freetype/freetype.h
              @@ -5222,7 +5222,7 @@ FT_BEGIN_HEADER
                  */
               #define FREETYPE_MAJOR  2
               #define FREETYPE_MINOR  13
              -#define FREETYPE_PATCH  1
              +#define FREETYPE_PATCH  2
               
               
                 /**************************************************************************
              diff --git a/src/base/ftver.rc b/src/base/ftver.rc
              index c7155d53d..137a6334b 100644
              --- a/src/base/ftver.rc
              +++ b/src/base/ftver.rc
              @@ -18,8 +18,8 @@
               
               #include
               
              -#define FT_VERSION      2,13,1,0
              -#define FT_VERSION_STR  "2.13.1"
              +#define FT_VERSION      2,13,2,0
              +#define FT_VERSION_STR  "2.13.2"
               
               VS_VERSION_INFO      VERSIONINFO
               FILEVERSION          FT_VERSION
              -- 
              cgit v1.2.3