Skip to content

Commit

Permalink
Track recent freetype commit for now
Browse files Browse the repository at this point in the history
There was some UB (see !207 on FreeType) which was a blocking issue for
certain use cases. The issue has been fixed on freetype master, so for
now we'll track a recent commit until a new release is tagged.
  • Loading branch information
mlugg authored and Stephen Gutekanst committed Oct 14, 2022
1 parent a0403e3 commit d2eb350
Show file tree
Hide file tree
Showing 69 changed files with 1,812 additions and 960 deletions.
8 changes: 4 additions & 4 deletions freetype/include/freetype/freetype.h
Original file line number Diff line number Diff line change
Expand Up @@ -1892,13 +1892,13 @@ FT_BEGIN_HEADER
* The advance width of the unhinted glyph. Its value is expressed in
* 16.16 fractional pixels, unless @FT_LOAD_LINEAR_DESIGN is set when
* loading the glyph. This field can be important to perform correct
* WYSIWYG layout. Only relevant for outline glyphs.
* WYSIWYG layout. Only relevant for scalable glyphs.
*
* linearVertAdvance ::
* The advance height of the unhinted glyph. Its value is expressed in
* 16.16 fractional pixels, unless @FT_LOAD_LINEAR_DESIGN is set when
* loading the glyph. This field can be important to perform correct
* WYSIWYG layout. Only relevant for outline glyphs.
* WYSIWYG layout. Only relevant for scalable glyphs.
*
* advance ::
* This shorthand is, depending on @FT_LOAD_IGNORE_TRANSFORM, the
Expand Down Expand Up @@ -2593,8 +2593,8 @@ FT_BEGIN_HEADER
* stream attachments.
*/
FT_EXPORT( FT_Error )
FT_Attach_Stream( FT_Face face,
FT_Open_Args* parameters );
FT_Attach_Stream( FT_Face face,
const FT_Open_Args* parameters );


/**************************************************************************
Expand Down
18 changes: 13 additions & 5 deletions freetype/include/freetype/ftcolor.h
Original file line number Diff line number Diff line change
Expand Up @@ -521,9 +521,10 @@ FT_BEGIN_HEADER
*
* @description:
* This iterator object is needed for @FT_Get_Colorline_Stops. It keeps
* state while iterating over the stops of an @FT_ColorLine,
* representing the `ColorLine` struct of the v1 extensions to 'COLR',
* see 'https://github.com/googlefonts/colr-gradients-spec'.
* state while iterating over the stops of an @FT_ColorLine, representing
* the `ColorLine` struct of the v1 extensions to 'COLR', see
* 'https://github.com/googlefonts/colr-gradients-spec'. Do not manually
* modify fields of this iterator.
*
* @fields:
* num_color_stops ::
Expand All @@ -537,6 +538,10 @@ FT_BEGIN_HEADER
* An opaque pointer into 'COLR' table data. Set by @FT_Get_Paint.
* Updated by @FT_Get_Colorline_Stops.
*
* read_variable ::
* A boolean keeping track of whether variable color lines are to be
* read. Set by @FT_Get_Paint.
*
* @since:
* 2.11 -- **currently experimental only!** There might be changes
* without retaining backward compatibility of both the API and ABI.
Expand All @@ -549,6 +554,8 @@ FT_BEGIN_HEADER

FT_Byte* p;

FT_Bool read_variable;

} FT_ColorStopIterator;


Expand Down Expand Up @@ -592,7 +599,8 @@ FT_BEGIN_HEADER
*
* @fields:
* stop_offset ::
* The stop offset between 0 and 1 along the gradient.
* The stop offset along the gradient, expressed as a 16.16 fixed-point
* coordinate.
*
* color ::
* The color information for this stop, see @FT_ColorIndex.
Expand All @@ -604,7 +612,7 @@ FT_BEGIN_HEADER
*/
typedef struct FT_ColorStop_
{
FT_F2Dot14 stop_offset;
FT_Fixed stop_offset;
FT_ColorIndex color;

} FT_ColorStop;
Expand Down
48 changes: 45 additions & 3 deletions freetype/include/freetype/ftdriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ FT_BEGIN_HEADER
* itself, it is possible to control its behaviour with @FT_Property_Set
* and @FT_Property_Get.
*
* The TrueType driver's module name is 'truetype'; a single property
* @interpreter-version is available, as documented in the @properties
* section.
* The TrueType driver's module name is 'truetype'; two properties are
* available, @interpreter-version and @TEMPORARY-enable-variable-colrv1, as
* documented in the @properties section.
*
* To help understand the differences between interpreter versions, we
* introduce a list of definitions, kindly provided by Greg Hitchcock.
Expand Down Expand Up @@ -820,6 +820,48 @@ FT_BEGIN_HEADER
* 2.5
*/

/**************************************************************************
*
* @property:
* TEMPORARY-enable-variable-colrv1
*
* @description:
* Controls experimental support of variable COLRv1 and whether the COLRv1
* implementation should take into account variation deltas. This tells the
* COLRv1 API methods whether they should read from the font and apply
* variable deltas to COLRv1 properties. The feature is default off. When
* on, variable COLRv1 deltas are applied for COLRv1 features for which they
* are already implemented. When off, variable deltas are ignored even if
* the respective PaintVar* table may already be understood.
*
* WARNING: Temporary flag during development of variable COLRv1. This flag
* will be removed, do not rely on it. Full variable COLRv1 support will be
* announced separately.
*
* @note:
* This property cannot be set via the `FREETYPE_PROPERTIES` environment
* variable.
*
* @example:
* The following example code demonstrates how to enable variable
* COLRv1.
*
* ```
* FT_Library library;
* FT_Face face;
* FT_Bool variable_colrv1 = TRUE;
*
*
* FT_Init_FreeType( &library );
*
* FT_Property_Set( library, "truetype",
* "TEMPORARY-enable-variable-colrv1",
* &variable_colr_v1 );
* ```
*
* @since:
* 2.12.2
*/

/**************************************************************************
*
Expand Down
6 changes: 3 additions & 3 deletions freetype/include/freetype/ftglyph.h
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ FT_BEGIN_HEADER
*
* @output:
* aglyph ::
* A handle to the glyph object.
* A handle to the glyph object. `NULL` in case of error.
*
* @return:
* FreeType error code. 0~means success.
Expand Down Expand Up @@ -385,7 +385,7 @@ FT_BEGIN_HEADER
*
* @output:
* target ::
* A handle to the target glyph object. 0~in case of error.
* A handle to the target glyph object. `NULL` in case of error.
*
* @return:
* FreeType error code. 0~means success.
Expand Down Expand Up @@ -671,7 +671,7 @@ FT_BEGIN_HEADER
*
* @input:
* glyph ::
* A handle to the target glyph object.
* A handle to the target glyph object. Can be `NULL`.
*/
FT_EXPORT( void )
FT_Done_Glyph( FT_Glyph glyph );
Expand Down
17 changes: 13 additions & 4 deletions freetype/include/freetype/ftmm.h
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,10 @@ FT_BEGIN_HEADER
* FreeType error code. 0~means success.
*
* @note:
* The design coordinates are 16.16 fractional values for TrueType GX and
* OpenType variation fonts. For Adobe MM fonts, the values are
* integers.
*
* [Since 2.8.1] To reset all axes to the default values, call the
* function with `num_coords` set to zero and `coords` set to `NULL`.
* [Since 2.9] 'Default values' means the currently selected named
Expand Down Expand Up @@ -440,6 +444,11 @@ FT_BEGIN_HEADER
* @return:
* FreeType error code. 0~means success.
*
* @note:
* The design coordinates are 16.16 fractional values for TrueType GX and
* OpenType variation fonts. For Adobe MM fonts, the values are
* integers.
*
* @since:
* 2.7.1
*/
Expand Down Expand Up @@ -471,9 +480,9 @@ FT_BEGIN_HEADER
* the number of axes, use default values for the remaining axes.
*
* coords ::
* The design coordinates array (each element must be between 0 and 1.0
* for Adobe MM fonts, and between -1.0 and 1.0 for TrueType GX and
* OpenType variation fonts).
* The design coordinates array. Each element is a 16.16 fractional
* value and must be between 0 and 1.0 for Adobe MM fonts, and between
* -1.0 and 1.0 for TrueType GX and OpenType variation fonts.
*
* @return:
* FreeType error code. 0~means success.
Expand Down Expand Up @@ -518,7 +527,7 @@ FT_BEGIN_HEADER
*
* @output:
* coords ::
* The normalized blend coordinates array.
* The normalized blend coordinates array (as 16.16 fractional values).
*
* @return:
* FreeType error code. 0~means success.
Expand Down
2 changes: 1 addition & 1 deletion freetype/include/freetype/ftstroke.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ FT_BEGIN_HEADER
*
* miter_limit ::
* The maximum reciprocal sine of half-angle at the miter join,
* expressed as 16.16 fixed point value.
* expressed as 16.16 fixed-point value.
*
* @note:
* The `radius` is expressed in the same units as the outline
Expand Down
12 changes: 9 additions & 3 deletions freetype/include/freetype/ftsystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ FT_BEGIN_HEADER
* A handle to the source stream.
*
* offset ::
* The offset of read in stream (always from start).
* The offset from the start of the stream to seek to if this is a seek
* operation (see note).
*
* buffer ::
* The address of the read buffer.
Expand All @@ -241,8 +242,13 @@ FT_BEGIN_HEADER
* The number of bytes effectively read by the stream.
*
* @note:
* This function might be called to perform a seek or skip operation with
* a `count` of~0. A non-zero return value then indicates an error.
* 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.
*
*/
typedef unsigned long
Expand Down
2 changes: 1 addition & 1 deletion freetype/include/freetype/internal/cfftypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ FT_BEGIN_HEADER
/* The normal stack then points to these values instead of the DICT */
/* because all other operators in Private DICT clear the stack. */
/* `blend_stack' could be cleared at each operator other than blend. */
/* Blended values are stored as 5-byte fixed point values. */
/* Blended values are stored as 5-byte fixed-point values. */

FT_Byte* blend_stack; /* base of stack allocation */
FT_Byte* blend_top; /* first empty slot */
Expand Down
34 changes: 34 additions & 0 deletions freetype/include/freetype/internal/ftcalc.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,40 @@ FT_BEGIN_HEADER
FT_Long c );


/**************************************************************************
*
* @function:
* FT_MulAddFix
*
* @description:
* Compute `(s[0] * f[0] + s[1] * f[1] + ...) / 0x10000`, where `s[n]` is
* usually a 16.16 scalar.
*
* @input:
* s ::
* The array of scalars.
* f ::
* The array of factors.
* count ::
* The number of entries in the array.
*
* @return:
* The result of `(s[0] * f[0] + s[1] * f[1] + ...) / 0x10000`.
*
* @note:
* This function is currently used for the scaled delta computation of
* variation stores. It internally uses 64-bit data types when
* available, otherwise it emulates 64-bit math by using 32-bit
* operations, which produce a correct result but most likely at a slower
* performance in comparison to the implementation base on `int64_t`.
*
*/
FT_BASE( FT_Int32 )
FT_MulAddFix( FT_Fixed* s,
FT_Int32* f,
FT_UInt count );


/*
* A variant of FT_Matrix_Multiply which scales its result afterwards. The
* idea is that both `a' and `b' are scaled by factors of 10 so that the
Expand Down
85 changes: 85 additions & 0 deletions freetype/include/freetype/internal/ftmmtypes.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/****************************************************************************
*
* ftmmtypes.h
*
* OpenType Variations type definitions for internal use
* with the multi-masters service (specification).
*
* Copyright (C) 2022 by
* David Turner, Robert Wilhelm, Werner Lemberg, George Williams, and
* Dominik Röttsches.
*
* 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 FTMMTYPES_H_
#define FTMMTYPES_H_

FT_BEGIN_HEADER


typedef FT_Int32 FT_ItemVarDelta;

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 */

} GX_ItemVarDataRec, *GX_ItemVarData;


/* contribution of one axis to a region */
typedef struct GX_AxisCoordsRec_
{
FT_Fixed startCoord;
FT_Fixed peakCoord; /* zero means no effect (factor = 1) */
FT_Fixed endCoord;

} GX_AxisCoordsRec, *GX_AxisCoords;


typedef struct GX_VarRegionRec_
{
GX_AxisCoords axisList; /* array of axisCount records */

} GX_VarRegionRec, *GX_VarRegion;


/* item variation store */
typedef struct GX_ItemVarStoreRec_
{
FT_UInt dataCount;
GX_ItemVarData varData; /* array of dataCount records; */
/* use `outerIndex' for this array */
FT_UShort axisCount;
FT_UInt regionCount; /* total number of regions defined */
GX_VarRegion varRegionList;

} GX_ItemVarStoreRec, *GX_ItemVarStore;


typedef struct GX_DeltaSetIdxMapRec_
{
FT_ULong mapCount;
FT_UInt* outerIndex; /* indices to item var data */
FT_UInt* innerIndex; /* indices to delta set */

} GX_DeltaSetIdxMapRec, *GX_DeltaSetIdxMap;


FT_END_HEADER

#endif /* FTMMTYPES_H_ */


/* END */
Loading

0 comments on commit d2eb350

Please sign in to comment.