FreeType: Update to version 2.12.1

(cherry picked from commit 93fba7ead3)
This commit is contained in:
bruvzg 2022-05-17 18:14:19 +03:00 committed by Rémi Verschelde
parent abeb84ad33
commit 98c7db745b
447 changed files with 19914 additions and 5526 deletions

View file

@ -188,7 +188,7 @@ License: Expat and Bitstream Vera Fonts Copyright
Files: ./thirdparty/freetype/
Comment: The FreeType Project
Copyright: 1996-2021, David Turner, Robert Wilhelm, and Werner Lemberg.
Copyright: 1996-2022, David Turner, Robert Wilhelm, and Werner Lemberg.
License: FTL
Files: ./thirdparty/glad/

View file

@ -51,6 +51,7 @@ if env["builtin_freetype"]:
"src/psnames/psnames.c",
"src/raster/raster.c",
"src/sdf/sdf.c",
"src/svg/svg.c",
"src/smooth/smooth.c",
"src/truetype/truetype.c",
"src/type1/type1.c",
@ -86,7 +87,7 @@ if env["builtin_freetype"]:
# Also needed in main env for scene/
env.Prepend(CPPPATH=[thirdparty_dir + "/include"])
env_freetype.Append(CPPDEFINES=["FT2_BUILD_LIBRARY", "FT_CONFIG_OPTION_USE_PNG"])
env_freetype.Append(CPPDEFINES=["FT2_BUILD_LIBRARY", "FT_CONFIG_OPTION_USE_PNG", "FT_CONFIG_OPTION_SYSTEM_ZLIB"])
if env["target"] == "debug":
env_freetype.Append(CPPDEFINES=["ZLIB_DEBUG"])

View file

@ -131,13 +131,14 @@ comments.
## freetype
- Upstream: https://www.freetype.org
- Version: 2.11.1 (3f83daeecb1a78d851b660eed025eeba362c0e4a, 2021)
- Version: 2.12.1 (e8ebfe988b5f57bfb9a3ecb13c70d9791bce9ecf, 2022)
- License: FreeType License (BSD-like)
Files extracted from upstream source:
- the `src/` folder, minus the `.mk` files and the `dlg` and `tools` subfolders
- the `include/` folder, minus the `dlg` subfolder
- `src/` folder, minus the `dlg` and `tools` subfolders
* These files can be removed: `.dat`, `.diff`, `.mk`, `.rc`, `README*`
- `include/` folder, minus the `dlg` subfolder
- `LICENSE.TXT` and `docs/FTL.TXT`

View file

@ -4,7 +4,7 @@
*
* ANSI-specific configuration file (specification only).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* Build macros of the FreeType 2 library.
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@ -777,6 +777,18 @@
#define FT_COLOR_H <freetype/ftcolor.h>
/**************************************************************************
*
* @macro:
* FT_OTSVG_H
*
* @description:
* A macro used in `#include` statements to name the file containing the
* FreeType~2 API which handles the OpenType 'SVG~' glyphs.
*/
#define FT_OTSVG_H <freetype/otsvg.h>
/* */
/* These header files don't need to be included by the user. */

View file

@ -28,5 +28,6 @@ FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class )
FT_USE_MODULE( FT_Renderer_Class, ft_raster1_renderer_class )
FT_USE_MODULE( FT_Renderer_Class, ft_sdf_renderer_class )
FT_USE_MODULE( FT_Renderer_Class, ft_bitmap_sdf_renderer_class )
FT_USE_MODULE( FT_Renderer_Class, ft_svg_renderer_class )
/* EOF */

View file

@ -4,7 +4,7 @@
*
* User-selectable configuration macros (specification only).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@ -219,6 +219,10 @@ FT_BEGIN_HEADER
* If you use a build system like cmake or the `configure` script,
* options set by those programs have precedence, overwriting the value
* here with the configured one.
*
* If you use the GNU make build system directly (that is, without the
* `configure` script) and you define this macro, you also have to pass
* `SYSTEM_ZLIB=yes` as an argument to make.
*/
/* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */
@ -523,6 +527,20 @@ FT_BEGIN_HEADER
#undef FT_CONFIG_OPTION_USE_MODULE_ERRORS
/**************************************************************************
*
* OpenType SVG Glyph Support
*
* Setting this macro enables support for OpenType SVG glyphs. By
* default, FreeType can only fetch SVG documents. However, it can also
* render them if external rendering hook functions are plugged in at
* runtime.
*
* More details on the hooks can be found in file `otsvg.h`.
*/
#define FT_CONFIG_OPTION_SVG
/**************************************************************************
*
* Error Strings
@ -1002,8 +1020,8 @@ FT_BEGIN_HEADER
#error "Invalid CFF darkening parameters!"
#endif
FT_END_HEADER
FT_END_HEADER
#endif /* FTOPTION_H_ */

View file

@ -5,7 +5,7 @@
* ANSI-specific library and header configuration file (specification
* only).
*
* Copyright (C) 2002-2021 by
* Copyright (C) 2002-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* FreeType integer types definitions.
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@ -221,9 +221,10 @@
#define FT_INT64 __int64
#define FT_UINT64 unsigned __int64
#elif defined( __WATCOMC__ ) /* Watcom C++ */
#elif defined( __WATCOMC__ ) && __WATCOMC__ >= 1100 /* Watcom C++ */
/* Watcom doesn't provide 64-bit data types */
#define FT_INT64 long long int
#define FT_UINT64 unsigned long long int
#elif defined( __MWERKS__ ) /* Metrowerks CodeWarrior */

View file

@ -4,7 +4,7 @@
*
* Mac/OS X support configuration header.
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* Define a set of compiler macros used in public FreeType headers.
*
* Copyright (C) 2020-2021 by
* Copyright (C) 2020-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* FreeType high-level API and common types (specification only).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@ -153,6 +153,9 @@ FT_BEGIN_HEADER
* 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
*
* FT_HAS_HORIZONTAL
* FT_HAS_VERTICAL
@ -161,6 +164,9 @@ FT_BEGIN_HEADER
* FT_HAS_GLYPH_NAMES
* FT_HAS_COLOR
* FT_HAS_MULTIPLE_MASTERS
* FT_HAS_SVG
* FT_HAS_SBIX
* FT_HAS_SBIX_OVERLAY
*
* FT_IS_SFNT
* FT_IS_SCALABLE
@ -225,6 +231,7 @@ FT_BEGIN_HEADER
* FT_LOAD_NO_SCALE
* FT_LOAD_NO_HINTING
* FT_LOAD_NO_BITMAP
* FT_LOAD_SBITS_ONLY
* FT_LOAD_NO_AUTOHINT
* FT_LOAD_COLOR
*
@ -522,13 +529,15 @@ FT_BEGIN_HEADER
* size.
*
* @note:
* An @FT_Face has one _active_ @FT_Size object that is used by functions
* like @FT_Load_Glyph to determine the scaling transformation that in
* turn is used to load and hint glyphs and metrics.
* An @FT_Face has one _active_ `FT_Size` object that is used by
* functions like @FT_Load_Glyph to determine the scaling transformation
* that in turn is used to load and hint glyphs and metrics.
*
* You can use @FT_Set_Char_Size, @FT_Set_Pixel_Sizes, @FT_Request_Size
* A newly created `FT_Size` object contains only meaningless zero values.
* You must use @FT_Set_Char_Size, @FT_Set_Pixel_Sizes, @FT_Request_Size
* or even @FT_Select_Size to change the content (i.e., the scaling
* values) of the active @FT_Size.
* values) of the active `FT_Size`. Otherwise, the scaling and hinting
* will not be performed.
*
* You can use @FT_New_Size to create additional size objects for a given
* @FT_Face, but they won't be used by other functions until you activate
@ -1228,6 +1237,19 @@ FT_BEGIN_HEADER
* 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_FACE_FLAG_SVG ::
* [Since 2.12] The face has an 'SVG~' OpenType table.
*
* FT_FACE_FLAG_SBIX ::
* [Since 2.12] The face has an 'sbix' OpenType table *and* outlines.
* For such fonts, @FT_FACE_FLAG_SCALABLE is not set by default to
* retain backward compatibility.
*
* FT_FACE_FLAG_SBIX_OVERLAY ::
* [Since 2.12] The face has an 'sbix' OpenType table where outlines
* should be drawn on top of bitmap strikes.
*
*/
#define FT_FACE_FLAG_SCALABLE ( 1L << 0 )
#define FT_FACE_FLAG_FIXED_SIZES ( 1L << 1 )
@ -1245,6 +1267,9 @@ FT_BEGIN_HEADER
#define FT_FACE_FLAG_TRICKY ( 1L << 13 )
#define FT_FACE_FLAG_COLOR ( 1L << 14 )
#define FT_FACE_FLAG_VARIATION ( 1L << 15 )
#define FT_FACE_FLAG_SVG ( 1L << 16 )
#define FT_FACE_FLAG_SBIX ( 1L << 17 )
#define FT_FACE_FLAG_SBIX_OVERLAY ( 1L << 18 )
/**************************************************************************
@ -1485,6 +1510,124 @@ FT_BEGIN_HEADER
( !!( (face)->face_flags & FT_FACE_FLAG_COLOR ) )
/**************************************************************************
*
* @macro:
* FT_HAS_SVG
*
* @description:
* A macro that returns true whenever a face object contains an 'SVG~'
* OpenType table.
*
* @since:
* 2.12
*/
#define FT_HAS_SVG( face ) \
( !!( (face)->face_flags & FT_FACE_FLAG_SVG ) )
/**************************************************************************
*
* @macro:
* FT_HAS_SBIX
*
* @description:
* A macro that returns true whenever a face object contains an 'sbix'
* OpenType table *and* outline glyphs.
*
* Currently, FreeType only supports bitmap glyphs in PNG format for this
* table (i.e., JPEG and TIFF formats are unsupported, as are
* Apple-specific formats not part of the OpenType specification).
*
* @note:
* For backward compatibility, a font with an 'sbix' table is treated as
* a bitmap-only face. Using @FT_Open_Face with
* @FT_PARAM_TAG_IGNORE_SBIX, an application can switch off 'sbix'
* handling so that the face is treated as an ordinary outline font with
* scalable outlines.
*
* Here is some pseudo code that roughly illustrates how to implement
* 'sbix' handling according to the OpenType specification.
*
* ```
* if ( FT_HAS_SBIX( face ) )
* {
* // open font as a scalable one without sbix handling
* FT_Face face2;
* FT_Parameter param = { FT_PARAM_TAG_IGNORE_SBIX, NULL };
* FT_Open_Args args = { FT_OPEN_PARAMS | ...,
* ...,
* 1, &param };
*
*
* FT_Open_Face( library, &args, 0, &face2 );
*
* <sort `face->available_size` as necessary into
* `preferred_sizes`[*]>
*
* for ( i = 0; i < face->num_fixed_sizes; i++ )
* {
* size = preferred_sizes[i].size;
*
* error = FT_Set_Pixel_Sizes( face, size, size );
* <error handling omitted>
*
* // check whether we have a glyph in a bitmap strike
* error = FT_Load_Glyph( face,
* glyph_index,
* FT_LOAD_SBITS_ONLY |
* FT_LOAD_BITMAP_METRICS_ONLY );
* if ( error == FT_Err_Invalid_Argument )
* continue;
* else if ( error )
* <other error handling omitted>
* else
* break;
* }
*
* if ( i != face->num_fixed_sizes )
* <load embedded bitmap with `FT_Load_Glyph`,
* scale it, display it, etc.>
*
* if ( i == face->num_fixed_sizes ||
* FT_HAS_SBIX_OVERLAY( face ) )
* <use `face2` to load outline glyph with `FT_Load_Glyph`,
* scale it, display it on top of the bitmap, etc.>
* }
* ```
*
* [*] Assuming a target value of 400dpi and available strike sizes 100,
* 200, 300, and 400dpi, a possible order might be [400, 200, 300, 100]:
* scaling 200dpi to 400dpi usually gives better results than scaling
* 300dpi to 400dpi; it is also much faster. However, scaling 100dpi to
* 400dpi can yield a too pixelated result, thus the preference might be
* 300dpi over 100dpi.
*
* @since:
* 2.12
*/
#define FT_HAS_SBIX( face ) \
( !!( (face)->face_flags & FT_FACE_FLAG_SBIX ) )
/**************************************************************************
*
* @macro:
* FT_HAS_SBIX_OVERLAY
*
* @description:
* A macro that returns true whenever a face object contains an 'sbix'
* OpenType table with bit~1 in its `flags` field set, instructing the
* application to overlay the bitmap strike with the corresponding
* outline glyph. See @FT_HAS_SBIX for pseudo code how to use it.
*
* @since:
* 2.12
*/
#define FT_HAS_SBIX_OVERLAY( face ) \
( !!( (face)->face_flags & FT_FACE_FLAG_SBIX_OVERLAY ) )
/**************************************************************************
*
* @enum:
@ -2702,8 +2845,8 @@ FT_BEGIN_HEADER
* 'https://www.freetype.org/freetype2/docs/glyphs/glyphs-2.html'.
*
* Contrary to @FT_Set_Char_Size, this function doesn't have special code
* to normalize zero-valued widths, heights, or resolutions (which lead
* to errors in most cases).
* to normalize zero-valued widths, heights, or resolutions, which are
* treated as @FT_LOAD_NO_SCALE.
*
* Don't use this function if you are using the FreeType cache API.
*/
@ -2819,7 +2962,7 @@ FT_BEGIN_HEADER
*
* load_flags ::
* A flag indicating what to load for this glyph. The @FT_LOAD_XXX
* constants can be used to control the glyph loading process (e.g.,
* flags can be used to control the glyph loading process (e.g.,
* whether the outline should be scaled, whether to load bitmaps or
* not, whether to hint the outline, etc).
*
@ -2827,8 +2970,10 @@ FT_BEGIN_HEADER
* FreeType error code. 0~means success.
*
* @note:
* The loaded glyph may be transformed. See @FT_Set_Transform for the
* details.
* For proper scaling and hinting, the active @FT_Size object owned by
* the face has to be meaningfully initialized by calling
* @FT_Set_Char_Size before this function, for example. The loaded
* 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
@ -2918,6 +3063,8 @@ FT_BEGIN_HEADER
*
* FT_LOAD_NO_SCALE ::
* Don't scale the loaded outline glyph but keep it in font units.
* This flag is also assumed if @FT_Size owned by the face was not
* properly initialized.
*
* This flag implies @FT_LOAD_NO_HINTING and @FT_LOAD_NO_BITMAP, and
* unsets @FT_LOAD_RENDER.
@ -2948,6 +3095,15 @@ FT_BEGIN_HEADER
*
* @FT_LOAD_NO_SCALE always sets this flag.
*
* FT_LOAD_SBITS_ONLY ::
* [Since 2.12] This is the opposite of @FT_LOAD_NO_BITMAP, more or
* less: @FT_Load_Glyph returns `FT_Err_Invalid_Argument` if the face
* contains a bitmap strike for the given size (or the strike selected
* by @FT_Select_Size) but there is no glyph in the strike.
*
* Note that this load flag was part of FreeType since version 2.0.6
* but previously tagged as internal.
*
* FT_LOAD_VERTICAL_LAYOUT ::
* Load the glyph for vertical text layout. In particular, the
* `advance` value in the @FT_GlyphSlotRec structure is set to the
@ -3004,21 +3160,31 @@ FT_BEGIN_HEADER
* Disable the auto-hinter. See also the note below.
*
* FT_LOAD_COLOR ::
* Load colored glyphs. There are slight differences depending on the
* font format.
* Load colored glyphs. FreeType searches in the following order;
* there are slight differences depending on the font format.
*
* [Since 2.5] Load embedded color bitmap images. The resulting color
* bitmaps, if available, will have the @FT_PIXEL_MODE_BGRA format,
* with pre-multiplied color channels. If the flag is not set and
* color bitmaps are found, they are converted to 256-level gray
* bitmaps, using the @FT_PIXEL_MODE_GRAY format.
* [Since 2.5] Load embedded color bitmap images (provided
* @FT_LOAD_NO_BITMAP is not set). The resulting color bitmaps, if
* available, have the @FT_PIXEL_MODE_BGRA format, with pre-multiplied
* color channels. If the flag is not set and color bitmaps are found,
* they are converted to 256-level gray bitmaps, using the
* @FT_PIXEL_MODE_GRAY format.
*
* [Since 2.10, experimental] If the glyph index contains an entry in
* [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.
*
* [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
* the OpenType specification), make @FT_Render_Glyph provide a default
* blending of the color glyph layers associated with the glyph index,
* using the same bitmap format as embedded color bitmap images. This
* is mainly for convenience; for full control of color layers use
* is mainly for convenience and works only for glyphs in 'COLR' v0
* tables (or glyphs in 'COLR' v1 tables that exclusively use v0
* features). For full control of color layers use
* @FT_Get_Color_Glyph_Layer and FreeType's color functions like
* @FT_Palette_Select instead of setting @FT_LOAD_COLOR for rendering
* so that the client application can handle blending by itself.
@ -3069,19 +3235,20 @@ FT_BEGIN_HEADER
*
*/
#define FT_LOAD_DEFAULT 0x0
#define FT_LOAD_NO_SCALE ( 1L << 0 )
#define FT_LOAD_NO_HINTING ( 1L << 1 )
#define FT_LOAD_RENDER ( 1L << 2 )
#define FT_LOAD_NO_BITMAP ( 1L << 3 )
#define FT_LOAD_VERTICAL_LAYOUT ( 1L << 4 )
#define FT_LOAD_FORCE_AUTOHINT ( 1L << 5 )
#define FT_LOAD_CROP_BITMAP ( 1L << 6 )
#define FT_LOAD_PEDANTIC ( 1L << 7 )
#define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ( 1L << 9 )
#define FT_LOAD_NO_SCALE ( 1L << 0 )
#define FT_LOAD_NO_HINTING ( 1L << 1 )
#define FT_LOAD_RENDER ( 1L << 2 )
#define FT_LOAD_NO_BITMAP ( 1L << 3 )
#define FT_LOAD_VERTICAL_LAYOUT ( 1L << 4 )
#define FT_LOAD_FORCE_AUTOHINT ( 1L << 5 )
#define FT_LOAD_CROP_BITMAP ( 1L << 6 )
#define FT_LOAD_PEDANTIC ( 1L << 7 )
#define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ( 1L << 9 )
#define FT_LOAD_NO_RECURSE ( 1L << 10 )
#define FT_LOAD_IGNORE_TRANSFORM ( 1L << 11 )
#define FT_LOAD_MONOCHROME ( 1L << 12 )
#define FT_LOAD_LINEAR_DESIGN ( 1L << 13 )
#define FT_LOAD_SBITS_ONLY ( 1L << 14 )
#define FT_LOAD_NO_AUTOHINT ( 1L << 15 )
/* Bits 16-19 are used by `FT_LOAD_TARGET_` */
#define FT_LOAD_COLOR ( 1L << 20 )
@ -3091,8 +3258,8 @@ FT_BEGIN_HEADER
/* */
/* used internally only by certain font drivers */
#define FT_LOAD_ADVANCE_ONLY ( 1L << 8 )
#define FT_LOAD_SBITS_ONLY ( 1L << 14 )
#define FT_LOAD_ADVANCE_ONLY ( 1L << 8 )
#define FT_LOAD_SVG_ONLY ( 1L << 23 )
/**************************************************************************
@ -3370,6 +3537,44 @@ FT_BEGIN_HEADER
* }
*
* ```
*
* FreeType has two rasterizers for generating SDF, namely:
*
* 1. `sdf` for generating SDF directly from glyph's outline, and
*
* 2. `bsdf` for generating SDF from rasterized bitmaps.
*
* Depending on the glyph type (i.e., outline or bitmap), one of the two
* rasterizers is chosen at runtime and used for generating SDFs. To
* force the use of `bsdf` you should render the glyph with any of the
* FreeType's other rendering modes (e.g., `FT_RENDER_MODE_NORMAL`) and
* then re-render with `FT_RENDER_MODE_SDF`.
*
* There are some issues with stability and possible failures of the SDF
* renderers (specifically `sdf`).
*
* 1. The `sdf` rasterizer is sensitive to really small features (e.g.,
* sharp turns that are less than 1~pixel) and imperfections in the
* glyph's outline, causing artifacts in the final output.
*
* 2. The `sdf` rasterizer has limited support for handling intersecting
* contours and *cannot* handle self-intersecting contours whatsoever.
* Self-intersection happens when a single connected contour intersect
* itself at some point; having these in your font definitely pose a
* problem to the rasterizer and cause artifacts, too.
*
* 3. Generating SDF for really small glyphs may result in undesirable
* output; the pixel grid (which stores distance information) becomes
* too coarse.
*
* 4. Since the output buffer is normalized, precision at smaller spreads
* is greater than precision at larger spread values because the
* output range of [0..255] gets mapped to a smaller SDF range. A
* spread of~2 should be sufficient in most cases.
*
* Points (1) and (2) can be avoided by using the `bsdf` rasterizer,
* which is more stable than the `sdf` rasterizer in general.
*
*/
typedef enum FT_Render_Mode_
{
@ -3410,7 +3615,7 @@ FT_BEGIN_HEADER
* @FT_Render_Mode for a list of possible values.
*
* If @FT_RENDER_MODE_NORMAL is used, a previous call of @FT_Load_Glyph
* with flag @FT_LOAD_COLOR makes FT_Render_Glyph provide a default
* with flag @FT_LOAD_COLOR makes `FT_Render_Glyph` provide a default
* blending of colored glyph layers associated with the current glyph
* slot (provided the font contains such layers) instead of rendering
* the glyph slot's outline. This is an experimental feature; see
@ -3420,9 +3625,6 @@ FT_BEGIN_HEADER
* FreeType error code. 0~means success.
*
* @note:
* To get meaningful results, font scaling values must be set with
* functions like @FT_Set_Char_Size before calling `FT_Render_Glyph`.
*
* When FreeType outputs a bitmap of a glyph, it really outputs an alpha
* coverage map. If a pixel is completely covered by a filled-in
* outline, the bitmap contains 0xFF at that pixel, meaning that
@ -4739,7 +4941,7 @@ FT_BEGIN_HEADER
*
*/
#define FREETYPE_MAJOR 2
#define FREETYPE_MINOR 11
#define FREETYPE_MINOR 12
#define FREETYPE_PATCH 1

View file

@ -4,7 +4,7 @@
*
* Quick computation of advance widths (specification only).
*
* Copyright (C) 2008-2021 by
* Copyright (C) 2008-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* FreeType exact bbox computation (specification).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* FreeType API for accessing BDF-specific strings (specification).
*
* Copyright (C) 2002-2021 by
* Copyright (C) 2002-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* FreeType utility functions for bitmaps (specification).
*
* Copyright (C) 2004-2021 by
* Copyright (C) 2004-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* Bzip2-compressed stream support.
*
* Copyright (C) 2010-2021 by
* Copyright (C) 2010-2022 by
* Joel Klinghed.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* FreeType Cache subsystem (specification).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -62,6 +62,7 @@
* cid_fonts
* pfr_fonts
* winfnt_fonts
* svg_fonts
* font_formats
* gasp_table
*
@ -82,6 +83,7 @@
* t1_cid_driver
* tt_driver
* pcf_driver
* ot_svg_driver
* properties
* parameter_tags
* lcd_rendering

View file

@ -4,7 +4,7 @@
*
* FreeType API for accessing CID font information (specification).
*
* Copyright (C) 2007-2021 by
* Copyright (C) 2007-2022 by
* Dereg Clegg and Michael Toftdal.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* FreeType's glyph color management (specification).
*
* Copyright (C) 2018-2021 by
* Copyright (C) 2018-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@ -528,14 +528,14 @@ FT_BEGIN_HEADER
* @fields:
* num_color_stops ::
* The number of color stops for the requested glyph index. Set by
* @FT_Get_Colorline_Stops.
* @FT_Get_Paint.
*
* current_color_stop ::
* The current color stop. Set by @FT_Get_Colorline_Stops.
*
* p ::
* An opaque pointer into 'COLR' table data. The caller must set this
* to `NULL` before the first call of @FT_Get_Colorline_Stops.
* An opaque pointer into 'COLR' table data. Set by @FT_Get_Paint.
* Updated by @FT_Get_Colorline_Stops.
*
* @since:
* 2.11 -- **currently experimental only!** There might be changes

View file

@ -4,7 +4,7 @@
*
* FreeType API for controlling driver modules (specification only).
*
* Copyright (C) 2017-2021 by
* Copyright (C) 2017-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@ -212,16 +212,14 @@ FT_BEGIN_HEADER
* @description:
* While FreeType's TrueType driver doesn't expose API functions by
* itself, it is possible to control its behaviour with @FT_Property_Set
* and @FT_Property_Get. The following lists the available properties
* together with the necessary macros and structures.
* and @FT_Property_Get.
*
* The TrueType driver's module name is 'truetype'.
* The TrueType driver's module name is 'truetype'; a single property
* @interpreter-version is available, as documented in the @properties
* section.
*
* A single property @interpreter-version is available, as documented in
* the @properties section.
*
* We start with a list of definitions, kindly provided by Greg
* Hitchcock.
* To help understand the differences between interpreter versions, we
* introduce a list of definitions, kindly provided by Greg Hitchcock.
*
* _Bi-Level Rendering_
*
@ -300,6 +298,31 @@ FT_BEGIN_HEADER
*/
/**************************************************************************
*
* @section:
* ot_svg_driver
*
* @title:
* The SVG driver
*
* @abstract:
* Controlling the external rendering of OT-SVG glyphs.
*
* @description:
* By default, FreeType can only load the 'SVG~' table of OpenType fonts
* if configuration macro `FT_CONFIG_OPTION_SVG` is defined. To make it
* render SVG glyphs, an external SVG rendering library is needed. All
* details on the interface between FreeType and the external library
* via function hooks can be found in section @svg_fonts.
*
* The OT-SVG driver's module name is 'ot-svg'; it supports a single
* property called @svg-hooks, documented below in the @properties
* section.
*
*/
/**************************************************************************
*
* @section:
@ -798,6 +821,40 @@ FT_BEGIN_HEADER
*/
/**************************************************************************
*
* @property:
* svg-hooks
*
* @description:
* Set up the interface between FreeType and an extern SVG rendering
* library like 'librsvg'. All details on the function hooks can be
* found in section @svg_fonts.
*
* @example:
* The following example code expects that the four hook functions
* `svg_*` are defined elsewhere. Error handling is omitted, too.
*
* ```
* FT_Library library;
* SVG_RendererHooks hooks = {
* (SVG_Lib_Init_Func)svg_init,
* (SVG_Lib_Free_Func)svg_free,
* (SVG_Lib_Render_Func)svg_render,
* (SVG_Lib_Preset_Slot_Func)svg_preset_slot };
*
*
* FT_Init_FreeType( &library );
*
* FT_Property_Set( library, "ot-svg",
* "svg-hooks", &hooks );
* ```
*
* @since:
* 2.12
*/
/**************************************************************************
*
* @property:

View file

@ -4,7 +4,7 @@
*
* FreeType error codes (specification).
*
* Copyright (C) 2002-2021 by
* Copyright (C) 2002-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@ -101,6 +101,8 @@
"too many hints" )
FT_ERRORDEF_( Invalid_Pixel_Size, 0x17,
"invalid pixel size" )
FT_ERRORDEF_( Invalid_SVG_Document, 0x18,
"invalid SVG document" )
/* handle errors */
@ -234,6 +236,8 @@
"found FDEF or IDEF opcode in glyf bytecode" )
FT_ERRORDEF_( Missing_Bitmap, 0x9D,
"missing bitmap in strike" )
FT_ERRORDEF_( Missing_SVG_Hooks, 0x9E,
"SVG hooks have not been set" )
/* CFF, CID, and Type 1 errors */

View file

@ -4,7 +4,7 @@
*
* FreeType error code handling (specification).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* Support functions for font formats.
*
* Copyright (C) 2002-2021 by
* Copyright (C) 2002-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* Access of TrueType's 'gasp' table (specification).
*
* Copyright (C) 2007-2021 by
* Copyright (C) 2007-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* FreeType convenience functions to handle glyphs (specification).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@ -126,7 +126,7 @@ FT_BEGIN_HEADER
*
* @description:
* A handle to an object used to model a bitmap glyph image. This is a
* sub-class of @FT_Glyph, and a pointer to @FT_BitmapGlyphRec.
* 'sub-class' of @FT_Glyph, and a pointer to @FT_BitmapGlyphRec.
*/
typedef struct FT_BitmapGlyphRec_* FT_BitmapGlyph;
@ -142,7 +142,7 @@ FT_BEGIN_HEADER
*
* @fields:
* root ::
* The root @FT_Glyph fields.
* The root fields of @FT_Glyph.
*
* left ::
* The left-side bearing, i.e., the horizontal distance from the
@ -181,7 +181,7 @@ FT_BEGIN_HEADER
*
* @description:
* A handle to an object used to model an outline glyph image. This is a
* sub-class of @FT_Glyph, and a pointer to @FT_OutlineGlyphRec.
* 'sub-class' of @FT_Glyph, and a pointer to @FT_OutlineGlyphRec.
*/
typedef struct FT_OutlineGlyphRec_* FT_OutlineGlyph;
@ -222,6 +222,92 @@ FT_BEGIN_HEADER
} FT_OutlineGlyphRec;
/**************************************************************************
*
* @type:
* FT_SvgGlyph
*
* @description:
* A handle to an object used to model an SVG glyph. This is a
* 'sub-class' of @FT_Glyph, and a pointer to @FT_SvgGlyphRec.
*
* @since:
* 2.12
*/
typedef struct FT_SvgGlyphRec_* FT_SvgGlyph;
/**************************************************************************
*
* @struct:
* FT_SvgGlyphRec
*
* @description:
* A structure used for OT-SVG glyphs. This is a 'sub-class' of
* @FT_GlyphRec.
*
* @fields:
* root ::
* The root @FT_GlyphRec fields.
*
* svg_document ::
* A pointer to the SVG document.
*
* svg_document_length ::
* The length of `svg_document`.
*
* glyph_index ::
* The index of the glyph to be rendered.
*
* metrics ::
* A metrics object storing the size information.
*
* units_per_EM ::
* The size of the EM square.
*
* start_glyph_id ::
* The first glyph ID in the glyph range covered by this document.
*
* end_glyph_id ::
* The last glyph ID in the glyph range covered by this document.
*
* transform ::
* A 2x2 transformation matrix to apply to the glyph while rendering
* it.
*
* delta ::
* Translation to apply to the glyph while rendering.
*
* @note:
* The Glyph Management API requires @FT_Glyph or its 'sub-class' to have
* all the information needed to completely define the glyph's rendering.
* Outline-based glyphs can directly apply transformations to the outline
* but this is not possible for an SVG document that hasn't been parsed.
* Therefore, the transformation is stored along with the document. In
* the absence of a 'ViewBox' or 'Width'/'Height' attribute, the size of
* the ViewPort should be assumed to be 'units_per_EM'.
*/
typedef struct FT_SvgGlyphRec_
{
FT_GlyphRec root;
FT_Byte* svg_document;
FT_ULong svg_document_length;
FT_UInt glyph_index;
FT_Size_Metrics metrics;
FT_UShort units_per_EM;
FT_UShort start_glyph_id;
FT_UShort end_glyph_id;
FT_Matrix transform;
FT_Vector delta;
} FT_SvgGlyphRec;
/**************************************************************************
*
* @function:
@ -498,9 +584,9 @@ FT_BEGIN_HEADER
* The glyph image is translated with the `origin` vector before
* rendering.
*
* The first parameter is a pointer to an @FT_Glyph handle, that will be
* The first parameter is a pointer to an @FT_Glyph handle that will be
* _replaced_ by this function (with newly allocated data). Typically,
* you would use (omitting error handling):
* you would do something like the following (omitting error handling).
*
* ```
* FT_Glyph glyph;
@ -517,7 +603,7 @@ FT_BEGIN_HEADER
* if ( glyph->format != FT_GLYPH_FORMAT_BITMAP )
* {
* error = FT_Glyph_To_Bitmap( &glyph, FT_RENDER_MODE_NORMAL,
* 0, 1 );
* 0, 1 );
* if ( error ) // `glyph' unchanged
* ...
* }
@ -532,7 +618,7 @@ FT_BEGIN_HEADER
* FT_Done_Glyph( glyph );
* ```
*
* Here is another example, again without error handling:
* Here is another example, again without error handling.
*
* ```
* FT_Glyph glyphs[MAX_GLYPHS]

View file

@ -4,7 +4,7 @@
*
* FreeType API for validating TrueTypeGX/AAT tables (specification).
*
* Copyright (C) 2004-2021 by
* Copyright (C) 2004-2022 by
* Masatake YAMATO, Redhat K.K,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*

View file

@ -4,7 +4,7 @@
*
* Gzip-compressed stream support.
*
* Copyright (C) 2002-2021 by
* Copyright (C) 2002-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -5,7 +5,7 @@
* FreeType glyph image formats and default raster interface
* (specification).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@ -401,11 +401,11 @@ FT_BEGIN_HEADER
* information.
*
* FT_OUTLINE_OVERLAP ::
* This flag indicates that this outline contains overlapping contrours
* and the anti-aliased renderer should perform oversampling to
* mitigate possible artifacts. This flag should _not_ be set for
* well designed glyphs without overlaps because it quadruples the
* rendering time.
* [Since 2.10.3] This flag indicates that this outline contains
* overlapping contours and the anti-aliased renderer should perform
* oversampling to mitigate possible artifacts. This flag should _not_
* be set for well designed glyphs without overlaps because it quadruples
* the rendering time.
*
* FT_OUTLINE_HIGH_PRECISION ::
* This flag indicates that the scan-line converter should try to
@ -741,6 +741,10 @@ FT_BEGIN_HEADER
* contours. Some Type~1 fonts, like those in the Hershey family,
* contain glyphs in this format. These are described as @FT_Outline,
* but FreeType isn't currently capable of rendering them correctly.
*
* FT_GLYPH_FORMAT_SVG ::
* [Since 2.12] The glyph is represented by an SVG document in the
* 'SVG~' table.
*/
typedef enum FT_Glyph_Format_
{
@ -749,7 +753,8 @@ FT_BEGIN_HEADER
FT_IMAGE_TAG( FT_GLYPH_FORMAT_COMPOSITE, 'c', 'o', 'm', 'p' ),
FT_IMAGE_TAG( FT_GLYPH_FORMAT_BITMAP, 'b', 'i', 't', 's' ),
FT_IMAGE_TAG( FT_GLYPH_FORMAT_OUTLINE, 'o', 'u', 't', 'l' ),
FT_IMAGE_TAG( FT_GLYPH_FORMAT_PLOTTER, 'p', 'l', 'o', 't' )
FT_IMAGE_TAG( FT_GLYPH_FORMAT_PLOTTER, 'p', 'l', 'o', 't' ),
FT_IMAGE_TAG( FT_GLYPH_FORMAT_SVG, 'S', 'V', 'G', ' ' )
} FT_Glyph_Format;

View file

@ -4,7 +4,7 @@
*
* FreeType incremental loading (specification).
*
* Copyright (C) 2002-2021 by
* Copyright (C) 2002-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -5,7 +5,7 @@
* FreeType API for color filtering of subpixel bitmap glyphs
* (specification).
*
* Copyright (C) 2006-2021 by
* Copyright (C) 2006-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* Generic list support for FreeType (specification).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* Additional debugging APIs.
*
* Copyright (C) 2020-2021 by
* Copyright (C) 2020-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* LZW-compressed stream support.
*
* Copyright (C) 2004-2021 by
* Copyright (C) 2004-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* Additional Mac-specific API.
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* FreeType Multiple Master font interface (specification).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@ -47,6 +47,9 @@ FT_BEGIN_HEADER
* MM fonts, others will work with all three types. They are similar
* enough that a consistent interface makes sense.
*
* For Adobe MM fonts, macro @FT_IS_SFNT returns false. For GX and
* OpenType variation fonts, it returns true.
*
*/

View file

@ -4,7 +4,7 @@
*
* FreeType modules public interface (specification).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* FreeType module error offsets (specification).
*
* Copyright (C) 2001-2021 by
* Copyright (C) 2001-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* FreeType API for validating OpenType tables (specification).
*
* Copyright (C) 2004-2021 by
* Copyright (C) 2004-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -5,7 +5,7 @@
* Support for the FT_Outline type used to store glyph shapes of
* most scalable font formats (specification).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@ -109,11 +109,13 @@ FT_BEGIN_HEADER
* FreeType error code. 0~means success.
*
* @note:
* A contour that contains a single point only is represented by a 'move
* to' operation followed by 'line to' to the same point. In most cases,
* it is best to filter this out before using the outline for stroking
* purposes (otherwise it would result in a visible dot when round caps
* are used).
* Degenerate contours, segments, and Bezier arcs may be reported. In
* most cases, it is best to filter these out before using the outline
* for stroking or other path modification purposes (which may cause
* degenerate segments to become non-degenrate and visible, like when
* stroke caps are used or the path is otherwise outset). Some glyph
* outlines may contain deliberate degenerate single points for mark
* attachement.
*
* Similarly, the function returns success for an empty outline also
* (doing nothing, this is, not calling any emitter); if necessary, you

View file

@ -4,7 +4,7 @@
*
* FreeType API for possible FT_Parameter tags (specification only).
*
* Copyright (C) 2017-2021 by
* Copyright (C) 2017-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@ -112,6 +112,21 @@ FT_BEGIN_HEADER
FT_MAKE_TAG( 'i', 'n', 'c', 'r' )
/**************************************************************************
*
* @enum:
* FT_PARAM_TAG_IGNORE_SBIX
*
* @description:
* A tag for @FT_Parameter to make @FT_Open_Face ignore an 'sbix' table
* while loading a font. Use this if @FT_FACE_FLAG_SBIX is set and you
* want to access the outline glyphs in the font.
*
*/
#define FT_PARAM_TAG_IGNORE_SBIX \
FT_MAKE_TAG( 'i', 's', 'b', 'x' )
/**************************************************************************
*
* @enum:

View file

@ -4,7 +4,7 @@
*
* FreeType API for accessing PFR-specific data (specification only).
*
* Copyright (C) 2002-2021 by
* Copyright (C) 2002-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* FreeType renderer modules public interface (specification).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* FreeType size objects management (specification).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -7,7 +7,7 @@
*
* This is _not_ used to retrieve glyph names!
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* FreeType path stroker (specification).
*
* Copyright (C) 2002-2021 by
* Copyright (C) 2002-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -5,7 +5,7 @@
* FreeType synthesizing code for emboldening and slanting
* (specification).
*
* Copyright (C) 2000-2021 by
* Copyright (C) 2000-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* FreeType low-level system interface definition (specification).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* FreeType trigonometric functions (specification).
*
* Copyright (C) 2001-2021 by
* Copyright (C) 2001-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* FreeType simple types definitions (specification only).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* FreeType API for accessing Windows fnt-specific data.
*
* Copyright (C) 2003-2021 by
* Copyright (C) 2003-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* High-level 'autohint' module-specific interface (specification).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* Basic OpenType/CFF object type definitions (specification).
*
* Copyright (C) 2017-2021 by
* Copyright (C) 2017-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -5,7 +5,7 @@
* Basic OpenType/CFF type definitions and interface (specification
* only).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* Compiler-specific macro definitions used internally by FreeType.
*
* Copyright (C) 2020-2021 by
* Copyright (C) 2020-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@ -299,10 +299,12 @@ FT_BEGIN_HEADER
#define FT_CALLBACK_DEF( x ) static x
#endif
#if defined( __i386__ )
#if defined( __GNUC__ ) && defined( __i386__ )
#define FT_COMPARE_DEF( x ) FT_CALLBACK_DEF( x ) __attribute__(( cdecl ))
#elif defined( _M_IX86 )
#elif defined( _MSC_VER ) && defined( _M_IX86 )
#define FT_COMPARE_DEF( x ) FT_CALLBACK_DEF( x ) __cdecl
#elif defined( __WATCOMC__ ) && __WATCOMC__ >= 1240
#define FT_COMPARE_DEF( x ) FT_CALLBACK_DEF( x ) __watcall
#else
#define FT_COMPARE_DEF( x ) FT_CALLBACK_DEF( x )
#endif

View file

@ -4,7 +4,7 @@
*
* Arithmetic computations (specification).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@ -408,6 +408,19 @@ FT_BEGIN_HEADER
#endif
#elif defined( __WATCOMC__ ) && defined( __386__ )
extern __inline FT_Int32
FT_MSB_i386( FT_UInt32 x );
#pragma aux FT_MSB_i386 = \
"bsr eax, eax" \
parm [eax] nomemory \
value [eax] \
modify exact [eax] nomemory;
#define FT_MSB( x ) FT_MSB_i386( x )
#elif defined( __DECC ) || defined( __DECCXX )
#include <builtins.h>

View file

@ -4,7 +4,7 @@
*
* Debugging and logging component (specification).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* FreeType internal font driver interface (specification).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* The FreeType glyph loader (specification).
*
* Copyright (C) 2002-2021 by
* Copyright (C) 2002-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* The FreeType memory management macros (specification).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* The FreeType private base classes (specification).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@ -418,7 +418,8 @@ FT_BEGIN_HEADER
* initializing the glyph slot.
*/
#define FT_GLYPH_OWN_BITMAP 0x1U
#define FT_GLYPH_OWN_BITMAP 0x1U
#define FT_GLYPH_OWN_GZIP_SVG 0x2U
typedef struct FT_Slot_InternalRec_
{

View file

@ -4,7 +4,7 @@
*
* Get and set properties of PostScript drivers (specification).
*
* Copyright (C) 2017-2021 by
* Copyright (C) 2017-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* Embedded resource forks accessor (specification).
*
* Copyright (C) 2004-2021 by
* Copyright (C) 2004-2022 by
* Masatake YAMATO and Redhat K.K.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* The FreeType services (specification only).
*
* Copyright (C) 2003-2021 by
* Copyright (C) 2003-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* Stream handling (specification).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* Tracing handling (specification only).
*
* Copyright (C) 2002-2021 by
* Copyright (C) 2002-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@ -49,6 +49,9 @@ FT_TRACE_DEF( synth ) /* bold/slant synthesizer (ftsynth.c) */
FT_TRACE_DEF( raster ) /* monochrome rasterizer (ftraster.c) */
FT_TRACE_DEF( smooth ) /* anti-aliasing raster (ftgrays.c) */
/* ot-svg module */
FT_TRACE_DEF( otsvg ) /* OT-SVG renderer (ftsvg.c) */
/* cache sub-system */
FT_TRACE_DEF( cache ) /* cache sub-system (ftcache.c, etc.) */
@ -61,6 +64,7 @@ FT_TRACE_DEF( ttbdf ) /* TrueType embedded BDF (ttbdf.c) */
FT_TRACE_DEF( ttcmap ) /* charmap handler (ttcmap.c) */
FT_TRACE_DEF( ttcolr ) /* glyph layer table (ttcolr.c) */
FT_TRACE_DEF( ttcpal ) /* color palette table (ttcpal.c) */
FT_TRACE_DEF( ttsvg ) /* OpenType SVG table (ttsvg.c) */
FT_TRACE_DEF( ttkern ) /* kerning handler (ttkern.c) */
FT_TRACE_DEF( ttload ) /* basic TrueType tables (ttload.c) */
FT_TRACE_DEF( ttmtx ) /* metrics-related tables (ttmtx.c) */

View file

@ -4,7 +4,7 @@
*
* FreeType validation support (specification).
*
* Copyright (C) 2004-2021 by
* Copyright (C) 2004-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -5,7 +5,7 @@
* Auxiliary functions and data structures related to PostScript fonts
* (specification).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -6,7 +6,7 @@
* recorders (specification only). These are used to support native
* T1/T2 hints in the 'type1', 'cid', and 'cff' font drivers.
*
* Copyright (C) 2001-2021 by
* Copyright (C) 2001-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* The FreeType BDF services (specification).
*
* Copyright (C) 2003-2021 by
* Copyright (C) 2003-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* The FreeType CFF tables loader service (specification).
*
* Copyright (C) 2017-2021 by
* Copyright (C) 2017-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* The FreeType CID font services (specification).
*
* Copyright (C) 2007-2021 by
* Copyright (C) 2007-2022 by
* Derek Clegg and Michael Toftdal.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* The FreeType font format service (specification only).
*
* Copyright (C) 2003-2021 by
* Copyright (C) 2003-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* The FreeType glyph dictionary services (specification).
*
* Copyright (C) 2003-2021 by
* Copyright (C) 2003-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* FreeType API for validating TrueTypeGX/AAT tables (specification).
*
* Copyright (C) 2004-2021 by
* Copyright (C) 2004-2022 by
* Masatake YAMATO, Red Hat K.K.,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*

View file

@ -4,7 +4,7 @@
*
* The FreeType Kerning service (specification).
*
* Copyright (C) 2006-2021 by
* Copyright (C) 2006-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* The FreeType services for metrics variations (specification).
*
* Copyright (C) 2016-2021 by
* Copyright (C) 2016-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* The FreeType Multiple Masters and GX var services (specification).
*
* Copyright (C) 2003-2021 by
* Copyright (C) 2003-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* The FreeType OpenType validation service (specification).
*
* Copyright (C) 2004-2021 by
* Copyright (C) 2004-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* Internal PFR service functions (specification).
*
* Copyright (C) 2003-2021 by
* Copyright (C) 2003-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* The FreeType PostScript name services (specification).
*
* Copyright (C) 2003-2021 by
* Copyright (C) 2003-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* The FreeType property service (specification).
*
* Copyright (C) 2012-2021 by
* Copyright (C) 2012-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* The FreeType PostScript charmap service (specification).
*
* Copyright (C) 2003-2021 by
* Copyright (C) 2003-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* The FreeType PostScript info service (specification).
*
* Copyright (C) 2003-2021 by
* Copyright (C) 2003-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* The FreeType SFNT table loading service (specification).
*
* Copyright (C) 2003-2021 by
* Copyright (C) 2003-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* The FreeType TrueType/sfnt cmap extra information service.
*
* Copyright (C) 2003-2021 by
* Copyright (C) 2003-2022 by
* Masatake YAMATO, Redhat K.K.,
* David Turner, Robert Wilhelm, and Werner Lemberg.
*

View file

@ -4,7 +4,7 @@
*
* The FreeType TrueType engine query service (specification).
*
* Copyright (C) 2006-2021 by
* Copyright (C) 2006-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* The FreeType TrueType glyph service.
*
* Copyright (C) 2007-2021 by
* Copyright (C) 2007-2022 by
* David Turner.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* The FreeType Windows FNT/FONT service (specification).
*
* Copyright (C) 2003-2021 by
* Copyright (C) 2003-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* High-level 'sfnt' driver interface (specification).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@ -311,6 +311,33 @@ FT_BEGIN_HEADER
TT_SBit_MetricsRec *ametrics );
/**************************************************************************
*
* @functype:
* TT_Load_Svg_Doc_Func
*
* @description:
* Scan the SVG document list to find the document containing the glyph
* that has the ID 'glyph*XXX*', where *XXX* is the value of
* `glyph_index` as a decimal integer.
*
* @inout:
* glyph ::
* The glyph slot from which pointers to the SVG document list is to be
* grabbed. The results are stored back in the slot.
*
* @input:
* glyph_index ::
* The index of the glyph that is to be looked up.
*
* @return:
* FreeType error code. 0 means success.
*/
typedef FT_Error
(*TT_Load_Svg_Doc_Func)( FT_GlyphSlot glyph,
FT_UInt glyph_index );
/**************************************************************************
*
* @functype:
@ -946,6 +973,11 @@ FT_BEGIN_HEADER
TT_Get_Name_Func get_name;
TT_Get_Name_ID_Func get_name_id;
/* OpenType SVG Support */
TT_Load_Table_Func load_svg;
TT_Free_Table_Func free_svg;
TT_Load_Svg_Doc_Func load_svg_doc;
} SFNT_Interface;
@ -997,7 +1029,10 @@ FT_BEGIN_HEADER
colr_blend_, \
get_metrics_, \
get_name_, \
get_name_id_ ) \
get_name_id_, \
load_svg_, \
free_svg_, \
load_svg_doc_ ) \
static const SFNT_Interface class_ = \
{ \
goto_table_, \
@ -1042,7 +1077,10 @@ FT_BEGIN_HEADER
colr_blend_, \
get_metrics_, \
get_name_, \
get_name_id_ \
get_name_id_, \
load_svg_, \
free_svg_, \
load_svg_doc_ \
};

View file

@ -0,0 +1,46 @@
/****************************************************************************
*
* svginterface.h
*
* Interface of ot-svg module (specification only).
*
* Copyright (C) 2022 by
* David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti.
*
* 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 SVGINTERFACE_H_
#define SVGINTERFACE_H_
#include <ft2build.h>
#include <freetype/otsvg.h>
FT_BEGIN_HEADER
typedef FT_Error
(*Preset_Bitmap_Func)( FT_Module module,
FT_GlyphSlot slot,
FT_Bool cache );
typedef struct SVG_Interface_
{
Preset_Bitmap_Func preset_slot;
} SVG_Interface;
typedef SVG_Interface* SVG_Service;
FT_END_HEADER
#endif /* SVGINTERFACE_H_ */
/* END */

View file

@ -5,7 +5,7 @@
* Basic Type1/Type2 type definitions and interface (specification
* only).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -5,7 +5,7 @@
* Basic SFNT/TrueType type definitions and interface (specification
* only).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@ -1390,8 +1390,8 @@ FT_BEGIN_HEADER
* hdmx_record_size ::
* The size of a single hdmx record.
*
* hdmx_record_sizes ::
* An array holding the ppem sizes available in the 'hdmx' table.
* hdmx_records ::
* A array of pointers to the 'hdmx' table records sorted by ppem.
*
* sbit_table ::
* A pointer to the font's embedded bitmap location table.
@ -1605,7 +1605,7 @@ FT_BEGIN_HEADER
FT_ULong hdmx_table_size;
FT_UInt hdmx_record_count;
FT_ULong hdmx_record_size;
FT_Byte* hdmx_record_sizes;
FT_Byte** hdmx_records;
FT_Byte* sbit_table;
FT_ULong sbit_table_size;
@ -1644,6 +1644,9 @@ FT_BEGIN_HEADER
void* cpal;
void* colr;
/* since 2.12 */
void* svg;
} TT_FaceRec;
@ -1769,6 +1772,9 @@ FT_BEGIN_HEADER
/* since version 2.6.2 */
FT_ListRec composites;
/* since version 2.11.2 */
FT_Byte* widthp;
} TT_LoaderRec;

View file

@ -5,7 +5,7 @@
* Basic WOFF/WOFF2 type definitions and interface (specification
* only).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -0,0 +1,336 @@
/****************************************************************************
*
* otsvg.h
*
* Interface for OT-SVG support related things (specification).
*
* Copyright (C) 2022 by
* David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti.
*
* 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 OTSVG_H_
#define OTSVG_H_
#include <freetype/freetype.h>
#ifdef FREETYPE_H
#error "freetype.h of FreeType 1 has been loaded!"
#error "Please fix the directory search order for header files"
#error "so that freetype.h of FreeType 2 is found first."
#endif
FT_BEGIN_HEADER
/**************************************************************************
*
* @section:
* svg_fonts
*
* @title:
* OpenType SVG Fonts
*
* @abstract:
* OT-SVG API between FreeType and an external SVG rendering library.
*
* @description:
* This section describes the four hooks necessary to render SVG
* 'documents' that are contained in an OpenType font's 'SVG~' table.
*
* For more information on the implementation, see our standard hooks
* based on 'librsvg' in the [FreeType Demo
* Programs](https://gitlab.freedesktop.org/freetype/freetype-demos)
* repository.
*
*/
/**************************************************************************
*
* @functype:
* SVG_Lib_Init_Func
*
* @description:
* A callback that is called when the first OT-SVG glyph is rendered in
* the lifetime of an @FT_Library object. In a typical implementation,
* one would want to allocate a structure and point the `data_pointer`
* to it and perform any library initializations that might be needed.
*
* @inout:
* data_pointer ::
* The SVG rendering module stores a pointer variable that can be used
* by clients to store any data that needs to be shared across
* different hooks. `data_pointer` is essentially a pointer to that
* pointer such that it can be written to as well as read from.
*
* @return:
* FreeType error code. 0 means success.
*
* @since:
* 2.12
*/
typedef FT_Error
(*SVG_Lib_Init_Func)( FT_Pointer *data_pointer );
/**************************************************************************
*
* @functype:
* SVG_Lib_Free_Func
*
* @description:
* A callback that is called when the `ot-svg` module is being freed.
* It is only called if the init hook was called earlier. This means
* that neither the init nor the free hook is called if no OT-SVG glyph
* is rendered.
*
* In a typical implementation, one would want to free any state
* structure that was allocated in the init hook and perform any
* library-related closure that might be needed.
*
* @inout:
* data_pointer ::
* The SVG rendering module stores a pointer variable that can be used
* by clients to store any data that needs to be shared across
* different hooks. `data_pointer` is essentially a pointer to that
* pointer such that it can be written to as well as read from.
*
* @since:
* 2.12
*/
typedef void
(*SVG_Lib_Free_Func)( FT_Pointer *data_pointer );
/**************************************************************************
*
* @functype:
* SVG_Lib_Render_Func
*
* @description:
* A callback that is called to render an OT-SVG glyph. This callback
* hook is called right after the preset hook @SVG_Lib_Preset_Slot_Func
* has been called with `cache` set to `TRUE`. The data necessary to
* render is available through the handle @FT_SVG_Document, which is set
* in the `other` field of @FT_GlyphSlotRec.
*
* The render hook is expected to render the SVG glyph to the bitmap
* buffer that is allocated already at `slot->bitmap.buffer`. It also
* sets the `num_grays` value as well as `slot->format`.
*
* @input:
* slot ::
* The slot to render.
*
* @inout:
* data_pointer ::
* The SVG rendering module stores a pointer variable that can be used
* by clients to store any data that needs to be shared across
* different hooks. `data_pointer` is essentially a pointer to that
* pointer such that it can be written to as well as read from.
*
* @return:
* FreeType error code. 0 means success.
*
* @since:
* 2.12
*/
typedef FT_Error
(*SVG_Lib_Render_Func)( FT_GlyphSlot slot,
FT_Pointer *data_pointer );
/**************************************************************************
*
* @functype:
* SVG_Lib_Preset_Slot_Func
*
* @description:
* A callback that is called to preset the glyph slot. It is called from
* two places.
*
* 1. When `FT_Load_Glyph` needs to preset the glyph slot.
*
* 2. Right before the `svg` module calls the render callback hook.
*
* When it is the former, the argument `cache` is set to `FALSE`. When
* it is the latter, the argument `cache` is set to `TRUE`. This
* distinction has been made because many calculations that are necessary
* for presetting a glyph slot are the same needed later for the render
* callback hook. Thus, if `cache` is `TRUE`, the hook can _cache_ those
* calculations in a memory block referenced by the state pointer.
*
* This hook is expected to preset the slot by setting parameters such as
* `bitmap_left`, `bitmap_top`, `width`, `rows`, `pitch`, and
* `pixel_mode`. It is also expected to set all the metrics for the slot
* including the vertical advance if it is not already set. Typically,
* fonts have horizontal advances but not vertical ones. If those are
* available, they had already been set, otherwise they have to be
* estimated and set manually. The hook must take into account the
* transformations that have been set, and translate the transformation
* matrices into the SVG coordinate system, as the original matrix is
* intended for the TTF/CFF coordinate system.
*
* @input:
* slot ::
* The glyph slot that has the SVG document loaded.
*
* cache ::
* See description.
*
* @inout:
* data_pointer ::
* The SVG rendering module stores a pointer variable that can be used
* by clients to store any data that needs to be shared across
* different hooks. `data_pointer` is essentially a pointer to that
* pointer such that it can be written to as well as read from.
*
* @return:
* FreeType error code. 0 means success.
*
* @since:
* 2.12
*/
typedef FT_Error
(*SVG_Lib_Preset_Slot_Func)( FT_GlyphSlot slot,
FT_Bool cache,
FT_Pointer *state );
/**************************************************************************
*
* @struct:
* SVG_RendererHooks
*
* @description:
* A structure that stores the four hooks needed to render OT-SVG glyphs
* properly. The structure is publicly used to set the hooks via the
* @svg-hooks driver property.
*
* The behavior of each hook is described in its documentation. One
* thing to note is that the preset hook and the render hook often need
* to do the same operations; therefore, it's better to cache the
* intermediate data in a state structure to avoid calculating it twice.
* For example, in the preset hook one can draw the glyph on a recorder
* surface and later create a bitmap surface from it in the render hook.
*
* All four hooks must be non-NULL.
*
* @fields:
* init_svg ::
* The initialization hook.
*
* free_svg ::
* The cleanup hook.
*
* render_hook ::
* The render hook.
*
* preset_slot ::
* The preset hook.
*
* @since:
* 2.12
*/
typedef struct SVG_RendererHooks_
{
SVG_Lib_Init_Func init_svg;
SVG_Lib_Free_Func free_svg;
SVG_Lib_Render_Func render_svg;
SVG_Lib_Preset_Slot_Func preset_slot;
} SVG_RendererHooks;
/**************************************************************************
*
* @struct:
* FT_SVG_DocumentRec
*
* @description:
* A structure that models one SVG document.
*
* @fields:
* svg_document ::
* A pointer to the SVG document.
*
* svg_document_length ::
* The length of `svg_document`.
*
* metrics ::
* A metrics object storing the size information.
*
* units_per_EM ::
* The size of the EM square.
*
* start_glyph_id ::
* The first glyph ID in the glyph range covered by this document.
*
* end_glyph_id ::
* The last glyph ID in the glyph range covered by this document.
*
* transform ::
* A 2x2 transformation matrix to apply to the glyph while rendering
* it.
*
* delta ::
* The translation to apply to the glyph while rendering.
*
* @note:
* When an @FT_GlyphSlot object `slot` is passed down to a renderer, the
* renderer can only access the `metrics` and `units_per_EM` fields via
* `slot->face`. However, when @FT_Glyph_To_Bitmap sets up a dummy
* object, it has no way to set a `face` object. Thus, metrics
* information and `units_per_EM` (which is necessary for OT-SVG) has to
* be stored separately.
*
* @since:
* 2.12
*/
typedef struct FT_SVG_DocumentRec_
{
FT_Byte* svg_document;
FT_ULong svg_document_length;
FT_Size_Metrics metrics;
FT_UShort units_per_EM;
FT_UShort start_glyph_id;
FT_UShort end_glyph_id;
FT_Matrix transform;
FT_Vector delta;
} FT_SVG_DocumentRec;
/**************************************************************************
*
* @type:
* FT_SVG_Document
*
* @description:
* A handle to an @FT_SVG_DocumentRec object.
*
* @since:
* 2.12
*/
typedef struct FT_SVG_DocumentRec_* FT_SVG_Document;
FT_END_HEADER
#endif /* OTSVG_H_ */
/* END */

View file

@ -5,7 +5,7 @@
* Basic Type 1/Type 2 tables definitions and interface (specification
* only).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@ -453,22 +453,22 @@ FT_BEGIN_HEADER
/**************************************************************************
*
* @function:
* FT_Has_PS_Glyph_Names
* FT_Has_PS_Glyph_Names
*
* @description:
* Return true if a given face provides reliable PostScript glyph names.
* This is similar to using the @FT_HAS_GLYPH_NAMES macro, except that
* certain fonts (mostly TrueType) contain incorrect glyph name tables.
* Return true if a given face provides reliable PostScript glyph names.
* This is similar to using the @FT_HAS_GLYPH_NAMES macro, except that
* certain fonts (mostly TrueType) contain incorrect glyph name tables.
*
* When this function returns true, the caller is sure that the glyph
* names returned by @FT_Get_Glyph_Name are reliable.
* When this function returns true, the caller is sure that the glyph
* names returned by @FT_Get_Glyph_Name are reliable.
*
* @input:
* face ::
* face handle
* face ::
* face handle
*
* @return:
* Boolean. True if glyph names are reliable.
* Boolean. True if glyph names are reliable.
*
*/
FT_EXPORT( FT_Int )
@ -478,30 +478,40 @@ FT_BEGIN_HEADER
/**************************************************************************
*
* @function:
* FT_Get_PS_Font_Info
* FT_Get_PS_Font_Info
*
* @description:
* Retrieve the @PS_FontInfoRec structure corresponding to a given
* PostScript font.
* Retrieve the @PS_FontInfoRec structure corresponding to a given
* PostScript font.
*
* @input:
* face ::
* PostScript face handle.
* face ::
* PostScript face handle.
*
* @output:
* afont_info ::
* Output font info structure pointer.
* afont_info ::
* A pointer to a @PS_FontInfoRec object.
*
* @return:
* FreeType error code. 0~means success.
* FreeType error code. 0~means success.
*
* @note:
* String pointers within the @PS_FontInfoRec structure are owned by the
* face and don't need to be freed by the caller. Missing entries in
* the font's FontInfo dictionary are represented by `NULL` pointers.
* String pointers within the @PS_FontInfoRec structure are owned by the
* face and don't need to be freed by the caller. Missing entries in the
* font's FontInfo dictionary are represented by `NULL` pointers.
*
* If the font's format is not PostScript-based, this function will
* return the `FT_Err_Invalid_Argument` error code.
* The following font formats support this feature: 'Type~1', 'Type~42',
* 'CFF', 'CID~Type~1'. For other font formats this function returns the
* `FT_Err_Invalid_Argument` error code.
*
* @example:
* ```
* PS_FontInfoRec font_info;
*
*
* error = FT_Get_PS_Font_Info( face, &font_info );
* ...
* ```
*
*/
FT_EXPORT( FT_Error )
@ -512,29 +522,39 @@ FT_BEGIN_HEADER
/**************************************************************************
*
* @function:
* FT_Get_PS_Font_Private
* FT_Get_PS_Font_Private
*
* @description:
* Retrieve the @PS_PrivateRec structure corresponding to a given
* PostScript font.
* Retrieve the @PS_PrivateRec structure corresponding to a given
* PostScript font.
*
* @input:
* face ::
* PostScript face handle.
* face ::
* PostScript face handle.
*
* @output:
* afont_private ::
* Output private dictionary structure pointer.
* afont_private ::
* A pointer to a @PS_PrivateRec object.
*
* @return:
* FreeType error code. 0~means success.
* FreeType error code. 0~means success.
*
* @note:
* The string pointers within the @PS_PrivateRec structure are owned by
* the face and don't need to be freed by the caller.
* The string pointers within the @PS_PrivateRec structure are owned by
* the face and don't need to be freed by the caller.
*
* If the font's format is not PostScript-based, this function returns
* the `FT_Err_Invalid_Argument` error code.
* Only the 'Type~1' font format supports this feature. For other font
* formats this function returns the `FT_Err_Invalid_Argument` error
* code.
*
* @example:
* ```
* PS_PrivateRec font_private;
*
*
* error = FT_Get_PS_Font_Private( face, &font_private );
* ...
* ```
*
*/
FT_EXPORT( FT_Error )
@ -693,67 +713,67 @@ FT_BEGIN_HEADER
/**************************************************************************
*
* @function:
* FT_Get_PS_Font_Value
* FT_Get_PS_Font_Value
*
* @description:
* Retrieve the value for the supplied key from a PostScript font.
* Retrieve the value for the supplied key from a PostScript font.
*
* @input:
* face ::
* PostScript face handle.
* face ::
* PostScript face handle.
*
* key ::
* An enumeration value representing the dictionary key to retrieve.
* key ::
* An enumeration value representing the dictionary key to retrieve.
*
* idx ::
* For array values, this specifies the index to be returned.
* idx ::
* For array values, this specifies the index to be returned.
*
* value ::
* A pointer to memory into which to write the value.
* value ::
* A pointer to memory into which to write the value.
*
* valen_len ::
* The size, in bytes, of the memory supplied for the value.
* valen_len ::
* The size, in bytes, of the memory supplied for the value.
*
* @output:
* value ::
* The value matching the above key, if it exists.
* value ::
* The value matching the above key, if it exists.
*
* @return:
* The amount of memory (in bytes) required to hold the requested value
* (if it exists, -1 otherwise).
* The amount of memory (in bytes) required to hold the requested value
* (if it exists, -1 otherwise).
*
* @note:
* The values returned are not pointers into the internal structures of
* the face, but are 'fresh' copies, so that the memory containing them
* belongs to the calling application. This also enforces the
* 'read-only' nature of these values, i.e., this function cannot be
* used to manipulate the face.
* The values returned are not pointers into the internal structures of
* the face, but are 'fresh' copies, so that the memory containing them
* belongs to the calling application. This also enforces the
* 'read-only' nature of these values, i.e., this function cannot be
* used to manipulate the face.
*
* `value` is a void pointer because the values returned can be of
* various types.
* `value` is a void pointer because the values returned can be of
* various types.
*
* If either `value` is `NULL` or `value_len` is too small, just the
* required memory size for the requested entry is returned.
* If either `value` is `NULL` or `value_len` is too small, just the
* required memory size for the requested entry is returned.
*
* The `idx` parameter is used, not only to retrieve elements of, for
* example, the FontMatrix or FontBBox, but also to retrieve name keys
* from the CharStrings dictionary, and the charstrings themselves. It
* is ignored for atomic values.
* The `idx` parameter is used, not only to retrieve elements of, for
* example, the FontMatrix or FontBBox, but also to retrieve name keys
* from the CharStrings dictionary, and the charstrings themselves. It
* is ignored for atomic values.
*
* `PS_DICT_BLUE_SCALE` returns a value that is scaled up by 1000. To
* get the value as in the font stream, you need to divide by 65536000.0
* (to remove the FT_Fixed scale, and the x1000 scale).
* `PS_DICT_BLUE_SCALE` returns a value that is scaled up by 1000. To
* get the value as in the font stream, you need to divide by 65536000.0
* (to remove the FT_Fixed scale, and the x1000 scale).
*
* IMPORTANT: Only key/value pairs read by the FreeType interpreter can
* be retrieved. So, for example, PostScript procedures such as NP, ND,
* and RD are not available. Arbitrary keys are, obviously, not be
* available either.
* IMPORTANT: Only key/value pairs read by the FreeType interpreter can
* be retrieved. So, for example, PostScript procedures such as NP, ND,
* and RD are not available. Arbitrary keys are, obviously, not be
* available either.
*
* If the font's format is not PostScript-based, this function returns
* the `FT_Err_Invalid_Argument` error code.
* If the font's format is not PostScript-based, this function returns
* the `FT_Err_Invalid_Argument` error code.
*
* @since:
* 2.4.8
* 2.4.8
*
*/
FT_EXPORT( FT_Long )

View file

@ -4,7 +4,7 @@
*
* TrueType name ID definitions (specification only).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -5,7 +5,7 @@
* Basic SFNT/TrueType tables definitions and interface
* (specification only).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,

View file

@ -4,7 +4,7 @@
*
* Tags for TrueType and OpenType tables (specification only).
*
* Copyright (C) 1996-2021 by
* Copyright (C) 1996-2022 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@ -95,6 +95,7 @@ FT_BEGIN_HEADER
#define TTAG_sbix FT_MAKE_TAG( 's', 'b', 'i', 'x' )
#define TTAG_sfnt FT_MAKE_TAG( 's', 'f', 'n', 't' )
#define TTAG_SING FT_MAKE_TAG( 'S', 'I', 'N', 'G' )
#define TTAG_SVG FT_MAKE_TAG( 'S', 'V', 'G', ' ' )
#define TTAG_trak FT_MAKE_TAG( 't', 'r', 'a', 'k' )
#define TTAG_true FT_MAKE_TAG( 't', 'r', 'u', 'e' )
#define TTAG_ttc FT_MAKE_TAG( 't', 't', 'c', ' ' )

Some files were not shown because too many files have changed in this diff Show more