Update freetype to 2.8.1

This commit is contained in:
volzhs 2017-10-10 01:33:39 +09:00
parent bf12b45986
commit dfc717c458
79 changed files with 2093 additions and 1120 deletions

View file

@ -107,20 +107,17 @@ FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* Uncomment the line below if you want to activate sub-pixel rendering */
/* (a.k.a. LCD rendering, or ClearType) in this build of the library. */
/* Uncomment the line below if you want to activate LCD rendering */
/* technology similar to ClearType in this build of the library. This */
/* technology triples the resolution in the direction color subpixels. */
/* To mitigate color fringes inherent to this technology, you also need */
/* to explicitly set up LCD filtering. */
/* */
/* Note that this feature is covered by several Microsoft patents */
/* and should not be activated in any default build of the library. */
/* */
/* This macro has no impact on the FreeType API, only on its */
/* _implementation_. For example, using FT_RENDER_MODE_LCD when calling */
/* FT_Render_Glyph still generates a bitmap that is 3 times wider than */
/* the original size in case this macro isn't defined; however, each */
/* triplet of subpixels has R=G=B. */
/* */
/* This is done to allow FreeType clients to run unmodified, forcing */
/* them to display normal gray-level anti-aliased glyphs. */
/* When this macro is not defined, FreeType offers alternative LCD */
/* rendering technology that produces excellent output without LCD */
/* filtering. */
/* */
/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
@ -327,7 +324,7 @@ FT_BEGIN_HEADER
/* */
/* - The TrueType driver will provide its own set of glyph names, */
/* if you build it to support postscript names in the TrueType */
/* `post' table. */
/* `post' table, but will not synthesize a missing Unicode charmap. */
/* */
/* - The Type 1 driver will not be able to synthesize a Unicode */
/* charmap out of the glyphs found in the fonts. */

View file

@ -575,7 +575,8 @@ FT_BEGIN_HEADER
/* <Note> */
/* When a new face is created (either through @FT_New_Face or */
/* @FT_Open_Face), the library looks for a Unicode charmap within */
/* the list and automatically activates it. */
/* the list and automatically activates it. If there is no Unicode */
/* charmap, FreeType doesn't set an `active' charmap. */
/* */
/* <Also> */
/* See @FT_CharMapRec for the publicly accessible fields of a given */
@ -1529,7 +1530,13 @@ FT_BEGIN_HEADER
/* values of the corresponding fields in @FT_FaceRec. Some values */
/* like ascender or descender are rounded for historical reasons; */
/* more precise values (for outline fonts) can be derived by scaling */
/* the corresponding @FT_FaceRec values manually. */
/* the corresponding @FT_FaceRec values manually, with code similar */
/* to the following. */
/* */
/* { */
/* scaled_ascender = FT_MulFix( face->root.ascender, */
/* size_metrics->y_scale ); */
/* } */
/* */
/* Note that due to glyph hinting and the selected rendering mode */
/* these values are usually not exact; consequently, they must be */
@ -1774,7 +1781,7 @@ FT_BEGIN_HEADER
/* and add it to `origin_x'> */
/* */
/* origin_x += slot->advance.x; */
/* origin_x += slot->rsb_delta - slot->lsb_relta; */
/* origin_x += slot->rsb_delta - slot->lsb_delta; */
/* endfor */
/* } */
/* */
@ -1794,9 +1801,9 @@ FT_BEGIN_HEADER
/* */
/* <load glyph with `FT_Load_Glyph'> */
/* */
/* if ( prev_rsb_delta - slot->lsb_delta >= 32 ) */
/* if ( prev_rsb_delta - slot->lsb_delta > 32 ) */
/* origin_x -= 64; */
/* else if ( prev_rsb_delta - slot->lsb_delta < -32 ) */
/* else if ( prev_rsb_delta - slot->lsb_delta < -31 ) */
/* origin_x += 64; */
/* */
/* prev_rsb_delta = slot->rsb_delta; */
@ -3124,11 +3131,13 @@ FT_BEGIN_HEADER
/* glyph outline in pixels and use the @FT_PIXEL_MODE_LCD_V mode. */
/* */
/* <Note> */
/* The LCD-optimized glyph bitmaps produced by `FT_Render_Glyph' can */
/* be filtered to reduce color-fringes by using */
/* @FT_Library_SetLcdFilter (not active in the default builds). It */
/* is up to the caller to either call `FT_Library_SetLcdFilter' (if */
/* available) or do the filtering itself. */
/* Should you define FT_CONFIG_OPTION_SUBPIXEL_RENDERING in your */
/* `ftoption.h', which enables patented ClearType-style rendering, */
/* the LCD-optimized glyph bitmaps should be filtered to reduce color */
/* fringes inherent to this technology. You can either set up LCD */
/* filtering with @FT_Library_SetLcdFilter or @FT_Face_Properties, */
/* or do the filtering yourself. The default FreeType LCD rendering */
/* technology does not require filtering. */
/* */
/* The selected render mode only affects vector glyphs of a font. */
/* Embedded bitmaps often have a different pixel mode like */
@ -4327,6 +4336,9 @@ FT_BEGIN_HEADER
/* `a' rounded to the nearest 16.16 fixed integer, halfway cases away */
/* from zero. */
/* */
/* <Note> */
/* The function uses wrap-around arithmetic. */
/* */
FT_EXPORT( FT_Fixed )
FT_RoundFix( FT_Fixed a );
@ -4345,6 +4357,9 @@ FT_BEGIN_HEADER
/* <Return> */
/* `a' rounded towards plus infinity. */
/* */
/* <Note> */
/* The function uses wrap-around arithmetic. */
/* */
FT_EXPORT( FT_Fixed )
FT_CeilFix( FT_Fixed a );
@ -4442,7 +4457,7 @@ FT_BEGIN_HEADER
*/
#define FREETYPE_MAJOR 2
#define FREETYPE_MINOR 8
#define FREETYPE_PATCH 0
#define FREETYPE_PATCH 1
/*************************************************************************/

View file

@ -404,12 +404,12 @@ FT_BEGIN_HEADER
* activate the warp hinting code in the auto-hinter, this property
* switches warping on and off.
*
* Warping only works in `light' auto-hinting mode. The idea of the
* code is to slightly scale and shift a glyph along the non-hinted
* dimension (which is usually the horizontal axis) so that as much of
* its segments are aligned (more or less) to the grid. To find out a
* glyph's optimal scaling and shifting value, various parameter
* combinations are tried and scored.
* Warping only works in `normal' auto-hinting mode replacing it.
* The idea of the code is to slightly scale and shift a glyph along
* the non-hinted dimension (which is usually the horizontal axis) so
* that as much of its segments are aligned (more or less) to the grid.
* To find out a glyph's optimal scaling and shifting value, various
* parameter combinations are tried and scored.
*
* By default, warping is off. The example below shows how to switch on
* warping (omitting the error handling).
@ -437,7 +437,7 @@ FT_BEGIN_HEADER
*
* Since warping is a global property of the auto-hinter it is best to
* change its value before rendering any face. Otherwise, you should
* reload all faces that get auto-hinted in `light' hinting mode.
* reload all faces that get auto-hinted in `normal' hinting mode.
*
*/

View file

@ -233,6 +233,8 @@
"invalid PostScript (post) table" )
FT_ERRORDEF_( DEF_In_Glyf_Bytecode, 0x9C,
"found FDEF or IDEF opcode in glyf bytecode" )
FT_ERRORDEF_( Missing_Bitmap, 0x9D,
"missing bitmap in strike" )
/* CFF, CID, and Type 1 errors */

View file

@ -38,15 +38,15 @@
/* The configuration macro FT_CONFIG_OPTION_USE_MODULE_ERRORS can be */
/* defined in `ftoption.h' in order to make the higher byte indicate */
/* the module where the error has happened (this is not compatible */
/* with standard builds of FreeType&nbsp;2, however). See the file */
/* with standard builds of FreeType~2, however). See the file */
/* `ftmoderr.h' for more details. */
/* */
/* *Error* *Message* *Strings* */
/* */
/* Error definitions are set up with special macros that allow client */
/* applications to build a table of error message strings. The */
/* strings are not included in a normal build of FreeType&nbsp;2 to */
/* save space (most client applications do not use them). */
/* strings are not included in a normal build of FreeType~2 to save */
/* space (most client applications do not use them). */
/* */
/* To do so, you have to define the following macros before including */
/* this file. */

View file

@ -231,6 +231,12 @@ FT_BEGIN_HEADER
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* Because `*aglyph->advance.x' and '*aglyph->advance.y' are 16.16 */
/* fixed-point numbers, `slot->advance.x' and `slot->advance.y' */
/* (which are in 26.6 fixed-point format) must be in the range */
/* ]-32768;32768[. */
/* */
FT_EXPORT( FT_Error )
FT_Get_Glyph( FT_GlyphSlot slot,
FT_Glyph *aglyph );
@ -566,6 +572,9 @@ FT_BEGIN_HEADER
/* <Note> */
/* The result is undefined if either `a' or `b' is zero. */
/* */
/* Since the function uses wrap-around arithmetic, results become */
/* meaningless if the arguments are very large. */
/* */
FT_EXPORT( void )
FT_Matrix_Multiply( const FT_Matrix* a,
FT_Matrix* b );

View file

@ -1064,24 +1064,24 @@ FT_BEGIN_HEADER
/* */
/* <Description> */
/* FreeType used to provide an area of memory called the `render */
/* pool' available to all registered rasters. This was not thread */
/* safe however and now FreeType never allocates this pool. NULL */
/* is always passed in as pool_base. */
/* pool' available to all registered rasterizers. This was not */
/* thread safe, however, and now FreeType never allocates this pool. */
/* */
/* This function is called each time the render pool changes, or just */
/* after a new raster object is created. */
/* This function is called after a new raster object is created. */
/* */
/* <Input> */
/* raster :: A handle to the new raster object. */
/* */
/* pool_base :: The address in memory of the render pool. */
/* pool_base :: Previously, the address in memory of the render pool. */
/* Set this to NULL. */
/* */
/* pool_size :: The size in bytes of the render pool. */
/* pool_size :: Previously, the size in bytes of the render pool. */
/* Set this to 0. */
/* */
/* <Note> */
/* Rasters should ignore the render pool and rely on dynamic or stack */
/* allocation if they want to (a handle to the memory allocator is */
/* passed to the raster constructor). */
/* Rasterizers should rely on dynamic or stack allocation if they */
/* want to (a handle to the memory allocator is passed to the */
/* rasterizer constructor). */
/* */
typedef void
(*FT_Raster_ResetFunc)( FT_Raster raster,

View file

@ -44,9 +44,16 @@ FT_BEGIN_HEADER
* Reduce color fringes of subpixel-rendered bitmaps.
*
* @description:
* Subpixel rendering exploits the color-striped structure of LCD
* pixels, increasing the available resolution in the direction of the
* stripe (usually horizontal RGB) by a factor of~3. Since these
* Should you #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING in your
* `ftoption.h', which enables patented ClearType-style rendering,
* the LCD-optimized glyph bitmaps should be filtered to reduce color
* fringes inherent to this technology. The default FreeType LCD
* rendering uses different technology, and API described below,
* although available, does nothing.
*
* ClearType-style LCD rendering exploits the color-striped structure of
* LCD pixels, increasing the available resolution in the direction of
* the stripe (usually horizontal RGB) by a factor of~3. Since these
* subpixels are color pixels, using them unfiltered creates severe
* color fringes. Use the @FT_Library_SetLcdFilter API to specify a
* low-pass filter, which is then applied to subpixel-rendered bitmaps
@ -54,12 +61,6 @@ FT_BEGIN_HEADER
* the higher resolution to reduce color fringes, making the glyph image
* slightly blurrier. Positional improvements will remain.
*
* Note that no filter is active by default, and that this function is
* *not* implemented in default builds of the library. You need to
* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING in your `ftoption.h' file
* in order to activate it and explicitly call @FT_Library_SetLcdFilter
* to enable it.
*
* A filter should have two properties:
*
* 1) It should be normalized, meaning the sum of the 5~components

View file

@ -35,11 +35,12 @@
FT_BEGIN_HEADER
/* gcc-3.4.1 and later can warn about functions tagged as deprecated */
/* gcc-3.1 and later can warn about functions tagged as deprecated */
#ifndef FT_DEPRECATED_ATTRIBUTE
#if defined(__GNUC__) && \
((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
#define FT_DEPRECATED_ATTRIBUTE __attribute__((deprecated))
#if defined( __GNUC__ ) && \
( ( __GNUC__ >= 4 ) || \
( ( __GNUC__ == 3 ) && ( __GNUC_MINOR__ >= 1 ) ) )
#define FT_DEPRECATED_ATTRIBUTE __attribute__(( deprecated ))
#else
#define FT_DEPRECATED_ATTRIBUTE
#endif

View file

@ -178,7 +178,8 @@ FT_BEGIN_HEADER
/* strid :: The entry in `name' table identifying this instance. */
/* */
/* psid :: The entry in `name' table identifying a PostScript name */
/* for this instance. */
/* for this instance. Value 0xFFFF indicates a missing */
/* entry. */
/* */
typedef struct FT_Var_Named_Style_
{
@ -195,7 +196,7 @@ FT_BEGIN_HEADER
/* FT_MM_Var */
/* */
/* <Description> */
/* A structure to model the axes and space of a Adobe MM, TrueType */
/* A structure to model the axes and space of an Adobe MM, TrueType */
/* GX, or OpenType variation font. */
/* */
/* Some fields are specific to one format and not to the others. */
@ -321,6 +322,11 @@ FT_BEGIN_HEADER
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* To reset all axes to the default values, call the function with */
/* `num_coords' set to zero and `coords' set to NULL (new feature in */
/* FreeType version 2.8.1). */
/* */
FT_EXPORT( FT_Error )
FT_Set_MM_Design_Coordinates( FT_Face face,
FT_UInt num_coords,
@ -351,6 +357,11 @@ FT_BEGIN_HEADER
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* To reset all axes to the default values, call the function with */
/* `num_coords' set to zero and `coords' set to NULL (new feature in */
/* FreeType version 2.8.1). */
/* */
FT_EXPORT( FT_Error )
FT_Set_Var_Design_Coordinates( FT_Face face,
FT_UInt num_coords,
@ -415,6 +426,11 @@ FT_BEGIN_HEADER
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
/* <Note> */
/* To reset all axes to the default values, call the function with */
/* `num_coords' set to zero and `coords' set to NULL (new feature in */
/* FreeType version 2.8.1). */
/* */
FT_EXPORT( FT_Error )
FT_Set_MM_Blend_Coordinates( FT_Face face,
FT_UInt num_coords,
@ -479,6 +495,50 @@ FT_BEGIN_HEADER
FT_UInt num_coords,
FT_Fixed* coords );
/*************************************************************************/
/* */
/* <Enum> */
/* FT_VAR_AXIS_FLAG_XXX */
/* */
/* <Description> */
/* A list of bit flags used in the return value of */
/* @FT_Get_Var_Axis_Flags. */
/* */
/* <Values> */
/* FT_VAR_AXIS_FLAG_HIDDEN :: */
/* The variation axis should not be exposed to user interfaces. */
/* */
#define FT_VAR_AXIS_FLAG_HIDDEN 1
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_Var_Axis_Flags */
/* */
/* <Description> */
/* Get the `flags' field of an OpenType Variation Axis Record. */
/* */
/* Not meaningful for Adobe MM fonts (`*flags' is always zero). */
/* */
/* <Input> */
/* master :: The variation descriptor. */
/* */
/* axis_index :: The index of the requested variation axis. */
/* */
/* <Output> */
/* flags :: The `flags' field. See @FT_VAR_AXIS_FLAG_XXX for */
/* possible values. */
/* */
/* <Return> */
/* FreeType error code. 0~means success. */
/* */
FT_EXPORT( FT_Error )
FT_Get_Var_Axis_Flags( FT_MM_Var* master,
FT_UInt axis_index,
FT_UInt* flags );
/* */

View file

@ -385,6 +385,9 @@ FT_BEGIN_HEADER
/* @FT_Outline_Embolden, which uses the same strength in both */
/* directions. */
/* */
/* <Since> */
/* 2.4.10 */
/* */
FT_EXPORT( FT_Error )
FT_Outline_EmboldenXY( FT_Outline* outline,
FT_Pos xstrength,

View file

@ -399,16 +399,42 @@ FT_BEGIN_HEADER
#endif /* 0 */
#define INT_TO_F26DOT6( x ) ( (FT_Long)(x) << 6 )
#define INT_TO_F2DOT14( x ) ( (FT_Long)(x) << 14 )
#define INT_TO_FIXED( x ) ( (FT_Long)(x) << 16 )
#define F2DOT14_TO_FIXED( x ) ( (FT_Long)(x) << 2 )
#define FLOAT_TO_FIXED( x ) ( (FT_Long)( x * 65536.0 ) )
#define INT_TO_F26DOT6( x ) ( (FT_Long)(x) * 64 ) /* << 6 */
#define INT_TO_F2DOT14( x ) ( (FT_Long)(x) * 16384 ) /* << 14 */
#define INT_TO_FIXED( x ) ( (FT_Long)(x) * 65536 ) /* << 16 */
#define F2DOT14_TO_FIXED( x ) ( (FT_Long)(x) * 4 ) /* << 2 */
#define FIXED_TO_INT( x ) ( FT_RoundFix( x ) >> 16 )
#define ROUND_F26DOT6( x ) ( x >= 0 ? ( ( (x) + 32 ) & -64 ) \
: ( -( ( 32 - (x) ) & -64 ) ) )
/*
* The following macros have two purposes.
*
* . Tag places where overflow is expected and harmless.
*
* . Avoid run-time sanitizer errors.
*
* Use with care!
*/
#define ADD_LONG( a, b ) \
(FT_Long)( (FT_ULong)(a) + (FT_ULong)(b) )
#define SUB_LONG( a, b ) \
(FT_Long)( (FT_ULong)(a) - (FT_ULong)(b) )
#define MUL_LONG( a, b ) \
(FT_Long)( (FT_ULong)(a) * (FT_ULong)(b) )
#define NEG_LONG( a ) \
(FT_Long)( (FT_ULong)0 - (FT_ULong)(a) )
#define ADD_INT32( a, b ) \
(FT_Int32)( (FT_UInt32)(a) + (FT_UInt32)(b) )
#define SUB_INT32( a, b ) \
(FT_Int32)( (FT_UInt32)(a) - (FT_UInt32)(b) )
#define MUL_INT32( a, b ) \
(FT_Int32)( (FT_UInt32)(a) * (FT_UInt32)(b) )
#define NEG_INT32( a ) \
(FT_Int32)( (FT_UInt32)0 - (FT_UInt32)(a) )
FT_END_HEADER

View file

@ -36,6 +36,7 @@
#include FT_INTERNAL_AUTOHINT_H
#include FT_INTERNAL_SERVICE_H
#include FT_INTERNAL_PIC_H
#include FT_INTERNAL_CALC_H
#ifdef FT_CONFIG_OPTION_INCREMENTAL
#include FT_INCREMENTAL_H
@ -85,13 +86,29 @@ FT_BEGIN_HEADER
/* we use FT_TYPEOF to suppress signedness compilation warnings */
#define FT_PAD_FLOOR( x, n ) ( (x) & ~FT_TYPEOF( x )( (n)-1 ) )
#define FT_PAD_ROUND( x, n ) FT_PAD_FLOOR( (x) + ((n)/2), n )
#define FT_PAD_CEIL( x, n ) FT_PAD_FLOOR( (x) + ((n)-1), n )
#define FT_PAD_ROUND( x, n ) FT_PAD_FLOOR( (x) + (n)/2, n )
#define FT_PAD_CEIL( x, n ) FT_PAD_FLOOR( (x) + (n)-1, n )
#define FT_PIX_FLOOR( x ) ( (x) & ~FT_TYPEOF( x )63 )
#define FT_PIX_ROUND( x ) FT_PIX_FLOOR( (x) + 32 )
#define FT_PIX_CEIL( x ) FT_PIX_FLOOR( (x) + 63 )
/* specialized versions (for signed values) */
/* that don't produce run-time errors due to integer overflow */
#define FT_PAD_ROUND_LONG( x, n ) FT_PAD_FLOOR( ADD_LONG( (x), (n) / 2 ), \
n )
#define FT_PAD_CEIL_LONG( x, n ) FT_PAD_FLOOR( ADD_LONG( (x), (n) - 1 ), \
n )
#define FT_PIX_ROUND_LONG( x ) FT_PIX_FLOOR( ADD_LONG( (x), 32 ) )
#define FT_PIX_CEIL_LONG( x ) FT_PIX_FLOOR( ADD_LONG( (x), 63 ) )
#define FT_PAD_ROUND_INT32( x, n ) FT_PAD_FLOOR( ADD_INT32( (x), (n) / 2 ), \
n )
#define FT_PAD_CEIL_INT32( x, n ) FT_PAD_FLOOR( ADD_INT32( (x), (n) - 1 ), \
n )
#define FT_PIX_ROUND_INT32( x ) FT_PIX_FLOOR( ADD_INT32( (x), 32 ) )
#define FT_PIX_CEIL_INT32( x ) FT_PIX_FLOOR( ADD_INT32( (x), 63 ) )
/*
* character classification functions -- since these are used to parse
@ -856,11 +873,6 @@ FT_BEGIN_HEADER
/* */
/* auto_hinter :: The auto-hinter module interface. */
/* */
/* raster_pool :: The raster object's render pool. This can */
/* ideally be changed dynamically at run-time. */
/* */
/* raster_pool_size :: The size of the render pool in bytes. */
/* */
/* debug_hooks :: An array of four function pointers that allow */
/* debuggers to hook into a font format's */
/* interpreter. Currently, only the TrueType */
@ -869,9 +881,6 @@ FT_BEGIN_HEADER
/* lcd_filter :: If subpixel rendering is activated, the */
/* selected LCD filter mode. */
/* */
/* lcd_extra :: If subpixel rendering is activated, the number */
/* of extra pixels needed for the LCD filter. */
/* */
/* lcd_weights :: If subpixel rendering is activated, the LCD */
/* filter weights, if any. */
/* */
@ -903,15 +912,10 @@ FT_BEGIN_HEADER
FT_Renderer cur_renderer; /* current outline renderer */
FT_Module auto_hinter;
FT_Byte* raster_pool; /* scan-line conversion */
/* render pool */
FT_ULong raster_pool_size; /* size of render pool in bytes */
FT_DebugHook_Func debug_hooks[4];
#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
FT_LcdFilter lcd_filter;
FT_Int lcd_extra; /* number of extra pixels */
FT_LcdFiveTapFilter lcd_weights; /* filter weights, if any */
FT_Bitmap_LcdFilterFunc lcd_filter_func; /* filtering callback */
#endif

View file

@ -106,6 +106,12 @@ FT_BEGIN_HEADER
#define TTAG_VVAR FT_MAKE_TAG( 'V', 'V', 'A', 'R' )
#define TTAG_wOFF FT_MAKE_TAG( 'w', 'O', 'F', 'F' )
/* used by "Keyboard.dfont" on legacy Mac OS X */
#define TTAG_0xA5kbd FT_MAKE_TAG( 0xA5, 'k', 'b', 'd' )
/* used by "LastResort.dfont" on legacy Mac OS X */
#define TTAG_0xA5lst FT_MAKE_TAG( 0xA5, 'l', 's', 't' )
FT_END_HEADER