[CHG] FreeType updated to version 2.4.10

This commit is contained in:
Crayon2000 2012-08-11 01:29:19 +00:00
parent c2771d7886
commit 828beb7cd2
28 changed files with 294 additions and 291 deletions

View file

@ -51,7 +51,7 @@ ifneq ($(EXPORTS_LIST),)
APINAMES_EXE := $(subst /,$(SEP),$(OBJ_DIR)/apinames$(E_BUILD)) APINAMES_EXE := $(subst /,$(SEP),$(OBJ_DIR)/apinames$(E_BUILD))
$(APINAMES_EXE): $(APINAMES_SRC) $(APINAMES_EXE): $(APINAMES_SRC)
$(CCexe) $(TE)$@ $< $(CCexe) $(CCexe_CFLAGS) $(TE)$@ $< $(CCexe_LDFLAGS)
.PHONY: symbols_list .PHONY: symbols_list

View file

@ -4,7 +4,7 @@
/* */ /* */
/* User-selectable configuration macros (specification only). */ /* User-selectable configuration macros (specification only). */
/* */ /* */
/* Copyright 1996-2011 by */ /* Copyright 1996-2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -669,7 +669,7 @@ FT_BEGIN_HEADER
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* T1_MAX_DICT_DEPTH is the maximal depth of nest dictionaries and */ /* T1_MAX_DICT_DEPTH is the maximum depth of nest dictionaries and */
/* arrays in the Type 1 stream (see t1load.c). A minimum of 4 is */ /* arrays in the Type 1 stream (see t1load.c). A minimum of 4 is */
/* required. */ /* required. */
/* */ /* */

View file

@ -16,6 +16,10 @@
/***************************************************************************/ /***************************************************************************/
#ifndef __FREETYPE_H__
#define __FREETYPE_H__
#ifndef FT_FREETYPE_H #ifndef FT_FREETYPE_H
#error "`ft2build.h' hasn't been included yet!" #error "`ft2build.h' hasn't been included yet!"
#error "Please always use macros to include FreeType header files." #error "Please always use macros to include FreeType header files."
@ -25,10 +29,6 @@
#endif #endif
#ifndef __FREETYPE_H__
#define __FREETYPE_H__
#include <ft2build.h> #include <ft2build.h>
#include FT_CONFIG_CONFIG_H #include FT_CONFIG_CONFIG_H
#include FT_ERRORS_H #include FT_ERRORS_H
@ -237,6 +237,10 @@ FT_BEGIN_HEADER
/* If not disabled with @FT_LOAD_NO_HINTING, the values represent */ /* If not disabled with @FT_LOAD_NO_HINTING, the values represent */
/* dimensions of the hinted glyph (in case hinting is applicable). */ /* dimensions of the hinted glyph (in case hinting is applicable). */
/* */ /* */
/* Stroking a glyph with an outside border does not increase */
/* `horiAdvance' or `vertAdvance'; you have to manually adjust these */
/* values to account for the added width and height. */
/* */
typedef struct FT_Glyph_Metrics_ typedef struct FT_Glyph_Metrics_
{ {
FT_Pos width; FT_Pos width;
@ -844,8 +848,8 @@ FT_BEGIN_HEADER
/* expressed in font units (see */ /* expressed in font units (see */
/* `units_per_EM'). The box is large enough */ /* `units_per_EM'). The box is large enough */
/* to contain any glyph from the font. Thus, */ /* to contain any glyph from the font. Thus, */
/* `bbox.yMax' can be seen as the `maximal */ /* `bbox.yMax' can be seen as the `maximum */
/* ascender', and `bbox.yMin' as the `minimal */ /* ascender', and `bbox.yMin' as the `minimum */
/* descender'. Only relevant for scalable */ /* descender'. Only relevant for scalable */
/* formats. */ /* formats. */
/* */ /* */
@ -877,13 +881,13 @@ FT_BEGIN_HEADER
/* positive. Only relevant for scalable */ /* positive. Only relevant for scalable */
/* formats. */ /* formats. */
/* */ /* */
/* max_advance_width :: The maximal advance width, in font units, */ /* max_advance_width :: The maximum advance width, in font units, */
/* for all glyphs in this face. This can be */ /* for all glyphs in this face. This can be */
/* used to make word wrapping computations */ /* used to make word wrapping computations */
/* faster. Only relevant for scalable */ /* faster. Only relevant for scalable */
/* formats. */ /* formats. */
/* */ /* */
/* max_advance_height :: The maximal advance height, in font units, */ /* max_advance_height :: The maximum advance height, in font units, */
/* for all glyphs in this face. This is only */ /* for all glyphs in this face. This is only */
/* relevant for vertical layouts, and is set */ /* relevant for vertical layouts, and is set */
/* to `height' for fonts that do not provide */ /* to `height' for fonts that do not provide */
@ -1338,7 +1342,7 @@ FT_BEGIN_HEADER
/* height :: The height in 26.6 fractional pixels. See */ /* height :: The height in 26.6 fractional pixels. See */
/* @FT_FaceRec for the details. */ /* @FT_FaceRec for the details. */
/* */ /* */
/* max_advance :: The maximal advance width in 26.6 fractional */ /* max_advance :: The maximum advance width in 26.6 fractional */
/* pixels. See @FT_FaceRec for the details. */ /* pixels. See @FT_FaceRec for the details. */
/* */ /* */
/* <Note> */ /* <Note> */
@ -2507,6 +2511,13 @@ FT_BEGIN_HEADER
* Besides deciding which hinter to use, you can also decide which * Besides deciding which hinter to use, you can also decide which
* hinting algorithm to use. See @FT_LOAD_TARGET_XXX for details. * hinting algorithm to use. See @FT_LOAD_TARGET_XXX for details.
* *
* Note that the auto-hinter needs a valid Unicode cmap (either a native
* one or synthesized by FreeType) for producing correct results. If a
* font provides an incorrect mapping (for example, assigning the
* character code U+005A, LATIN CAPITAL LETTER Z, to a glyph depicting a
* mathematical integral sign), the auto-hinter might produce useless
* results.
*
*/ */
#define FT_LOAD_DEFAULT 0x0 #define FT_LOAD_DEFAULT 0x0
#define FT_LOAD_NO_SCALE ( 1L << 0 ) #define FT_LOAD_NO_SCALE ( 1L << 0 )
@ -2580,7 +2591,8 @@ FT_BEGIN_HEADER
* *
* If @FT_LOAD_RENDER is also set, the glyph is rendered in the * If @FT_LOAD_RENDER is also set, the glyph is rendered in the
* corresponding mode (i.e., the mode which matches the used algorithm * corresponding mode (i.e., the mode which matches the used algorithm
* best) unless @FT_LOAD_MONOCHROME is set. * best). An exeption is FT_LOAD_TARGET_MONO since it implies
* @FT_LOAD_MONOCHROME.
* *
* You can use a hinting algorithm that doesn't correspond to the same * You can use a hinting algorithm that doesn't correspond to the same
* rendering mode. As an example, it is possible to use the `light' * rendering mode. As an example, it is possible to use the `light'
@ -2922,7 +2934,7 @@ FT_BEGIN_HEADER
/* */ /* */
/* glyph_index :: The glyph index. */ /* glyph_index :: The glyph index. */
/* */ /* */
/* buffer_max :: The maximal number of bytes available in the */ /* buffer_max :: The maximum number of bytes available in the */
/* buffer. */ /* buffer. */
/* */ /* */
/* <Output> */ /* <Output> */
@ -3081,9 +3093,15 @@ FT_BEGIN_HEADER
/* <Note> */ /* <Note> */
/* If you use FreeType to manipulate the contents of font files */ /* If you use FreeType to manipulate the contents of font files */
/* directly, be aware that the glyph index returned by this function */ /* directly, be aware that the glyph index returned by this function */
/* doesn't always correspond to the internal indices used within */ /* doesn't always correspond to the internal indices used within the */
/* the file. This is done to ensure that value~0 always corresponds */ /* file. This is done to ensure that value~0 always corresponds to */
/* to the `missing glyph'. */ /* the `missing glyph'. If the first glyph is not named `.notdef', */
/* then for Type~1 and Type~42 fonts, `.notdef' will be moved into */
/* the glyph ID~0 position, and whatever was there will be moved to */
/* the position `.notdef' had. For Type~1 fonts, if there is no */
/* `.notdef' glyph at all, then one will be created at index~0 and */
/* whatever was there will be moved to the last index -- Type~42 */
/* fonts are considered invalid under this condition. */
/* */ /* */
FT_EXPORT( FT_UInt ) FT_EXPORT( FT_UInt )
FT_Get_Char_Index( FT_Face face, FT_Get_Char_Index( FT_Face face,
@ -3614,7 +3632,7 @@ FT_BEGIN_HEADER
/* */ /* */
/* <Description> */ /* <Description> */
/* A very simple function used to perform the computation `(a*b)/c' */ /* A very simple function used to perform the computation `(a*b)/c' */
/* with maximal accuracy (it uses a 64-bit intermediate integer */ /* with maximum accuracy (it uses a 64-bit intermediate integer */
/* whenever necessary). */ /* whenever necessary). */
/* */ /* */
/* This function isn't necessarily as fast as some processor specific */ /* This function isn't necessarily as fast as some processor specific */
@ -3649,7 +3667,7 @@ FT_BEGIN_HEADER
/* */ /* */
/* <Description> */ /* <Description> */
/* A very simple function used to perform the computation */ /* A very simple function used to perform the computation */
/* `(a*b)/0x10000' with maximal accuracy. Most of the time this is */ /* `(a*b)/0x10000' with maximum accuracy. Most of the time this is */
/* used to multiply a given value by a 16.16 fixed float factor. */ /* used to multiply a given value by a 16.16 fixed float factor. */
/* */ /* */
/* <Input> */ /* <Input> */
@ -3694,7 +3712,7 @@ FT_BEGIN_HEADER
/* */ /* */
/* <Description> */ /* <Description> */
/* A very simple function used to perform the computation */ /* A very simple function used to perform the computation */
/* `(a*0x10000)/b' with maximal accuracy. Most of the time, this is */ /* `(a*0x10000)/b' with maximum accuracy. Most of the time, this is */
/* used to divide a given value by a 16.16 fixed float factor. */ /* used to divide a given value by a 16.16 fixed float factor. */
/* */ /* */
/* <Input> */ /* <Input> */
@ -3834,7 +3852,7 @@ FT_BEGIN_HEADER
*/ */
#define FREETYPE_MAJOR 2 #define FREETYPE_MAJOR 2
#define FREETYPE_MINOR 4 #define FREETYPE_MINOR 4
#define FREETYPE_PATCH 9 #define FREETYPE_PATCH 10
/*************************************************************************/ /*************************************************************************/

View file

@ -5,7 +5,7 @@
/* Support for the FT_Outline type used to store glyph shapes of */ /* Support for the FT_Outline type used to store glyph shapes of */
/* most scalable font formats (specification). */ /* most scalable font formats (specification). */
/* */ /* */
/* Copyright 1996-2003, 2005-2011 by */ /* Copyright 1996-2003, 2005-2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -59,6 +59,7 @@ FT_BEGIN_HEADER
/* FT_Outline_Translate */ /* FT_Outline_Translate */
/* FT_Outline_Transform */ /* FT_Outline_Transform */
/* FT_Outline_Embolden */ /* FT_Outline_Embolden */
/* FT_Outline_EmboldenXY */
/* FT_Outline_Reverse */ /* FT_Outline_Reverse */
/* FT_Outline_Check */ /* FT_Outline_Check */
/* */ /* */
@ -124,9 +125,9 @@ FT_BEGIN_HEADER
/* outline will *not* necessarily be *freed*, when */ /* outline will *not* necessarily be *freed*, when */
/* destroying the library, by @FT_Done_FreeType. */ /* destroying the library, by @FT_Done_FreeType. */
/* */ /* */
/* numPoints :: The maximal number of points within the outline. */ /* numPoints :: The maximum number of points within the outline. */
/* */ /* */
/* numContours :: The maximal number of contours within the outline. */ /* numContours :: The maximum number of contours within the outline. */
/* */ /* */
/* <Output> */ /* <Output> */
/* anoutline :: A handle to the new outline. */ /* anoutline :: A handle to the new outline. */
@ -350,6 +351,23 @@ FT_BEGIN_HEADER
FT_Pos strength ); FT_Pos strength );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Outline_EmboldenXY */
/* */
/* <Description> */
/* Embolden an outline. The new outline will be `xstrength' pixels */
/* wider and `ystrength' pixels higher. Otherwise, it is similar to */
/* @FT_Outline_Embolden, which uses the same strength in both */
/* directions. */
/* */
FT_EXPORT( FT_Error )
FT_Outline_EmboldenXY( FT_Outline* outline,
FT_Pos xstrength,
FT_Pos ystrength );
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Function> */ /* <Function> */

View file

@ -4,7 +4,7 @@
/* */ /* */
/* FreeType path stroker (specification). */ /* FreeType path stroker (specification). */
/* */ /* */
/* Copyright 2002-2006, 2008, 2009, 2011 by */ /* Copyright 2002-2006, 2008, 2009, 2011-2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -682,6 +682,11 @@ FT_BEGIN_HEADER
* *
* @note: * @note:
* The source glyph is untouched in case of error. * The source glyph is untouched in case of error.
*
* Adding stroke may yield a significantly wider and taller glyph
* depending on how large of a radius was used to stroke the glyph. You
* may need to manually adjust horizontal and vertical advance amounts
* to account for this added size.
*/ */
FT_EXPORT( FT_Error ) FT_EXPORT( FT_Error )
FT_Glyph_Stroke( FT_Glyph *pglyph, FT_Glyph_Stroke( FT_Glyph *pglyph,
@ -719,6 +724,11 @@ FT_BEGIN_HEADER
* *
* @note: * @note:
* The source glyph is untouched in case of error. * The source glyph is untouched in case of error.
*
* Adding stroke may yield a significantly wider and taller glyph
* depending on how large of a radius was used to stroke the glyph. You
* may need to manually adjust horizontal and vertical advance amounts
* to account for this added size.
*/ */
FT_EXPORT( FT_Error ) FT_EXPORT( FT_Error )
FT_Glyph_StrokeBorder( FT_Glyph *pglyph, FT_Glyph_StrokeBorder( FT_Glyph *pglyph,

View file

@ -5,7 +5,7 @@
/* FreeType synthesizing code for emboldening and slanting */ /* FreeType synthesizing code for emboldening and slanting */
/* (specification). */ /* (specification). */
/* */ /* */
/* Copyright 2000-2001, 2003, 2006, 2008 by */ /* Copyright 2000-2001, 2003, 2006, 2008, 2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -61,8 +61,9 @@ FT_BEGIN_HEADER
/* taste). This function is actually a convenience function, providing */ /* taste). This function is actually a convenience function, providing */
/* a wrapper for @FT_Outline_Embolden and @FT_Bitmap_Embolden. */ /* a wrapper for @FT_Outline_Embolden and @FT_Bitmap_Embolden. */
/* */ /* */
/* For emboldened outlines the metrics are estimates only; if you need */ /* For emboldened outlines the height, width, and advance metrics are */
/* precise values you should call @FT_Outline_Get_CBox. */ /* increased by the strength of the emboldening. You can also call */
/* @FT_Outline_Get_CBox to get precise values. */
FT_EXPORT( void ) FT_EXPORT( void )
FT_GlyphSlot_Embolden( FT_GlyphSlot slot ); FT_GlyphSlot_Embolden( FT_GlyphSlot slot );

View file

@ -4,7 +4,7 @@
/* */ /* */
/* Arithmetic computations (specification). */ /* Arithmetic computations (specification). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009 by */ /* Copyright 1996-2006, 2008, 2009, 2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -87,7 +87,7 @@ FT_BEGIN_HEADER
/* */ /* */
/* <Description> */ /* <Description> */
/* A very simple function used to perform the computation `(a*b)/c' */ /* A very simple function used to perform the computation `(a*b)/c' */
/* (without rounding) with maximal accuracy (it uses a 64-bit */ /* (without rounding) with maximum accuracy (it uses a 64-bit */
/* intermediate integer whenever necessary). */ /* intermediate integer whenever necessary). */
/* */ /* */
/* This function isn't necessarily as fast as some processor specific */ /* This function isn't necessarily as fast as some processor specific */

View file

@ -270,13 +270,13 @@ FT_BEGIN_HEADER
/* */ /* */
/* <Fields> */ /* <Fields> */
/* max_points :: */ /* max_points :: */
/* The maximal number of points used to store the vectorial outline */ /* The maximum number of points used to store the vectorial outline */
/* of any glyph in this face. If this value cannot be known in */ /* of any glyph in this face. If this value cannot be known in */
/* advance, or if the face isn't scalable, this should be set to 0. */ /* advance, or if the face isn't scalable, this should be set to 0. */
/* Only relevant for scalable formats. */ /* Only relevant for scalable formats. */
/* */ /* */
/* max_contours :: */ /* max_contours :: */
/* The maximal number of contours used to store the vectorial */ /* The maximum number of contours used to store the vectorial */
/* outline of any glyph in this face. If this value cannot be */ /* outline of any glyph in this face. If this value cannot be */
/* known in advance, or if the face isn't scalable, this should be */ /* known in advance, or if the face isn't scalable, this should be */
/* set to 0. Only relevant for scalable formats. */ /* set to 0. Only relevant for scalable formats. */

View file

@ -5,7 +5,7 @@
/* Auxiliary functions and data structures related to PostScript fonts */ /* Auxiliary functions and data structures related to PostScript fonts */
/* (specification). */ /* (specification). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2008, 2009 by */ /* Copyright 1996-2004, 2006, 2008, 2009, 2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -225,7 +225,7 @@ FT_BEGIN_HEADER
T1_Field_ParseFunc reader; T1_Field_ParseFunc reader;
FT_UInt offset; /* offset of field in object */ FT_UInt offset; /* offset of field in object */
FT_Byte size; /* size of field in bytes */ FT_Byte size; /* size of field in bytes */
FT_UInt array_max; /* maximal number of elements for */ FT_UInt array_max; /* maximum number of elements for */
/* array */ /* array */
FT_UInt count_offset; /* offset of element count for */ FT_UInt count_offset; /* offset of element count for */
/* arrays; must not be zero if in */ /* arrays; must not be zero if in */
@ -531,7 +531,7 @@ FT_BEGIN_HEADER
/* */ /* */
/* max_points :: maximum points in builder outline */ /* max_points :: maximum points in builder outline */
/* */ /* */
/* max_contours :: Maximal number of contours in builder outline. */ /* max_contours :: Maximum number of contours in builder outline. */
/* */ /* */
/* pos_x :: The horizontal translation (if composite glyph). */ /* pos_x :: The horizontal translation (if composite glyph). */
/* */ /* */

View file

@ -5,7 +5,7 @@
/* Basic SFNT/TrueType type definitions and interface (specification */ /* Basic SFNT/TrueType type definitions and interface (specification */
/* only). */ /* only). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2004, 2005, 2006, 2007, 2008 by */ /* Copyright 1996-2002, 2004-2008, 2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -1443,7 +1443,7 @@ FT_BEGIN_HEADER
/* <Fields> */ /* <Fields> */
/* memory :: A handle to the memory manager. */ /* memory :: A handle to the memory manager. */
/* */ /* */
/* max_points :: The maximal size in points of the zone. */ /* max_points :: The maximum size in points of the zone. */
/* */ /* */
/* max_contours :: Max size in links contours of the zone. */ /* max_contours :: Max size in links contours of the zone. */
/* */ /* */

View file

@ -702,7 +702,8 @@ FT_BEGIN_HEADER
* FreeType error code. 0~means success. * FreeType error code. 0~means success.
* *
* @note: * @note:
* SFNT tables with length zero are treated as missing. * While parsing fonts, FreeType handles SFNT tables with length zero as
* missing.
* *
*/ */
FT_EXPORT( FT_Error ) FT_EXPORT( FT_Error )

View file

@ -4,7 +4,7 @@
/* */ /* */
/* Auto-fitter hinting routines for latin script (body). */ /* Auto-fitter hinting routines for latin script (body). */
/* */ /* */
/* Copyright 2003-2011 by */ /* Copyright 2003-2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -705,6 +705,7 @@
{ {
metrics->root.scaler.render_mode = scaler->render_mode; metrics->root.scaler.render_mode = scaler->render_mode;
metrics->root.scaler.face = scaler->face; metrics->root.scaler.face = scaler->face;
metrics->root.scaler.flags = scaler->flags;
af_latin_metrics_scale_dim( metrics, scaler, AF_DIMENSION_HORZ ); af_latin_metrics_scale_dim( metrics, scaler, AF_DIMENSION_HORZ );
af_latin_metrics_scale_dim( metrics, scaler, AF_DIMENSION_VERT ); af_latin_metrics_scale_dim( metrics, scaler, AF_DIMENSION_VERT );

View file

@ -4,7 +4,7 @@
/* */ /* */
/* Auto-fitter hinting routines for latin script (body). */ /* Auto-fitter hinting routines for latin script (body). */
/* */ /* */
/* Copyright 2003-2011 by */ /* Copyright 2003-2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -658,6 +658,7 @@
{ {
metrics->root.scaler.render_mode = scaler->render_mode; metrics->root.scaler.render_mode = scaler->render_mode;
metrics->root.scaler.face = scaler->face; metrics->root.scaler.face = scaler->face;
metrics->root.scaler.flags = scaler->flags;
af_latin2_metrics_scale_dim( metrics, scaler, AF_DIMENSION_HORZ ); af_latin2_metrics_scale_dim( metrics, scaler, AF_DIMENSION_HORZ );
af_latin2_metrics_scale_dim( metrics, scaler, AF_DIMENSION_VERT ); af_latin2_metrics_scale_dim( metrics, scaler, AF_DIMENSION_VERT );

View file

@ -104,9 +104,11 @@
AF_GlyphHints hints = &loader->hints; AF_GlyphHints hints = &loader->hints;
FT_GlyphSlot slot = face->glyph; FT_GlyphSlot slot = face->glyph;
FT_Slot_Internal internal = slot->internal; FT_Slot_Internal internal = slot->internal;
FT_Int32 flags;
error = FT_Load_Glyph( face, glyph_index, load_flags ); flags = load_flags | FT_LOAD_LINEAR_DESIGN;
error = FT_Load_Glyph( face, glyph_index, flags );
if ( error ) if ( error )
goto Exit; goto Exit;
@ -124,10 +126,6 @@
FT_Vector_Transform( &loader->trans_delta, &inverse ); FT_Vector_Transform( &loader->trans_delta, &inverse );
} }
/* set linear metrics */
slot->linearHoriAdvance = slot->metrics.horiAdvance;
slot->linearVertAdvance = slot->metrics.vertAdvance;
switch ( slot->format ) switch ( slot->format )
{ {
case FT_GLYPH_FORMAT_OUTLINE: case FT_GLYPH_FORMAT_OUTLINE:

View file

@ -881,10 +881,20 @@
FT_EXPORT_DEF( FT_Error ) FT_EXPORT_DEF( FT_Error )
FT_Outline_Embolden( FT_Outline* outline, FT_Outline_Embolden( FT_Outline* outline,
FT_Pos strength ) FT_Pos strength )
{
return FT_Outline_EmboldenXY( outline, strength, strength );
}
/* documentation is in ftoutln.h */
FT_EXPORT_DEF( FT_Error )
FT_Outline_EmboldenXY( FT_Outline* outline,
FT_Pos xstrength,
FT_Pos ystrength )
{ {
FT_Vector* points; FT_Vector* points;
FT_Vector v_prev, v_first, v_next, v_cur; FT_Vector v_prev, v_first, v_next, v_cur;
FT_Angle rotate, angle_in, angle_out;
FT_Int c, n, first; FT_Int c, n, first;
FT_Int orientation; FT_Int orientation;
@ -892,8 +902,9 @@
if ( !outline ) if ( !outline )
return FT_Err_Invalid_Argument; return FT_Err_Invalid_Argument;
strength /= 2; xstrength /= 2;
if ( strength == 0 ) ystrength /= 2;
if ( xstrength == 0 && ystrength == 0 )
return FT_Err_Ok; return FT_Err_Ok;
orientation = FT_Outline_Get_Orientation( outline ); orientation = FT_Outline_Get_Orientation( outline );
@ -905,16 +916,13 @@
return FT_Err_Ok; return FT_Err_Ok;
} }
if ( orientation == FT_ORIENTATION_TRUETYPE )
rotate = -FT_ANGLE_PI2;
else
rotate = FT_ANGLE_PI2;
points = outline->points; points = outline->points;
first = 0; first = 0;
for ( c = 0; c < outline->n_contours; c++ ) for ( c = 0; c < outline->n_contours; c++ )
{ {
FT_Vector in, out, shift;
FT_Fixed l_in, l_out, d;
int last = outline->contours[c]; int last = outline->contours[c];
@ -922,44 +930,48 @@
v_prev = points[last]; v_prev = points[last];
v_cur = v_first; v_cur = v_first;
/* compute the incoming vector and its length */
in.x = v_cur.x - v_prev.x;
in.y = v_cur.y - v_prev.y;
l_in = FT_Vector_Length( &in );
for ( n = first; n <= last; n++ ) for ( n = first; n <= last; n++ )
{ {
FT_Vector in, out;
FT_Angle angle_diff;
FT_Pos d;
FT_Fixed scale;
if ( n < last ) if ( n < last )
v_next = points[n + 1]; v_next = points[n + 1];
else else
v_next = v_first; v_next = v_first;
/* compute the in and out vectors */ /* compute the outgoing vector and its length */
in.x = v_cur.x - v_prev.x;
in.y = v_cur.y - v_prev.y;
out.x = v_next.x - v_cur.x; out.x = v_next.x - v_cur.x;
out.y = v_next.y - v_cur.y; out.y = v_next.y - v_cur.y;
l_out = FT_Vector_Length( &out );
angle_in = FT_Atan2( in.x, in.y ); d = l_in * l_out + in.x * out.x + in.y * out.y;
angle_out = FT_Atan2( out.x, out.y );
angle_diff = FT_Angle_Diff( angle_in, angle_out );
scale = FT_Cos( angle_diff / 2 );
if ( scale < 0x4000L && scale > -0x4000L ) /* shift only if turn is less then ~160 degrees */
in.x = in.y = 0; if ( 16 * d > l_in * l_out )
else
{ {
d = FT_DivFix( strength, scale ); /* shift components are rotated */
shift.x = FT_DivFix( l_out * in.y + l_in * out.y, d );
shift.y = FT_DivFix( l_out * in.x + l_in * out.x, d );
FT_Vector_From_Polar( &in, d, angle_in + angle_diff / 2 - rotate ); if ( orientation == FT_ORIENTATION_TRUETYPE )
shift.x = -shift.x;
else
shift.y = -shift.y;
shift.x = FT_MulFix( xstrength, shift.x );
shift.y = FT_MulFix( ystrength, shift.y );
} }
else
shift.x = shift.y = 0;
outline->points[n].x = v_cur.x + strength + in.x; outline->points[n].x = v_cur.x + xstrength + shift.x;
outline->points[n].y = v_cur.y + strength + in.y; outline->points[n].y = v_cur.y + ystrength + shift.y;
v_prev = v_cur; in = out;
l_in = l_out;
v_cur = v_next; v_cur = v_next;
} }
@ -975,23 +987,10 @@
FT_EXPORT_DEF( FT_Orientation ) FT_EXPORT_DEF( FT_Orientation )
FT_Outline_Get_Orientation( FT_Outline* outline ) FT_Outline_Get_Orientation( FT_Outline* outline )
{ {
FT_Pos xmin = 32768L; FT_Vector* points;
FT_Pos xmin_ymin = 32768L; FT_Vector v_prev, v_cur;
FT_Pos xmin_ymax = -32768L; FT_Int c, n, first;
FT_Vector* xmin_first = NULL; FT_Pos area = 0;
FT_Vector* xmin_last = NULL;
short* contour;
FT_Vector* first;
FT_Vector* last;
FT_Vector* prev;
FT_Vector* point;
int i;
FT_Pos ray_y[3];
FT_Orientation result[3] =
{ FT_ORIENTATION_NONE, FT_ORIENTATION_NONE, FT_ORIENTATION_NONE };
if ( !outline || outline->n_points <= 0 ) if ( !outline || outline->n_points <= 0 )
@ -1002,127 +1001,32 @@
/* cubic or quadratic curves, this test deals with the polygon */ /* cubic or quadratic curves, this test deals with the polygon */
/* only which is spanned up by the control points. */ /* only which is spanned up by the control points. */
first = outline->points; points = outline->points;
for ( contour = outline->contours;
contour < outline->contours + outline->n_contours; first = 0;
contour++, first = last + 1 ) for ( c = 0; c < outline->n_contours; c++ )
{ {
FT_Pos contour_xmin = 32768L; FT_Int last = outline->contours[c];
FT_Pos contour_xmax = -32768L;
FT_Pos contour_ymin = 32768L;
FT_Pos contour_ymax = -32768L;
last = outline->points + *contour; v_prev = points[last];
/* skip degenerate contours */ for ( n = first; n <= last; n++ )
if ( last < first + 2 )
continue;
for ( point = first; point <= last; ++point )
{ {
if ( point->x < contour_xmin ) v_cur = points[n];
contour_xmin = point->x; area += ( v_cur.y - v_prev.y ) * ( v_cur.x + v_prev.x );
v_prev = v_cur;
if ( point->x > contour_xmax )
contour_xmax = point->x;
if ( point->y < contour_ymin )
contour_ymin = point->y;
if ( point->y > contour_ymax )
contour_ymax = point->y;
} }
if ( contour_xmin < xmin && first = last + 1;
contour_xmin != contour_xmax &&
contour_ymin != contour_ymax )
{
xmin = contour_xmin;
xmin_ymin = contour_ymin;
xmin_ymax = contour_ymax;
xmin_first = first;
xmin_last = last;
}
} }
if ( xmin == 32768L ) if ( area > 0 )
return FT_ORIENTATION_POSTSCRIPT;
else if ( area < 0 )
return FT_ORIENTATION_TRUETYPE; return FT_ORIENTATION_TRUETYPE;
ray_y[0] = ( xmin_ymin * 3 + xmin_ymax ) >> 2;
ray_y[1] = ( xmin_ymin + xmin_ymax ) >> 1;
ray_y[2] = ( xmin_ymin + xmin_ymax * 3 ) >> 2;
for ( i = 0; i < 3; i++ )
{
FT_Pos left_x;
FT_Pos right_x;
FT_Vector* left1;
FT_Vector* left2;
FT_Vector* right1;
FT_Vector* right2;
RedoRay:
left_x = 32768L;
right_x = -32768L;
left1 = left2 = right1 = right2 = NULL;
prev = xmin_last;
for ( point = xmin_first; point <= xmin_last; prev = point, ++point )
{
FT_Pos tmp_x;
if ( point->y == ray_y[i] || prev->y == ray_y[i] )
{
ray_y[i]++;
goto RedoRay;
}
if ( ( point->y < ray_y[i] && prev->y < ray_y[i] ) ||
( point->y > ray_y[i] && prev->y > ray_y[i] ) )
continue;
tmp_x = FT_MulDiv( point->x - prev->x,
ray_y[i] - prev->y,
point->y - prev->y ) + prev->x;
if ( tmp_x < left_x )
{
left_x = tmp_x;
left1 = prev;
left2 = point;
}
if ( tmp_x > right_x )
{
right_x = tmp_x;
right1 = prev;
right2 = point;
}
}
if ( left1 && right1 )
{
if ( left1->y < left2->y && right1->y > right2->y )
result[i] = FT_ORIENTATION_TRUETYPE;
else if ( left1->y > left2->y && right1->y < right2->y )
result[i] = FT_ORIENTATION_POSTSCRIPT;
else else
result[i] = FT_ORIENTATION_NONE; return FT_ORIENTATION_NONE;
}
}
if ( result[0] != FT_ORIENTATION_NONE &&
( result[0] == result[1] || result[0] == result[2] ) )
return result[0];
if ( result[1] != FT_ORIENTATION_NONE && result[1] == result[2] )
return result[1];
return FT_ORIENTATION_TRUETYPE;
} }

View file

@ -4,7 +4,7 @@
/* */ /* */
/* FreeType synthesizing code for emboldening and slanting (body). */ /* FreeType synthesizing code for emboldening and slanting (body). */
/* */ /* */
/* Copyright 2000-2001, 2002, 2003, 2004, 2005, 2006, 2010 by */ /* Copyright 2000-2006, 2010, 2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -33,6 +33,7 @@
#undef FT_COMPONENT #undef FT_COMPONENT
#define FT_COMPONENT trace_synth #define FT_COMPONENT trace_synth
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
/**** ****/ /**** ****/
@ -72,7 +73,7 @@
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
/**** ****/ /**** ****/
/**** EXPERIMENTAL EMBOLDENING/OUTLINING SUPPORT ****/ /**** EXPERIMENTAL EMBOLDENING SUPPORT ****/
/**** ****/ /**** ****/
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
@ -101,12 +102,7 @@
if ( slot->format == FT_GLYPH_FORMAT_OUTLINE ) if ( slot->format == FT_GLYPH_FORMAT_OUTLINE )
{ {
/* ignore error */ /* ignore error */
(void)FT_Outline_Embolden( &slot->outline, xstr ); (void)FT_Outline_EmboldenXY( &slot->outline, xstr, ystr );
/* this is more than enough for most glyphs; if you need accurate */
/* values, you have to call FT_Outline_Get_CBox */
xstr = xstr * 2;
ystr = xstr;
} }
else /* slot->format == FT_GLYPH_FORMAT_BITMAP */ else /* slot->format == FT_GLYPH_FORMAT_BITMAP */
{ {
@ -145,10 +141,7 @@
slot->metrics.width += xstr; slot->metrics.width += xstr;
slot->metrics.height += ystr; slot->metrics.height += ystr;
slot->metrics.horiBearingY += ystr;
slot->metrics.horiAdvance += xstr; slot->metrics.horiAdvance += xstr;
slot->metrics.vertBearingX -= xstr / 2;
slot->metrics.vertBearingY += ystr;
slot->metrics.vertAdvance += ystr; slot->metrics.vertAdvance += ystr;
/* XXX: 16-bit overflow case must be excluded before here */ /* XXX: 16-bit overflow case must be excluded before here */

View file

@ -569,6 +569,7 @@
list->field[1] = (char*)empty; list->field[1] = (char*)empty;
list->field[2] = (char*)empty; list->field[2] = (char*)empty;
list->field[3] = (char*)empty; list->field[3] = (char*)empty;
list->field[4] = (char*)empty;
} }
/* If the line is empty, then simply return. */ /* If the line is empty, then simply return. */
@ -841,9 +842,6 @@
}; };
#define isdigok( m, d ) (m[(d) >> 3] & ( 1 << ( (d) & 7 ) ) )
/* Routine to convert an ASCII string into an unsigned long integer. */ /* Routine to convert an ASCII string into an unsigned long integer. */
static unsigned long static unsigned long
_bdf_atoul( char* s, _bdf_atoul( char* s,
@ -881,7 +879,7 @@
s += 2; s += 2;
} }
for ( v = 0; isdigok( dmap, *s ); s++ ) for ( v = 0; sbitset( dmap, *s ); s++ )
v = v * base + a2i[(int)*s]; v = v * base + a2i[(int)*s];
if ( end != 0 ) if ( end != 0 )
@ -936,7 +934,7 @@
s += 2; s += 2;
} }
for ( v = 0; isdigok( dmap, *s ); s++ ) for ( v = 0; sbitset( dmap, *s ); s++ )
v = v * base + a2i[(int)*s]; v = v * base + a2i[(int)*s];
if ( end != 0 ) if ( end != 0 )
@ -991,7 +989,7 @@
s += 2; s += 2;
} }
for ( v = 0; isdigok( dmap, *s ); s++ ) for ( v = 0; sbitset( dmap, *s ); s++ )
v = (short)( v * base + a2i[(int)*s] ); v = (short)( v * base + a2i[(int)*s] );
if ( end != 0 ) if ( end != 0 )
@ -1746,7 +1744,7 @@
for ( i = 0; i < nibbles; i++ ) for ( i = 0; i < nibbles; i++ )
{ {
c = line[i]; c = line[i];
if ( !isdigok( hdigits, c ) ) if ( !sbitset( hdigits, c ) )
break; break;
*bp = (FT_Byte)( ( *bp << 4 ) + a2i[c] ); *bp = (FT_Byte)( ( *bp << 4 ) + a2i[c] );
if ( i + 1 < nibbles && ( i & 1 ) ) if ( i + 1 < nibbles && ( i & 1 ) )
@ -1770,7 +1768,7 @@
/* If any line has extra columns, indicate they have been removed. */ /* If any line has extra columns, indicate they have been removed. */
if ( i == nibbles && if ( i == nibbles &&
isdigok( hdigits, line[nibbles] ) && sbitset( hdigits, line[nibbles] ) &&
!( p->flags & _BDF_GLYPH_WIDTH_CHECK ) ) !( p->flags & _BDF_GLYPH_WIDTH_CHECK ) )
{ {
FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG14, glyph->encoding )); FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG14, glyph->encoding ));

View file

@ -4,8 +4,7 @@
/* */ /* */
/* PostScript hinting algorithm (body). */ /* PostScript hinting algorithm (body). */
/* */ /* */
/* Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 */ /* Copyright 2001-2010, 2012 by */
/* by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used */ /* This file is part of the FreeType project, and may only be used */
@ -563,7 +562,7 @@
else if ( len > 0 ) else if ( len > 0 )
{ {
/* This is a very small stem; we simply align it to the /* This is a very small stem; we simply align it to the
* pixel grid, trying to find the minimal displacement. * pixel grid, trying to find the minimum displacement.
* *
* left = pos * left = pos
* right = pos + len * right = pos + len

View file

@ -115,6 +115,27 @@
return ( s > 0 ) ? d : -d; return ( s > 0 ) ? d : -d;
} }
static FT_Long
FT_MulDiv_No_Round( FT_Long a,
FT_Long b,
FT_Long c )
{
FT_Int s;
FT_Long d;
s = 1;
if ( a < 0 ) { a = -a; s = -1; }
if ( b < 0 ) { b = -b; s = -s; }
if ( c < 0 ) { c = -c; s = -s; }
d = (FT_Long)( c > 0 ? (FT_Int64)a * b / c
: 0x7FFFFFFFL );
return ( s > 0 ) ? d : -d;
}
#endif /* __FTMISC_H__ */ #endif /* __FTMISC_H__ */

View file

@ -60,7 +60,7 @@
#include <ft2build.h> #include <ft2build.h>
#include "ftraster.h" #include "ftraster.h"
#include FT_INTERNAL_CALC_H /* for FT_MulDiv only */ #include FT_INTERNAL_CALC_H /* for FT_MulDiv and FT_MulDiv_No_Round */
#include "rastpic.h" #include "rastpic.h"
@ -256,6 +256,7 @@
/* for clipping computations. It simply uses the FT_MulDiv() function */ /* for clipping computations. It simply uses the FT_MulDiv() function */
/* defined in `ftcalc.h'. */ /* defined in `ftcalc.h'. */
#define SMulDiv FT_MulDiv #define SMulDiv FT_MulDiv
#define SMulDiv_No_Round FT_MulDiv_No_Round
/* The rasterizer is a very general purpose component; please leave */ /* The rasterizer is a very general purpose component; please leave */
/* the following redefinitions there (you never know your target */ /* the following redefinitions there (you never know your target */
@ -1150,13 +1151,13 @@
if ( Dx > 0 ) if ( Dx > 0 )
{ {
Ix = SMulDiv( ras.precision, Dx, Dy); Ix = SMulDiv_No_Round( ras.precision, Dx, Dy );
Rx = ( ras.precision * Dx ) % Dy; Rx = ( ras.precision * Dx ) % Dy;
Dx = 1; Dx = 1;
} }
else else
{ {
Ix = SMulDiv( ras.precision, -Dx, Dy) * -1; Ix = -SMulDiv_No_Round( ras.precision, -Dx, Dy );
Rx = ( ras.precision * -Dx ) % Dy; Rx = ( ras.precision * -Dx ) % Dy;
Dx = -1; Dx = -1;
} }

View file

@ -4,7 +4,7 @@
/* */ /* */
/* SFNT object management (base). */ /* SFNT object management (base). */
/* */ /* */
/* Copyright 1996-2008, 2010-2011 by */ /* Copyright 1996-2008, 2010-2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -64,13 +64,17 @@
for ( n = 0; n < len; n++ ) for ( n = 0; n < len; n++ )
{ {
code = FT_NEXT_USHORT( read ); code = FT_NEXT_USHORT( read );
if ( code == 0 )
break;
if ( code < 32 || code > 127 ) if ( code < 32 || code > 127 )
code = '?'; code = '?';
string[n] = (char)code; string[n] = (char)code;
} }
string[len] = 0; string[n] = 0;
return string; return string;
} }
@ -95,13 +99,17 @@
for ( n = 0; n < len; n++ ) for ( n = 0; n < len; n++ )
{ {
code = *read++; code = *read++;
if ( code == 0 )
break;
if ( code < 32 || code > 127 ) if ( code < 32 || code > 127 )
code = '?'; code = '?';
string[n] = (char)code; string[n] = (char)code;
} }
string[len] = 0; string[n] = 0;
return string; return string;
} }

View file

@ -5,8 +5,7 @@
/* Load the basic TrueType tables, i.e., tables that can be either in */ /* Load the basic TrueType tables, i.e., tables that can be either in */
/* TTF or OTF fonts (body). */ /* TTF or OTF fonts (body). */
/* */ /* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */ /* Copyright 1996-2010, 2012 by */
/* 2010 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -624,7 +623,7 @@
FT_Error error; FT_Error error;
TT_MaxProfile* maxProfile = &face->max_profile; TT_MaxProfile* maxProfile = &face->max_profile;
const FT_Frame_Field maxp_fields[] = static const FT_Frame_Field maxp_fields[] =
{ {
#undef FT_STRUCTURE #undef FT_STRUCTURE
#define FT_STRUCTURE TT_MaxProfile #define FT_STRUCTURE TT_MaxProfile
@ -635,7 +634,7 @@
FT_FRAME_END FT_FRAME_END
}; };
const FT_Frame_Field maxp_fields_extra[] = static const FT_Frame_Field maxp_fields_extra[] =
{ {
FT_FRAME_START( 26 ), FT_FRAME_START( 26 ),
FT_FRAME_USHORT( maxPoints ), FT_FRAME_USHORT( maxPoints ),
@ -721,7 +720,7 @@
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Function> */ /* <Function> */
/* tt_face_load_names */ /* tt_face_load_name */
/* */ /* */
/* <Description> */ /* <Description> */
/* Loads the name records. */ /* Loads the name records. */
@ -952,7 +951,7 @@
FT_Error error; FT_Error error;
TT_OS2* os2; TT_OS2* os2;
const FT_Frame_Field os2_fields[] = static const FT_Frame_Field os2_fields[] =
{ {
#undef FT_STRUCTURE #undef FT_STRUCTURE
#define FT_STRUCTURE TT_OS2 #define FT_STRUCTURE TT_OS2
@ -1004,7 +1003,7 @@
FT_FRAME_END FT_FRAME_END
}; };
const FT_Frame_Field os2_fields_extra[] = static const FT_Frame_Field os2_fields_extra[] =
{ {
FT_FRAME_START( 8 ), FT_FRAME_START( 8 ),
FT_FRAME_ULONG( ulCodePageRange1 ), FT_FRAME_ULONG( ulCodePageRange1 ),
@ -1012,7 +1011,7 @@
FT_FRAME_END FT_FRAME_END
}; };
const FT_Frame_Field os2_fields_extra2[] = static const FT_Frame_Field os2_fields_extra2[] =
{ {
FT_FRAME_START( 10 ), FT_FRAME_START( 10 ),
FT_FRAME_SHORT ( sxHeight ), FT_FRAME_SHORT ( sxHeight ),

View file

@ -4,7 +4,7 @@
/* */ /* */
/* Load the metrics tables common to TTF and OTF fonts (body). */ /* Load the metrics tables common to TTF and OTF fonts (body). */
/* */ /* */
/* Copyright 2006-2009, 2011 by */ /* Copyright 2006-2009, 2011-2012 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */ /* */
/* This file is part of the FreeType project, and may only be used, */ /* This file is part of the FreeType project, and may only be used, */
@ -260,7 +260,7 @@
FT_Error error; FT_Error error;
TT_HoriHeader* header; TT_HoriHeader* header;
const FT_Frame_Field metrics_header_fields[] = static const FT_Frame_Field metrics_header_fields[] =
{ {
#undef FT_STRUCTURE #undef FT_STRUCTURE
#define FT_STRUCTURE TT_HoriHeader #define FT_STRUCTURE TT_HoriHeader

View file

@ -312,7 +312,7 @@ typedef ptrdiff_t FT_PtrDist;
#endif /* PIXEL_BITS >= 8 */ #endif /* PIXEL_BITS >= 8 */
/* maximal number of gray spans in a call to the span callback */ /* maximum number of gray spans in a call to the span callback */
#define FT_MAX_GRAY_SPANS 32 #define FT_MAX_GRAY_SPANS 32

View file

@ -1983,12 +1983,10 @@
FT_UInt glyph_index, FT_UInt glyph_index,
FT_Int32 load_flags ) FT_Int32 load_flags )
{ {
TT_Face face;
FT_Error error; FT_Error error;
TT_LoaderRec loader; TT_LoaderRec loader;
face = (TT_Face)glyph->face;
error = TT_Err_Ok; error = TT_Err_Ok;
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
@ -2003,10 +2001,7 @@
error = load_sbit_image( size, glyph, glyph_index, load_flags ); error = load_sbit_image( size, glyph, glyph_index, load_flags );
if ( !error ) if ( !error )
{ {
FT_Face root = &face->root; if ( FT_IS_SCALABLE( glyph->face ) )
if ( FT_IS_SCALABLE( root ) )
{ {
/* for the bbox we need the header only */ /* for the bbox we need the header only */
(void)tt_loader_init( &loader, size, glyph, load_flags, TRUE ); (void)tt_loader_init( &loader, size, glyph, load_flags, TRUE );

View file

@ -52,7 +52,7 @@
/* */ /* */
/* In order to detect infinite loops in the code, we set up a counter */ /* In order to detect infinite loops in the code, we set up a counter */
/* within the run loop. A single stroke of interpretation is now */ /* within the run loop. A single stroke of interpretation is now */
/* limited to a maximal number of opcodes defined below. */ /* limited to a maximum number of opcodes defined below. */
/* */ /* */
#define MAX_RUNNABLE_OPCODES 1000000L #define MAX_RUNNABLE_OPCODES 1000000L
@ -1463,7 +1463,7 @@
#else #else
/* compute (a*b)/2^14 with maximal accuracy and rounding */ /* compute (a*b)/2^14 with maximum accuracy and rounding */
static FT_Int32 static FT_Int32
TT_MulFix14( FT_Int32 a, TT_MulFix14( FT_Int32 a,
FT_Int b ) FT_Int b )
@ -1493,7 +1493,7 @@
#endif #endif
/* compute (ax*bx+ay*by)/2^14 with maximal accuracy and rounding */ /* compute (ax*bx+ay*by)/2^14 with maximum accuracy and rounding */
static FT_Int32 static FT_Int32
TT_DotFix14( FT_Int32 ax, TT_DotFix14( FT_Int32 ax,
FT_Int32 ay, FT_Int32 ay,
@ -3110,14 +3110,9 @@
CUR.GS.single_width_cutin = (FT_F26Dot6)args[0]; CUR.GS.single_width_cutin = (FT_F26Dot6)args[0];
/* XXX: UNDOCUMENTED! or bug in the Windows engine? */
/* */
/* It seems that the value that is read here is */
/* expressed in 16.16 format rather than in font */
/* units. */
/* */
#define DO_SSW \ #define DO_SSW \
CUR.GS.single_width_value = (FT_F26Dot6)( args[0] >> 10 ); CUR.GS.single_width_value = TT_MULFIX( args[0], \
CUR.tt_metrics.scale );
#define DO_FLIPON \ #define DO_FLIPON \
@ -5772,7 +5767,7 @@
/* */ /* */
/* UNDOCUMENTED: According to Greg Hitchcock, there is one (virtual) */ /* UNDOCUMENTED: According to Greg Hitchcock, there is one (virtual) */
/* contour in the twilight zone, namely contour number */ /* contour in the twilight zone, namely contour number */
/* zero. */ /* zero which includes all points of it. */
/* */ /* */
static void static void
Ins_SHC( INS_ARG ) Ins_SHC( INS_ARG )

View file

@ -244,7 +244,7 @@
tt_check_trickyness_sfnt_ids( TT_Face face ) tt_check_trickyness_sfnt_ids( TT_Face face )
{ {
#define TRICK_SFNT_IDS_PER_FACE 3 #define TRICK_SFNT_IDS_PER_FACE 3
#define TRICK_SFNT_IDS_NUM_FACES 13 #define TRICK_SFNT_IDS_NUM_FACES 17
static const tt_sfnt_id_rec sfnt_id[TRICK_SFNT_IDS_NUM_FACES] static const tt_sfnt_id_rec sfnt_id[TRICK_SFNT_IDS_NUM_FACES]
[TRICK_SFNT_IDS_PER_FACE] = { [TRICK_SFNT_IDS_PER_FACE] = {
@ -317,6 +317,26 @@
{ 0x00000000, 0x00000000 }, /* cvt */ { 0x00000000, 0x00000000 }, /* cvt */
{ 0x0d3de9cb, 0x00000141 }, /* fpgm */ { 0x0d3de9cb, 0x00000141 }, /* fpgm */
{ 0xd4127766, 0x00002280 } /* prep */ { 0xd4127766, 0x00002280 } /* prep */
},
{ /* NEC FA-Gothic, 1996 */
{ 0x00000000, 0x00000000 }, /* cvt */
{ 0x4a692698, 0x000001f0 }, /* fpgm */
{ 0x340d4346, 0x00001fca } /* prep */
},
{ /* NEC FA-Minchou, 1996 */
{ 0x00000000, 0x00000000 }, /* cvt */
{ 0xcd34c604, 0x00000166 }, /* fpgm */
{ 0x6cf31046, 0x000022b0 } /* prep */
},
{ /* NEC FA-RoundGothicB, 1996 */
{ 0x00000000, 0x00000000 }, /* cvt */
{ 0x5da75315, 0x0000019d }, /* fpgm */
{ 0x40745a5f, 0x000022e0 } /* prep */
},
{ /* NEC FA-RoundGothicM, 1996 */
{ 0x00000000, 0x00000000 }, /* cvt */
{ 0xf055fc48, 0x000001c2 }, /* fpgm */
{ 0x3900ded3, 0x00001e18 } /* prep */
} }
}; };

View file

@ -71,6 +71,13 @@
#include "t1errors.h" #include "t1errors.h"
#ifdef FT_CONFIG_OPTION_INCREMENTAL
#define IS_INCREMENTAL ( face->root.internal->incremental_interface != 0 )
#else
#define IS_INCREMENTAL 0
#endif
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
@ -1004,6 +1011,8 @@
max_objects = 0; max_objects = 0;
} }
if ( *objects )
{
if ( field->type == T1_FIELD_TYPE_INTEGER_ARRAY || if ( field->type == T1_FIELD_TYPE_INTEGER_ARRAY ||
field->type == T1_FIELD_TYPE_FIXED_ARRAY ) field->type == T1_FIELD_TYPE_FIXED_ARRAY )
error = T1_Load_Field_Table( &loader->parser, field, error = T1_Load_Field_Table( &loader->parser, field,
@ -1011,6 +1020,15 @@
else else
error = T1_Load_Field( &loader->parser, field, error = T1_Load_Field( &loader->parser, field,
objects, max_objects, 0 ); objects, max_objects, 0 );
}
else
{
FT_TRACE1(( "t1_load_keyword: ignoring keyword `%s'"
" which is not valid at this point\n"
" (probably due to missing keywords)\n",
field->ident ));
error = T1_Err_Ok;
}
Exit: Exit:
return error; return error;
@ -1030,7 +1048,8 @@
static int static int
read_binary_data( T1_Parser parser, read_binary_data( T1_Parser parser,
FT_Long* size, FT_Long* size,
FT_Byte** base ) FT_Byte** base,
FT_Bool incremental )
{ {
FT_Byte* cur; FT_Byte* cur;
FT_Byte* limit = parser->root.limit; FT_Byte* limit = parser->root.limit;
@ -1065,8 +1084,12 @@
} }
} }
if( !incremental )
{
FT_ERROR(( "read_binary_data: invalid size field\n" )); FT_ERROR(( "read_binary_data: invalid size field\n" ));
parser->root.error = T1_Err_Invalid_File_Format; parser->root.error = T1_Err_Invalid_File_Format;
}
return 0; return 0;
} }
@ -1387,8 +1410,9 @@
FT_Byte* base; FT_Byte* base;
/* If the next token isn't `dup' we are done. */ /* If we are out of data, or if the next token isn't `dup', */
if ( parser->root.cursor + 4 < parser->root.limit && /* we are done. */
if ( parser->root.cursor + 4 >= parser->root.limit ||
ft_strncmp( (char*)parser->root.cursor, "dup", 3 ) != 0 ) ft_strncmp( (char*)parser->root.cursor, "dup", 3 ) != 0 )
break; break;
@ -1396,7 +1420,7 @@
idx = T1_ToInt( parser ); idx = T1_ToInt( parser );
if ( !read_binary_data( parser, &size, &base ) ) if ( !read_binary_data( parser, &size, &base, IS_INCREMENTAL ) )
return; return;
/* The binary string is followed by one token, e.g. `NP' */ /* The binary string is followed by one token, e.g. `NP' */
@ -1582,7 +1606,7 @@
cur++; /* skip `/' */ cur++; /* skip `/' */
len = parser->root.cursor - cur; len = parser->root.cursor - cur;
if ( !read_binary_data( parser, &size, &base ) ) if ( !read_binary_data( parser, &size, &base, IS_INCREMENTAL ) )
return; return;
/* for some non-standard fonts like `Optima' which provides */ /* for some non-standard fonts like `Optima' which provides */
@ -1871,7 +1895,7 @@
parser->root.cursor = start_binary; parser->root.cursor = start_binary;
if ( !read_binary_data( parser, &s, &b ) ) if ( !read_binary_data( parser, &s, &b, IS_INCREMENTAL ) )
return T1_Err_Invalid_File_Format; return T1_Err_Invalid_File_Format;
have_integer = 0; have_integer = 0;
} }
@ -1884,7 +1908,7 @@
parser->root.cursor = start_binary; parser->root.cursor = start_binary;
if ( !read_binary_data( parser, &s, &b ) ) if ( !read_binary_data( parser, &s, &b, IS_INCREMENTAL ) )
return T1_Err_Invalid_File_Format; return T1_Err_Invalid_File_Format;
have_integer = 0; have_integer = 0;
} }
@ -1957,8 +1981,8 @@
if ( !( dict & keyword->dict ) ) if ( !( dict & keyword->dict ) )
{ {
FT_TRACE1(( "parse_dict: found %s but ignoring it " FT_TRACE1(( "parse_dict: found `%s' but ignoring it"
"since it is in the wrong dictionary\n", " since it is in the wrong dictionary\n",
keyword->ident )); keyword->ident ));
break; break;
} }
@ -2160,9 +2184,7 @@
type1->subrs_len = loader.subrs.lengths; type1->subrs_len = loader.subrs.lengths;
} }
#ifdef FT_CONFIG_OPTION_INCREMENTAL if ( !IS_INCREMENTAL )
if ( !face->root.internal->incremental_interface )
#endif
if ( !loader.charstrings.init ) if ( !loader.charstrings.init )
{ {
FT_ERROR(( "T1_Open_Face: no `/CharStrings' array in face\n" )); FT_ERROR(( "T1_Open_Face: no `/CharStrings' array in face\n" ));