ref: b48a6094b2e7b82eae118549571028c50e0d4ca8
parent: 681e8eea5fecade3a6a3a60d3127397ed28184e2
author: Werner Lemberg <[email protected]>
date: Sun Jul 9 15:15:30 EDT 2000
Formatting. Moving some internal structures and constants from freetype.h to ftobjs.h. Finally removing FT_LOAD_ANTI_ALIAS. Cleaning up all error codes. Only the used ones have survived :-) Removed unused FT_MAX_GLYPH_FORMATS constant. T2 error codes are now in the range 0x500-0x5FF (instead of `TrueDoc'). Some minor improvements of error return values. Finally fixing error code values in ftraster and ftgrays to be compliant with all other FT error codes.
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -273,16 +273,6 @@
/*************************************************************************/
- /* */
- /* FT_MAX_GLYPH_FORMATS */
- /* */
- /* The maximum number of glyph image formats that might be registered */
- /* in a given library instance. 8 seems to be a good choice due to */
- /* the relatively low number of current formats ;-) */
- /* */
-#define FT_MAX_GLYPH_FORMATS 8
-
- /*************************************************************************/
/*************************************************************************/
/**** ****/
/**** S F N T D R I V E R C O N F I G U R A T I O N ****/
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -7,8 +7,8 @@
/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
-/* This file is part of the FreeType project, and may only be used */
-/* modified and distributed under the terms of the FreeType project */
+/* 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. */
@@ -15,9 +15,11 @@
/* */
/***************************************************************************/
+
#ifndef FREETYPE_H
#define FREETYPE_H
+
/*************************************************************************/
/* */
/* The `raster' component duplicates some of the declarations in */
@@ -30,10 +32,7 @@
/* */
/* The FREETYPE_MAJOR and FREETYPE_MINOR macros are used to version the */
/* new FreeType design, which is able to host several kinds of font */
- /* drivers. It starts at 2.0. Note that each driver has its own */
- /* version number (for example, the TrueType driver is at 1.2, as */
- /* defined by the macros TT_FREETYPE_MAJOR and TT_FREETYPE_MINOR in the */
- /* file `ttlib/truetype.h'. */
+ /* drivers. It starts at 2.0. */
/* */
#define FREETYPE_MAJOR 2
#define FREETYPE_MINOR 0
@@ -43,6 +42,7 @@
#include <freetype/fterrors.h>
#include <freetype/fttypes.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -69,14 +69,19 @@
/* */
/* <Fields> */
/* width :: The glyph's width. */
+ /* */
/* height :: The glyph's height. */
/* */
/* horiBearingX :: Horizontal left side bearing. */
+ /* */
/* horiBearingY :: Horizontal top side bearing. */
+ /* */
/* horiAdvance :: Horizontal advance width. */
/* */
/* vertBearingX :: Vertical left side bearing. */
+ /* */
/* vertBearingY :: Vertical top side bearing. */
+ /* */
/* vertAdvance :: Vertical advance height. */
/* */
typedef struct FT_Glyph_Metrics_
@@ -106,7 +111,7 @@
/* details of usage. */
/* */
/* <Input> */
- /* The address of the FreeType object which is under finalisation. */
+ /* The address of the FreeType object which is under finalization. */
/* Its client data is accessed through its `generic' field. */
/* */
typedef void (*FT_Generic_Finalizer)(void* object);
@@ -161,6 +166,7 @@
/* */
/* <Fields> */
/* height :: The character height in pixels. */
+ /* */
/* width :: The character width in pixels. */
/* */
typedef struct FT_Bitmap_Size_
@@ -204,9 +210,9 @@
/* FT_Module */
/* */
/* <Description> */
- /* A handle to a given FreeType module object. Each module can be */
- /* a font driver, a renderer, or anything else that provides services */
- /* to the formers.. */
+ /* A handle to a given FreeType module object. Each module can be a */
+ /* font driver, a renderer, or anything else that provides services */
+ /* to the formers. */
/* */
typedef struct FT_ModuleRec_* FT_Module;
@@ -227,7 +233,6 @@
typedef struct FT_DriverRec_* FT_Driver;
-
/*************************************************************************/
/* */
/* <Type> */
@@ -234,15 +239,14 @@
/* FT_Renderer */
/* */
/* <Description> */
- /* A handle to a given FreeType renderer. A renderer is in charge */
- /* of converting a glyph image to a bitmap, when necessary. Each */
+ /* A handle to a given FreeType renderer. A renderer is in charge of */
+ /* converting a glyph image to a bitmap, when necessary. Each */
/* supports a given glyph image format, and one or more target */
- /* surface depths.. */
+ /* surface depths. */
/* */
typedef struct FT_RendererRec_* FT_Renderer;
-
/*************************************************************************/
/* */
/* <Type> */
@@ -324,25 +328,26 @@
typedef enum FT_Encoding_
{
ft_encoding_none = 0,
- ft_encoding_symbol = FT_MAKE_TAG('s','y','m','b'),
- ft_encoding_unicode = FT_MAKE_TAG('u','n','i','c'),
- ft_encoding_latin_2 = FT_MAKE_TAG('l','a','t','2'),
- ft_encoding_sjis = FT_MAKE_TAG('s','j','i','s'),
- ft_encoding_gb2312 = FT_MAKE_TAG('g','b',' ',' '),
- ft_encoding_big5 = FT_MAKE_TAG('b','i','g','5'),
- ft_encoding_wansung = FT_MAKE_TAG('w','a','n','s'),
- ft_encoding_johab = FT_MAKE_TAG('j','o','h','a'),
+ ft_encoding_symbol = FT_MAKE_TAG( 's', 'y', 'm', 'b' ),
+ ft_encoding_unicode = FT_MAKE_TAG( 'u', 'n', 'i', 'c' ),
+ ft_encoding_latin_2 = FT_MAKE_TAG( 'l', 'a', 't', '2' ),
+ ft_encoding_sjis = FT_MAKE_TAG( 's', 'j', 'i', 's' ),
+ ft_encoding_gb2312 = FT_MAKE_TAG( 'g', 'b', ' ', ' ' ),
+ ft_encoding_big5 = FT_MAKE_TAG( 'b', 'i', 'g', '5' ),
+ ft_encoding_wansung = FT_MAKE_TAG( 'w', 'a', 'n', 's' ),
+ ft_encoding_johab = FT_MAKE_TAG( 'j', 'o', 'h', 'a' ),
- ft_encoding_adobe_standard = FT_MAKE_TAG('A','D','O','B'),
- ft_encoding_adobe_expert = FT_MAKE_TAG('A','D','B','E'),
- ft_encoding_adobe_custom = FT_MAKE_TAG('A','D','B','C'),
+ ft_encoding_adobe_standard = FT_MAKE_TAG( 'A', 'D', 'O', 'B' ),
+ ft_encoding_adobe_expert = FT_MAKE_TAG( 'A', 'D', 'B', 'E' ),
+ ft_encoding_adobe_custom = FT_MAKE_TAG( 'A', 'D', 'B', 'C' ),
- ft_encoding_apple_roman = FT_MAKE_TAG('a','r','m','n')
+ ft_encoding_apple_roman = FT_MAKE_TAG( 'a', 'r', 'm', 'n' )
/* other encodings might be defined in the future */
} FT_Encoding;
+
/*************************************************************************/
/* */
/* <Struct> */
@@ -381,9 +386,6 @@
} FT_CharMapRec;
-
-
-
/*************************************************************************/
/*************************************************************************/
/* */
@@ -392,8 +394,6 @@
/*************************************************************************/
/*************************************************************************/
-
-
/*************************************************************************/
/* */
/* FreeType base face class */
@@ -571,17 +571,17 @@
/* this should be set to 0. Only relevant for */
/* scalable formats. */
/* */
- /* transform_matrix :: a 2x2 matrix of 16.16 coefficients used */
- /* to transform glyph outlines after they're */
- /* loaded from the font. Only used by the */
+ /* transform_matrix :: A 2x2 matrix of 16.16 coefficients used */
+ /* to transform glyph outlines after they are */
+ /* loaded from the font. Only used by the */
/* convenience functions. */
/* */
- /* transform_delta :: a translation vector used to transform */
- /* glyph outlines after they're loaded from */
- /* the font. Only used by the convenience */
+ /* transform_delta :: A translation vector used to transform */
+ /* glyph outlines after they are loaded from */
+ /* the font. Only used by the convenience */
/* functions. */
/* */
- /* transform_flags :: some flags used to classify the transform. */
+ /* transform_flags :: Some flags used to classify the transform. */
/* Only used by the convenience functions. */
/* */
typedef struct FT_FaceRec_
@@ -625,7 +625,7 @@
/************************************************************/
/* The following fields should be considered private and */
- /* rarely, if ever, used driectly by client applications.. */
+ /* rarely, if ever, used directly by client applications. */
FT_Driver driver;
FT_Memory memory;
@@ -664,13 +664,15 @@
/*************************************************************************/
/* */
/* <Constant> */
- /* FT_FACE_FLAG_FIXED_WIDTH */
+ /* FT_FACE_FLAG_FIXED_SIZES */
/* */
/* <Description> */
/* A bit-field constant, used to indicate that a given face contains */
- /* fixed-width characters (like Courier, Lucida, MonoType, etc..) */
+ /* `fixed sizes', i.e., bitmap strikes for some given pixel sizes. */
+ /* See the `num_fixed_sizes' and `available_sizes' face properties */
+ /* for more information. */
/* */
-#define FT_FACE_FLAG_FIXED_WIDTH 4
+#define FT_FACE_FLAG_FIXED_SIZES 2
/*************************************************************************/
@@ -680,11 +682,9 @@
/* */
/* <Description> */
/* A bit-field constant, used to indicate that a given face contains */
- /* `fixed sizes', i.e., bitmap strikes for some given pixel sizes. */
- /* See the `num_fixed_sizes' and `available_sizes' face properties */
- /* for more information. */
+ /* fixed-width characters (like Courier, Lucida, MonoType, etc.). */
/* */
-#define FT_FACE_FLAG_FIXED_SIZES 2
+#define FT_FACE_FLAG_FIXED_WIDTH 4
/*************************************************************************/
@@ -707,7 +707,7 @@
/* <Description> */
/* A bit-field constant, used to indicate that a given face contains */
/* horizontal glyph metrics. This should be set for all common */
- /* formats, but who knows... */
+ /* formats, but who knows. */
/* */
#define FT_FACE_FLAG_HORIZONTAL 0x10
@@ -756,6 +756,7 @@
/* */
#define FT_FACE_FLAG_FAST_GLYPHS 0x80
+
/*************************************************************************/
/* */
/* <Constant> */
@@ -763,7 +764,7 @@
/* */
/* <Description> */
/* A bit-field constant, used to indicate that the font contains */
- /* multiple masters and is capable of interpolating between them.. */
+ /* multiple masters and is capable of interpolating between them. */
/* */
#define FT_FACE_FLAG_MULTIPLE_MASTERS 0x100
@@ -776,23 +777,32 @@
/* <Description> */
/* This bit field is used internally by FreeType to indicate that */
/* a face's stream was provided by the client application and should */
- /* not be destroyed by FT_Done_Face */
+ /* not be destroyed by FT_Done_Face(). */
/* */
#define FT_FACE_FLAG_EXTERNAL_STREAM 0x4000
-#define FT_HAS_HORIZONTAL(face) (face->face_flags & FT_FACE_FLAG_HORIZONTAL)
-#define FT_HAS_VERTICAL(face) (face->face_flags & FT_FACE_FLAG_VERTICAL)
-#define FT_HAS_KERNING(face) (face->face_flags & FT_FACE_FLAG_KERNING)
-#define FT_IS_SCALABLE(face) (face->face_flags & FT_FACE_FLAG_SCALABLE)
-#define FT_IS_SFNT(face) (face->face_flags & FT_FACE_FLAG_SFNT)
-#define FT_IS_FIXED_WIDTH(face) (face->face_flags & FT_FACE_FLAG_FIXED_WIDTH)
-#define FT_HAS_FIXED_SIZES(face) (face->face_flags & FT_FACE_FLAG_FIXED_SIZES)
-#define FT_HAS_FAST_GLYPHS(face) (face->face_flags & FT_FACE_FLAG_FAST_GLYPHS)
+#define FT_HAS_HORIZONTAL( face ) \
+ ( face->face_flags & FT_FACE_FLAG_HORIZONTAL )
+#define FT_HAS_VERTICAL( face ) \
+ ( face->face_flags & FT_FACE_FLAG_VERTICAL )
+#define FT_HAS_KERNING( face ) \
+ ( face->face_flags & FT_FACE_FLAG_KERNING )
+#define FT_IS_SCALABLE( face ) \
+ ( face->face_flags & FT_FACE_FLAG_SCALABLE )
+#define FT_IS_SFNT( face ) \
+ ( face->face_flags & FT_FACE_FLAG_SFNT )
+#define FT_IS_FIXED_WIDTH( face ) \
+ ( face->face_flags & FT_FACE_FLAG_FIXED_WIDTH )
+#define FT_HAS_FIXED_SIZES( face ) \
+ ( face->face_flags & FT_FACE_FLAG_FIXED_SIZES )
+#define FT_HAS_FAST_GLYPHS( face ) \
+ ( face->face_flags & FT_FACE_FLAG_FAST_GLYPHS )
-#define FT_HAS_MULTIPLE_MASTERS(face) \
- (face->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS)
+#define FT_HAS_MULTIPLE_MASTERS( face ) \
+ ( face->face_flags & FT_FACE_FLAG_MULTIPLE_MASTERS )
+
/*************************************************************************/
/* */
/* <Constant> */
@@ -817,7 +827,6 @@
#define FT_STYLE_FLAG_BOLD 2
-
/*************************************************************************/
/* */
/* FreeType base size metrics */
@@ -869,17 +878,18 @@
/* fixed point pixels. Always positive. */
/* */
/* <Note> */
- /* The values of "ascender", "descender" and "height" are only the */
- /* scaled versions of "face->ascender", "face->descender" and */
- /* "face->height". */
+ /* The values of `ascender', `descender', and `height' are only the */
+ /* scaled versions of `face->ascender', `face->descender', and */
+ /* `face->height'. */
/* */
/* Unfortunately, due to glyph hinting, these values might not be */
/* exact for certain fonts, they thus must be treated as unreliable */
- /* with an error margin of at least one pixel !! */
+ /* with an error margin of at least one pixel! */
/* */
/* Indeed, the only way to get the exact pixel ascender and descender */
- /* is to render _all_ glyphs. As this would be a definite performance */
- /* hit, it's up to client applications to perform such computations.. */
+ /* is to render _all_ glyphs. As this would be a definite */
+ /* performance hit, it is up to client applications to perform such */
+ /* computations. */
/* */
typedef struct FT_Size_Metrics_
{
@@ -927,47 +937,38 @@
} FT_SizeRec;
-
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* FT_SubGlyph */
+ /* */
+ /* <Description> */
+ /* The subglyph structure is an internal object used to describe */
+ /* subglyphs (for example, in the case of composites). */
+ /* */
+ /* <Note> */
+ /* The subglyph implementation is not part of the high-level API, */
+ /* hence the forward structure declaration. */
+ /* */
typedef struct FT_SubGlyph_ FT_SubGlyph;
- struct FT_SubGlyph_
- {
- FT_Int index;
- FT_UShort flags;
- FT_Int arg1;
- FT_Int arg2;
- FT_Matrix transform;
- };
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* FT_GlyphLoader */
+ /* */
+ /* <Description> */
+ /* The glyph loader is an internal object used to load several glyphs */
+ /* together (for example, in the case of composites). */
+ /* */
+ /* <Note> */
+ /* The glyph loader implementation is not part of the high-level API, */
+ /* hence the forward structure declaration. */
+ /* */
+ typedef struct FT_GlyphLoader_ FT_GlyphLoader;
-#define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS 1
-#define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES 2
-#define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID 4
-#define FT_SUBGLYPH_FLAG_SCALE 8
-#define FT_SUBGLYPH_FLAG_XY_SCALE 0x40
-#define FT_SUBGLYPH_FLAG_2X2 0x80
-#define FT_SUBGLYPH_FLAG_USE_MY_METRICS 0x200
-
-
- /**********************************************************************
- *
- * <Struct>
- * FT_Glyph_Loader
- *
- * <Description>
- * The glyph loader is an internal object used to load several
- * glyphs together (for example, in the case of composites)
- *
- * <Note>
- * the glyph loader implementation is not part of the high-level
- * API, hence the forward structure declaration;
- *
- *
- *********************************************************************/
- typedef struct FT_GlyphLoader_ FT_GlyphLoader;
-
-
/*************************************************************************/
/* */
/* FreeType Glyph Slot base class */
@@ -976,33 +977,35 @@
/* FT_GlyphSlotRec */
/* */
/* <Description> */
- /* FreeType root glyph slot class structure. A glyph slot is a */
+ /* FreeType root glyph slot class structure. A glyph slot is a */
/* container where individual glyphs can be loaded, be they */
- /* vectorial or bitmap/graymaps.. */
+ /* vectorial or bitmap/graymaps. */
/* */
/* <Fields> */
- /* library :: a handle to the FreeType library instance this slot */
- /* belongs to. */
+ /* library :: A handle to the FreeType library instance */
+ /* this slot belongs to. */
/* */
- /* face :: A handle to the parent face object. */
+ /* face :: A handle to the parent face object. */
/* */
- /* next :: In some cases (like some font tools), several glyph */
- /* slots per face object can be a good thing. As this is */
- /* rare, the glyph slots are listed through a direct, */
- /* single-linked list using its `next' field. */
+ /* next :: In some cases (like some font tools), several */
+ /* glyph slots per face object can be a good */
+ /* thing. As this is rare, the glyph slots are */
+ /* listed through a direct, single-linked list */
+ /* using its `next' field. */
/* */
- /* generic :: A typeless pointer which is unused by the FreeType */
- /* library or any of its drivers. It can be used by */
- /* client applications to link their own data to each */
- /* size object. */
+ /* generic :: A typeless pointer which is unused by the */
+ /* FreeType library or any of its drivers. It */
+ /* can be used by client applications to link */
+ /* their own data to each size object. */
/* */
- /* metrics :: The metrics of the last loaded glyph in the slot. The */
- /* returned values depend on the last load flags (see the */
- /* FT_Load_Glyph() API function) and can be expressed */
- /* either in 26.6 fractional pixels or font units. */
+ /* metrics :: The metrics of the last loaded glyph in the */
+ /* slot. The returned values depend on the last */
+ /* load flags (see the FT_Load_Glyph() API */
+ /* function) and can be expressed either in 26.6 */
+ /* fractional pixels or font units. */
/* */
- /* Note that even when the glyph image is transformed, */
- /* the metrics aren't.. */
+ /* Note that even when the glyph image is */
+ /* transformed, the metrics are not. */
/* */
/* linearHoriAdvance :: For scalable formats only, this field holds */
/* the linearly scaled horizontal advance width */
@@ -1018,86 +1021,84 @@
/* */
/* linearVertAdvance :: For scalable formats only, this field holds */
/* the linearly scaled vertical advance height */
- /* for the glyph. See linearHoriAdvance for */
+ /* for the glyph. See linearHoriAdvance for */
/* comments. */
/* */
- /* advance :: this is the transformed advance width for the glyph */
+ /* advance :: This is the transformed advance width for the */
+ /* glyph. */
/* */
- /* format :: this field indicates the format of the image */
- /* contained in the glyph slot. Typically */
- /* ft_glyph_format_bitmap, ft_glyph_format_outline */
- /* & ft_glyph_format_composite, but others are possible */
+ /* format :: This field indicates the format of the image */
+ /* contained in the glyph slot. Typically */
+ /* ft_glyph_format_bitmap, */
+ /* ft_glyph_format_outline, and */
+ /* ft_glyph_format_composite, but others are */
+ /* possible. */
/* */
- /* bitmap :: this field is used as a bitmap descriptor when the */
- /* slot format is ft_glyph_format_bitmap. Note that */
- /* the address and content of the bitmap buffer can */
- /* change between calls of FT_Load_Glyph and a few */
- /* other functions. */
+ /* bitmap :: This field is used as a bitmap descriptor */
+ /* when the slot format is */
+ /* ft_glyph_format_bitmap. Note that the */
+ /* address and content of the bitmap buffer can */
+ /* change between calls of FT_Load_Glyph() and a */
+ /* few other functions. */
/* */
- /* bitmap_left :: this is the bitmap's left bearing expressed in */
- /* integer pixels. Of course, this is only valid */
- /* when the format is ft_glyph_format_bitmap */
+ /* bitmap_left :: This is the bitmap's left bearing expressed */
+ /* in integer pixels. Of course, this is only */
+ /* valid if the format is */
+ /* ft_glyph_format_bitmap. */
/* */
- /* bitmap_top :: this is the bitmap's top bearing expressed in */
- /* integer pixels. Remember that this is the */
- /* distance from the baseline to the top-most */
- /* glyph scanline, upwards y coordinates being */
- /* *positive* */
+ /* bitmap_top :: This is the bitmap's top bearing expressed in */
+ /* integer pixels. Remember that this is the */
+ /* distance from the baseline to the top-most */
+ /* glyph scanline, upwards y-coordinates being */
+ /* *positive*. */
/* */
- /* outline :: The outline descriptor for the current glyph image */
- /* when it's format is ft_glyph_bitmap_outline. */
+ /* outline :: The outline descriptor for the current glyph */
+ /* image if its format is */
+ /* ft_glyph_bitmap_outline. */
/* */
- /* num_subglyphs :: the number of subglyphs in a composite glyph. */
- /* this format is only valid for the composite */
- /* glyph format, that should normally only be */
- /* loaded with the FT_LOAD_NO_RECURSE flag.. */
+ /* num_subglyphs :: The number of subglyphs in a composite glyph. */
+ /* This format is only valid for the composite */
+ /* glyph format, that should normally only be */
+ /* loaded with the FT_LOAD_NO_RECURSE flag. */
/* */
- /* subglyphs :: an array of subglyph descriptors for composite */
- /* glyphs. There are 'num_subglyphs' elements in */
- /* in there.. */
+ /* subglyphs :: An array of subglyph descriptors for */
+ /* composite glyphs. There are `num_subglyphs' */
+ /* elements in there. */
/* */
- /* control_data :: certain font drivers can also return the control */
- /* data for a given glyph image (e.g. TrueType */
- /* bytecode, Type 1 charstrings, etc..). This field */
- /* is a pointer to such data.. */
+ /* control_data :: Certain font drivers can also return the */
+ /* control data for a given glyph image (e.g. */
+ /* TrueType bytecode, Type 1 charstrings, etc.). */
+ /* This field is a pointer to such data. */
/* */
- /* control_len :: this is the length in bytes of the control data */
+ /* control_len :: This is the length in bytes of the control */
+ /* data. */
/* */
- /* other :: really wicked format can use this pointer to */
- /* present their own glyph image to client apps. */
- /* Note that the app will need to know about the */
- /* image format, */
+ /* other :: Really wicked formats can use this pointer to */
+ /* present their own glyph image to client apps. */
+ /* Note that the app will need to know about the */
+ /* image format. */
/* */
- /* loader :: this is a private object for the glyph slot. Do */
- /* not touch this.. */
+ /* loader :: This is a private object for the glyph slot. */
+ /* Do not touch this. */
/* */
/* <Note> */
- /* When FT_Load_Glyph is called with default flags (FT_LOAD_DEFAULT), */
+ /* If FT_Load_Glyph() is called with default flags (FT_LOAD_DEFAULT), */
/* the glyph image is loaded in the glyph slot in its native format */
- /* (e.g. a vectorial outline for TrueType and Type 1 formats) */
+ /* (e.g. a vectorial outline for TrueType and Type 1 formats). */
/* */
/* This image can later be converted into a bitmap by calling */
- /* FT_Render_Glyph. This function finds the current renderer for the */
- /* native image's format then invokes it. */
+ /* FT_Render_Glyph(). This function finds the current renderer for */
+ /* the native image's format then invokes it. */
/* */
/* The renderer is in charge of transforming the native image through */
/* the slot's face transformation fields, then convert it into a */
- /* bitmap that is returned in "slot->bitmap". */
+ /* bitmap that is returned in `slot->bitmap'. */
/* */
- /* Note that "slot->bitmap_left" and "slot->bitmap_top" are also */
- /* used to specify the position of the bitmap relative to the current */
- /* pen position (e.g. coordinates [0,0] on the baseline). Of course, */
- /* "slot->format" is also changed to "ft_glyph_format_bitmap".. */
+ /* Note that `slot->bitmap_left' and `slot->bitmap_top' are also used */
+ /* to specify the position of the bitmap relative to the current pen */
+ /* position (e.g. coordinates [0,0] on the baseline). Of course, */
+ /* `slot->format' is also changed to `ft_glyph_format_bitmap' . */
/* */
- /* */
-
- enum
- {
- ft_glyph_own_bitmap = 1
- };
-
-
-
typedef struct FT_GlyphSlotRec_
{
FT_Library library;
@@ -1155,9 +1156,9 @@
/* library :: A handle to a new library object. */
/* */
/* <Return> */
- /* Error code. 0 means success. */
+ /* FreeType error code. 0 means success. */
/* */
- FT_EXPORT_DEF(FT_Error) FT_Init_FreeType( FT_Library* library );
+ FT_EXPORT_DEF( FT_Error ) FT_Init_FreeType( FT_Library* library );
/*************************************************************************/
@@ -1166,114 +1167,125 @@
/* FT_Done_FreeType */
/* */
/* <Description> */
- /* Destroys a given FreeType library object, and all of its childs, */
+ /* Destroys a given FreeType library object and all of its childs, */
/* including resources, drivers, faces, sizes, etc. */
/* */
/* <Input> */
- /* library :: A handle to a target library object. */
+ /* library :: A handle to the target library object. */
/* */
/* <Return> */
- /* Error code. 0 means success. */
+ /* FreeType error code. 0 means success. */
/* */
- FT_EXPORT_DEF(FT_Error) FT_Done_FreeType( FT_Library library );
+ FT_EXPORT_DEF( FT_Error ) FT_Done_FreeType( FT_Library library );
/*************************************************************************/
/* */
- /* <Function> */
+ /* <Enum> */
/* FT_Open_Flags */
/* */
/* <Description> */
- /* An enumeration used to list the bit flags used within FT_Open_Args */
+ /* An enumeration used to list the bit flags used within */
+ /* FT_Open_Args(). */
/* */
/* <Fields> */
- /* ft_open_memory :: this is a memory-based stream */
- /* ft_open_stream :: copy the stream from the "stream" field */
- /* ft_open_pathname :: create a new input stream from a C pathname */
- /* ft_open_driver :: use the "driver" field */
- /* ft_open_params :: use the "num_params" & "params" field */
+ /* ft_open_memory :: This is a memory-based stream. */
/* */
- typedef enum {
+ /* ft_open_stream :: Copy the stream from the `stream' field. */
+ /* */
+ /* ft_open_pathname :: Create a new input stream from a C pathname. */
+ /* */
+ /* ft_open_driver :: Use the `driver' field. */
+ /* */
+ /* ft_open_params :: Use the `num_params' & `params' field. */
+ /* */
+ typedef enum
+ {
+ ft_open_memory = 1,
+ ft_open_stream = 2,
+ ft_open_pathname = 4,
+ ft_open_driver = 8,
+ ft_open_params = 16
- ft_open_memory = 1,
- ft_open_stream = 2,
- ft_open_pathname = 4,
- ft_open_driver = 8,
- ft_open_params = 16
-
} FT_Open_Flags;
/*************************************************************************/
/* */
- /* <Function> */
+ /* <Struct> */
/* FT_Parameter */
/* */
/* <Description> */
/* A simple structure used to pass more or less generic parameters */
- /* to FT_Open_Face.. */
+ /* to FT_Open_Face(). */
/* */
/* <Fields> */
- /* tag :: 4-byte identification tag */
- /* data :: pointer to parameter data */
+ /* tag :: A 4-byte identification tag. */
/* */
+ /* data :: A pointer to the parameter data. */
+ /* */
/* <Note> */
- /* the id and role of parameters is driver-specific */
+ /* The id and function of parameters are driver-specific. */
/* */
- typedef struct FT_Parameter_
+ typedef struct FT_Parameter_
{
- FT_ULong tag;
- FT_Pointer data;
+ FT_ULong tag;
+ FT_Pointer data;
} FT_Parameter;
- /*************************************************************************
- *
- * <Struct>
- * FT_Open_Args
- *
- * <Description>
- * A structure used to indicate how to open a new font file/stream.
- * A pointer to such a structure can be used as a parameter for the
- * function FT_Open_Face & FT_Attach_Stream.
- *
- * <Fields>
- * flags :: set of bit flags indicating how to use the structure
- *
- * memory_base :: first byte of file in memory
- * memory_size :: size in bytes of file in memory
- *
- * pathname :: a pointer to an 8-bit file pathname
- *
- * stream :: handle to a source stream object
- *
- * driver :: this field is exclusively used by FT_Open_Face,
- * it simply specifies the font driver to use to open
- * the face. If set to 0, FreeType will try to load
- * the face with each one of the drivers in its list.
- *
- * num_params :: number of parameters
- * params :: extra parameters passed to the font driver when
- * opening a new face
- *
- * <Note>
- * The stream_type determines which fields are used to create a new
- * input stream.
- *
- * If it is ft_stream_memory, a new memory-based stream will be created
- * using the memory block specified by "memory_base" and "memory_size"
- *
- * If it is ft_stream_pathname, a new stream will be created with the
- * "pathname" field, calling the system-specific FT_New_Stream function
- *
- * It is is ft_stream_copy, then the content of "stream" will be copied
- * to a new input stream object. The object will be closed and destroyed
- * when the face is destroyed itself.. Note that this means that you
- * should not close the stream before the library does !!
- *
- *************************************************************************/
- typedef struct FT_Open_Args_
+ /*************************************************************************/
+ /* */
+ /* <Struct> */
+ /* FT_Open_Args */
+ /* */
+ /* <Description> */
+ /* A structure used to indicate how to open a new font file/stream. */
+ /* A pointer to such a structure can be used as a parameter for the */
+ /* functions FT_Open_Face() & FT_Attach_Stream(). */
+ /* */
+ /* <Fields> */
+ /* flags :: A set of bit flags indicating how to use the */
+ /* structure. */
+ /* */
+ /* memory_base :: The first byte of the file in memory. */
+ /* */
+ /* memory_size :: The size in bytes of the file in memory. */
+ /* */
+ /* pathname :: A pointer to an 8-bit file pathname. */
+ /* */
+ /* stream :: A handle to a source stream object. */
+ /* */
+ /* driver :: This field is exclusively used by FT_Open_Face(); */
+ /* it simply specifies the font driver to use to open */
+ /* the face. If set to 0, FreeType will try to load */
+ /* the face with each one of the drivers in its list. */
+ /* */
+ /* num_params :: The number of extra parameters. */
+ /* */
+ /* params :: Extra parameters passed to the font driver when */
+ /* opening a new face. */
+ /* */
+ /* <Note> */
+ /* `stream_type' determines which fields are used to create a new */
+ /* input stream. */
+ /* */
+ /* If it is `ft_stream_memory', a new memory-based stream will be */
+ /* created using the memory block specified by `memory_base' and */
+ /* `memory_size'. */
+ /* */
+ /* If it is `ft_stream_pathname', a new stream will be created with */
+ /* the `pathname' field, calling the system-specific FT_New_Stream() */
+ /* function. */
+ /* */
+ /* If is is `ft_stream_copy', then the content of `stream' will be */
+ /* copied to a new input stream object. The object will be closed */
+ /* and destroyed when the face is destroyed itself. Note that this */
+ /* means that you should not close the stream before the library */
+ /* does! */
+ /* */
+ typedef struct FT_Open_Args_
{
FT_Open_Flags flags;
FT_Byte* memory_base;
@@ -1286,6 +1298,7 @@
} FT_Open_Args;
+
/*************************************************************************/
/* */
/* <Function> */
@@ -1292,40 +1305,42 @@
/* FT_New_Face */
/* */
/* <Description> */
- /* Creates a new face object from a given font file and typeface */
- /* index. */
+ /* Creates a new face object from a given resource and typeface index */
+ /* using a pathname to the font file. */
/* */
+ /* <InOut> */
+ /* library :: A handle to the library resource. */
+ /* */
/* <Input> */
- /* library :: handle to the root FreeType library instance */
+ /* pathname :: A path to the font file. */
/* */
- /* filepathname :: an 8-bit pathname naming the font file */
- /* */
- /* face_index :: the index of the face within the font file. */
- /* The first face has index 0. */
+ /* face_index :: The index of the face within the resource. The */
+ /* first face has index 0. */
/* <Output> */
- /* face :: A handle to a new face object. */
+ /* aface :: A handle to a new face object. */
/* */
/* <Return> */
- /* Error code. 0 means success. */
+ /* FreeType error code. 0 means success. */
/* */
/* <Note> */
- /* If your font file is in memory, or if you want to provide your */
- /* own input stream object, see FT_Open_Face below. */
+ /* Unlike FreeType 1.x, this function automatically creates a glyph */
+ /* slot for the face object which can be accessed directly through */
+ /* `face->glyph'. */
/* */
- /* FT_New_Face creates a new stream object. The stream will be */
- /* closed with the face (when calling FT_Done_Face or even */
- /* FT_Done_FreeType). */
+ /* Note that additional slots can be added to each face with the */
+ /* FT_New_GlyphSlot() API function. Slots are linked in a single */
+ /* list through their `next' field. */
/* */
- /* Unlike FreeType 1.1, this function automatically creates a glyph */
- /* slot for the face object which can be accessed directly through */
- /* `face->slot'. Note that additional slots can be added to each face */
- /* through the FT_New_GlyphSlot() API function. Slots are linked in */
- /* a single list through their `next' field. */
+ /* FT_New_Face() can be used to determine and/or check the font */
+ /* format of a given font resource. If the `face_index' field is */
+ /* negative, the function will _not_ return any face handle in */
+ /* `*face'. Its return value should be 0 if the resource is */
+ /* recognized, or non-zero if not. */
/* */
- FT_EXPORT_DEF(FT_Error) FT_New_Face( FT_Library library,
- const char* filepathname,
- FT_Long face_index,
- FT_Face* face );
+ FT_EXPORT_DEF( FT_Error ) FT_New_Face( FT_Library library,
+ const char* filepathname,
+ FT_Long face_index,
+ FT_Face* face );
/*************************************************************************/
@@ -1342,7 +1357,9 @@
/* */
/* <Input> */
/* file_base :: A pointer to the beginning of the font data. */
+ /* */
/* file_size :: The size of the memory chunk used by the font data. */
+ /* */
/* face_index :: The index of the face within the resource. The */
/* first face has index 0. */
/* <Output> */
@@ -1366,11 +1383,11 @@
/* `*face'. Its return value should be 0 if the resource is */
/* recognized, or non-zero if not. */
/* */
- FT_EXPORT_DEF(FT_Error) FT_New_Memory_Face( FT_Library library,
- FT_Byte* file_base,
- FT_Long file_size,
- FT_Long face_index,
- FT_Face* face );
+ FT_EXPORT_DEF( FT_Error ) FT_New_Memory_Face( FT_Library library,
+ FT_Byte* file_base,
+ FT_Long file_size,
+ FT_Long face_index,
+ FT_Face* face );
/*************************************************************************/
@@ -1379,39 +1396,44 @@
/* FT_Open_Face */
/* */
/* <Description> */
- /* Creates a new face object from a given input stream & typeface */
- /* index. This function is very similar to FT_New_Face, except that */
- /* it can accept any form of input stream.. */
+ /* Opens a face object from a given resource and typeface index using */
+ /* an `FT_Open_Args' structure. If the face object doesn't exist, it */
+ /* will be created. */
/* */
+ /* <InOut> */
+ /* library :: A handle to the library resource. */
+ /* */
/* <Input> */
- /* library :: handle to the root FreeType library instance */
+ /* args :: A pointer to an `FT_Open_Args' structure which must */
+ /* be filled by the caller. */
/* */
- /* args :: an FT_Open_Args structure used to describe the */
- /* input stream to FreeType. */
- /* */
- /* face_index :: the index of the face within the font file. */
- /* The first face has index 0. */
+ /* face_index :: The index of the face within the resource. The */
+ /* first face has index 0. */
/* <Output> */
- /* face :: A handle to a new face object. */
+ /* aface :: A handle to a new face object. */
/* */
/* <Return> */
- /* Error code. 0 means success. */
+ /* FreeType error code. 0 means success. */
/* */
/* <Note> */
- /* Note that if the stream is in-memory or specified through an */
- /* 8-bit pathname, a new stream is created by this function. It */
- /* is only closed when the face is destroyed (FT_Done_Face). */
+ /* Unlike FreeType 1.x, this function automatically creates a glyph */
+ /* slot for the face object which can be accessed directly through */
+ /* `face->glyph'. */
/* */
- /* Note that when specifying directly an existing FT_Stream, this */
- /* function creates a new FT_Stream object and copies the contents */
- /* of the original stream within it. The stream will be closed */
- /* when the face is destroyed. This means calling the stream's */
- /* "close" function. */
+ /* Note that additional slots can be added to each face with the */
+ /* FT_New_GlyphSlot() API function. Slots are linked in a single */
+ /* list through their `next' field. */
/* */
- FT_EXPORT_DEF(FT_Error) FT_Open_Face( FT_Library library,
- FT_Open_Args* args,
- FT_Long face_index,
- FT_Face* face );
+ /* FT_Open_Face() can be used to determine and/or check the font */
+ /* format of a given font resource. If the `face_index' field is */
+ /* negative, the function will _not_ return any face handle in */
+ /* `*face'. Its return value should be 0 if the resource is */
+ /* recognized, or non-zero if not. */
+ /* */
+ FT_EXPORT_DEF( FT_Error ) FT_Open_Face( FT_Library library,
+ FT_Open_Args* args,
+ FT_Long face_index,
+ FT_Face* face );
/*************************************************************************/
@@ -1420,34 +1442,36 @@
/* FT_Attach_File */
/* */
/* <Description> */
- /* "Attach" a given font file to an existing face. This is usually */
- /* to read additionnal information for a single face object. For */
+ /* `Attaches' a given font file to an existing face. This is usually */
+ /* to read additional information for a single face object. For */
/* example, it is used to read the AFM files that come with Type 1 */
- /* fonts in order to add kerning data and other metrics.. */
+ /* fonts in order to add kerning data and other metrics. */
/* */
+ /* <InOut> */
+ /* face :: The target face object. */
+ /* */
/* <Input> */
- /* face :: target face object */
+ /* filepathname :: An 8-bit pathname naming the `metrics' file. */
/* */
- /* filepathname :: an 8-bit pathname naming the 'metrics' file. */
- /* */
/* <Return> */
- /* Error code. 0 means success. */
+ /* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* If your font file is in memory, or if you want to provide your */
- /* own input stream object, see FT_Attach_Stream. */
+ /* own input stream object, use FT_Attach_Stream(). */
/* */
- /* The meaning of the "attach" (i.e. what really happens when the */
- /* new file is read) is not fixed by FreeType itself. It really */
+ /* The meaning of the `attach' action (i.e., what really happens when */
+ /* the new file is read) is not fixed by FreeType itself. It really */
/* depends on the font format (and thus the font driver). */
/* */
- /* Client applications are expected to know what they're doing */
- /* when invoking this function. Most drivers simply do not implement */
- /* file attachments.. */
+ /* Client applications are expected to know what they are doing */
+ /* when invoking this function. Most drivers simply do not implement */
+ /* file attachments. */
/* */
- FT_EXPORT_DEF(FT_Error) FT_Attach_File( FT_Face face,
- const char* filepathname );
+ FT_EXPORT_DEF( FT_Error ) FT_Attach_File( FT_Face face,
+ const char* filepathname );
+
/*************************************************************************/
/* */
/* <Function> */
@@ -1454,27 +1478,28 @@
/* FT_Attach_Stream */
/* */
/* <Description> */
- /* This function is similar to FT_Attach_File with the exception */
+ /* This function is similar to FT_Attach_File() with the exception */
/* that it reads the attachment from an arbitrary stream. */
/* */
/* <Input> */
- /* face :: target face object */
+ /* face :: The target face object. */
/* */
- /* args :: a pointer to an FT_Open_Args structure used to describe */
- /* the input stream to FreeType */
+ /* parameters :: A pointer to an FT_Open_Args structure used to */
+ /* describe the input stream to FreeType. */
/* <Return> */
- /* Error code. 0 means success. */
+ /* FreeType error code. 0 means success. */
/* */
- /* The meaning of the "attach" (i.e. what really happens when the */
- /* new file is read) is not fixed by FreeType itself. It really */
+ /* <Note> */
+ /* The meaning of the `attach' (i.e. what really happens when the */
+ /* new file is read) is not fixed by FreeType itself. It really */
/* depends on the font format (and thus the font driver). */
/* */
- /* Client applications are expected to know what they're doing */
- /* when invoking this function. Most drivers simply do not implement */
- /* file attachments.. */
+ /* Client applications are expected to know what they are doing */
+ /* when invoking this function. Most drivers simply do not implement */
+ /* file attachments. */
/* */
- FT_EXPORT_DEF(FT_Error) FT_Attach_Stream( FT_Face face,
- FT_Open_Args* parameters );
+ FT_EXPORT_DEF( FT_Error ) FT_Attach_Stream( FT_Face face,
+ FT_Open_Args* parameters );
/*************************************************************************/
@@ -1490,9 +1515,9 @@
/* face :: A handle to a target face object. */
/* */
/* <Return> */
- /* Error code. 0 means success. */
+ /* FreeType error code. 0 means success. */
/* */
- FT_EXPORT_DEF(FT_Error) FT_Done_Face( FT_Face face );
+ FT_EXPORT_DEF( FT_Error ) FT_Done_Face( FT_Face face );
/*************************************************************************/
@@ -1501,26 +1526,39 @@
/* FT_Set_Char_Size */
/* */
/* <Description> */
- /* Sets the character dimensions of a given size object. The */
- /* `char_size' value is used for the width and height, expressed in */
- /* 26.6 fractional points. 1 point = 1/72 inch. */
+ /* Sets the character dimensions of a given face object. The */
+ /* `char_width' and `char_height' values are used for the width and */
+ /* height, respectively, expressed in 26.6 fractional points. */
/* */
+ /* If the horizontal or vertical resolution values are zero, a */
+ /* default value of 72dpi is used. Similarly, if one of the */
+ /* character dimensions is zero, its value is set equal to the other. */
+ /* */
+ /* <InOut> */
+ /* size :: A handle to a target size object. */
+ /* */
/* <Input> */
- /* size :: A handle to a target size object. */
- /* char_size :: The character size, in 26.6 fractional points. */
+ /* char_width :: The character width, in 26.6 fractional points. */
/* */
+ /* char_height :: The character height, in 26.6 fractional */
+ /* points. */
+ /* */
+ /* horz_resolution :: The horizontal resolution. */
+ /* */
+ /* vert_resolution :: The vertical resolution. */
+ /* */
/* <Return> */
- /* Error code. 0 means success. */
+ /* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* When dealing with fixed-size faces (i.e., non-scalable formats), */
/* use the function FT_Set_Pixel_Sizes(). */
/* */
- FT_EXPORT_DEF(FT_Error) FT_Set_Char_Size( FT_Face face,
- FT_F26Dot6 char_width,
- FT_F26Dot6 char_height,
- FT_UInt horz_resolution,
- FT_UInt vert_resolution );
+ FT_EXPORT_DEF( FT_Error ) FT_Set_Char_Size( FT_Face face,
+ FT_F26Dot6 char_width,
+ FT_F26Dot6 char_height,
+ FT_UInt horz_resolution,
+ FT_UInt vert_resolution );
/*************************************************************************/
@@ -1529,20 +1567,26 @@
/* FT_Set_Pixel_Sizes */
/* */
/* <Description> */
- /* Sets the character dimensions of a given size object. The width */
+ /* Sets the character dimensions of a given face object. The width */
/* and height are expressed in integer pixels. */
/* */
+ /* If one of the character dimensions is zero, its value is set equal */
+ /* to the other. */
+ /* */
+ /* <InOut> */
+ /* face :: A handle to the target face object. */
+ /* */
/* <Input> */
- /* size :: A handle to a target size object. */
/* pixel_width :: The character width, in integer pixels. */
+ /* */
/* pixel_height :: The character height, in integer pixels. */
/* */
/* <Return> */
- /* Error code. 0 means success. */
+ /* FreeType error code. 0 means success. */
/* */
- FT_EXPORT_DEF(FT_Error) FT_Set_Pixel_Sizes( FT_Face face,
- FT_UInt pixel_width,
- FT_UInt pixel_height );
+ FT_EXPORT_DEF( FT_Error ) FT_Set_Pixel_Sizes( FT_Face face,
+ FT_UInt pixel_width,
+ FT_UInt pixel_height );
/*************************************************************************/
@@ -1575,12 +1619,12 @@
/* transformed with the information passed to a previous call to */
/* FT_Set_Transform. */
/* */
- /* Note that this also transforms the "face.glyph.advance" field, */
- /* but **NOT** the values in "face.glyph.metrics".. */
+ /* Note that this also transforms the `face.glyph.advance' field, but */
+ /* *not* the values in `face.glyph.metrics'. */
/* */
- FT_EXPORT_DEF(FT_Error) FT_Load_Glyph( FT_Face face,
- FT_UInt glyph_index,
- FT_Int load_flags );
+ FT_EXPORT_DEF( FT_Error ) FT_Load_Glyph( FT_Face face,
+ FT_UInt glyph_index,
+ FT_Int load_flags );
/*************************************************************************/
@@ -1590,7 +1634,7 @@
/* */
/* <Description> */
/* A function used to load a single glyph within a given glyph slot, */
- /* for a given size, according to its character code ! */
+ /* for a given size, according to its character code. */
/* */
/* <Input> */
/* face :: A handle to a target face object where the glyph */
@@ -1604,6 +1648,7 @@
/* glyph loading process (e.g., whether the outline */
/* should be scaled, whether to load bitmaps or not, */
/* whether to hint the outline, etc). */
+ /* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
@@ -1610,20 +1655,21 @@
/* <Note> */
/* If the face has no current charmap, or if the character code */
/* is not defined in the charmap, this function will return an */
- /* error.. */
+ /* error. */
/* */
/* If the glyph image is not a bitmap, and if the bit flag */
/* FT_LOAD_IGNORE_TRANSFORM is unset, the glyph image will be */
/* transformed with the information passed to a previous call to */
- /* FT_Set_Transform. */
+ /* FT_Set_Transform(). */
/* */
- /* Note that this also transforms the "face.glyph.advance" field, */
- /* but **NOT** the values in "face.glyph.metrics".. */
+ /* Note that this also transforms the `face.glyph.advance' field, but */
+ /* *not* the values in `face.glyph.metrics'. */
/* */
- FT_EXPORT_DEF(FT_Error) FT_Load_Char( FT_Face face,
- FT_ULong char_code,
- FT_Int load_flags );
+ FT_EXPORT_DEF( FT_Error ) FT_Load_Char( FT_Face face,
+ FT_ULong char_code,
+ FT_Int load_flags );
+
/*************************************************************************/
/* */
/* <Constant> */
@@ -1647,7 +1693,7 @@
/* the vector outline being loaded should not be fitted to the pixel */
/* grid but simply scaled to 26.6 fractional pixels. */
/* */
- /* This flag is ignored when FT_LOAD_NO_SCALE is set. */
+ /* This flag is ignored if FT_LOAD_NO_SCALE is set. */
/* */
#define FT_LOAD_NO_HINTING 2
@@ -1659,13 +1705,13 @@
/* */
/* <Description> */
/* A bit-field constant, used with FT_Load_Glyph() to indicate that */
- /* the function should load the glyph and immediately convert it */
- /* into a bitmap, when necessary, by calling FT_Render_Glyph. */
+ /* the function should load the glyph and immediately convert it into */
+ /* a bitmap, if necessary, by calling FT_Render_Glyph(). */
/* */
- /* Note that by default, FT_Load_Glyph loads the glyph image in its */
- /* native format.. */
+ /* Note that by default, FT_Load_Glyph() loads the glyph image in its */
+ /* native format. */
/* */
-#define FT_LOAD_RENDER 4
+#define FT_LOAD_RENDER 4
/*************************************************************************/
@@ -1678,7 +1724,7 @@
/* the function should not load the bitmap or pixmap of a given */
/* glyph. This is useful when you do not want to load the embedded */
/* bitmaps of scalable formats, as the native glyph image will be */
- /* loaded, and can then be renderer through FT_Render_Glyph */
+ /* loaded, and can then be rendered through FT_Render_Glyph(). */
/* */
#define FT_LOAD_NO_BITMAP 8
@@ -1690,11 +1736,11 @@
/* */
/* <Description> */
/* A bit-field constant, used with FT_Load_Glyph() to indicate that */
- /* the glyph image should be prepared for vertical layout. This */
- /* basically means that "face.glyph.advance" will correspond to the */
+ /* the glyph image should be prepared for vertical layout. This */
+ /* basically means that `face.glyph.advance' will correspond to the */
/* vertical advance height (instead of the default horizontal */
- /* advance width), and that the glyph image will translated to */
- /* match the vertical bearings positions.. */
+ /* advance width), and that the glyph image will translated to match */
+ /* the vertical bearings positions. */
/* */
#define FT_LOAD_VERTICAL_LAYOUT 16
@@ -1706,8 +1752,8 @@
/* */
/* <Description> */
/* A bit-field constant, used with FT_Load_Glyph() to indicate that */
- /* the function should try to auto-hint the glyphs, even if a driver- */
- /* -specific hinter is available.. */
+ /* the function should try to auto-hint the glyphs, even if a driver */
+ /* specific hinter is available. */
/* */
#define FT_LOAD_FORCE_AUTOHINT 32
@@ -1720,10 +1766,9 @@
/* <Description> */
/* A bit-field constant, used with FT_Load_Glyph() to indicate that */
/* the font driver should try to crop the bitmap (i.e. remove all */
- /* space around its black bits) when loading it. For now, this */
- /* really only works with Embedded Bitmaps in TrueType fonts.. */
+ /* space around its black bits) when loading it. For now, this */
+ /* really only works with embedded bitmaps in TrueType fonts. */
/* */
- /* */
#define FT_LOAD_CROP_BITMAP 64
@@ -1734,7 +1779,7 @@
/* */
/* <Description> */
/* A bit-field constant, used with FT_Load_Glyph() to indicate that */
- /* the glyph loader should perform a pedantic bytecode. */
+ /* the glyph loader should perform a pedantic bytecode */
/* interpretation. Many popular fonts come with broken glyph */
/* programs. When this flag is set, loading them will return an */
/* error. Otherwise, errors are ignored by the loader, sometimes */
@@ -1751,11 +1796,11 @@
/* <Description> */
/* A bit-field constant, used with FT_Load_Glyph() to indicate that */
/* the glyph loader should ignore the global advance width defined */
- /* in the font. As far as we know, this is only used by the */
+ /* in the font. As far as we know, this is only used by the */
/* X-TrueType font server, in order to deal correctly with the */
- /* incorrect metrics contained in DynaLab's TrueType CJK fonts.. */
+ /* incorrect metrics contained in DynaLab's TrueType CJK fonts. */
/* */
-#define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH 512
+#define FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH 512
/*************************************************************************/
@@ -1770,13 +1815,13 @@
/* the values of `num_subglyphs' and `subglyphs', as well as set */
/* `face->glyph.format' to ft_glyph_format_composite. */
/* */
- /* This is for use by the auto-hinter and possibly other tools */
+ /* This is for use by the auto-hinter and possibly other tools. */
/* For nearly all applications, this flags should be left unset */
/* when invoking FT_Load_Glyph(). */
/* */
- /* Note that the flag forces the load of unscaled glyphs */
+ /* Note that the flag forces the load of unscaled glyphs. */
/* */
-#define FT_LOAD_NO_RECURSE 1024
+#define FT_LOAD_NO_RECURSE 1024
/*************************************************************************/
@@ -1795,30 +1840,14 @@
/*************************************************************************/
/* */
/* <Constant> */
- /* FT_LOAD_ANTI_ALIAS */
- /* */
- /* <Description> */
- /* Only used with FT_LOAD_RENDER set, indicates that the returned */
- /* glyph image should be anti-aliased. This basically tells the */
- /* glyph loader to use 'ft_render_mode_antialias' when calling */
- /* FT_Render_Glyph. */
- /* */
- /* THIS IS NOW 0, AS ANTI-ALIASED RENDERING IS NOW THE DEFAULT.. */
- /* */
-#define FT_LOAD_ANTI_ALIAS 0 /* this is the default */
-
- /*************************************************************************/
- /* */
- /* <Constant> */
/* FT_LOAD_MONOCHROME */
/* */
/* <Description> */
- /* Only used with FT_LOAD_RENDER set, indicates that the returned */
- /* glyph image should be 1-bit monochrome. This really tells the */
- /* glyph loader to use 'ft_render_mode_mono' when calling */
- /* FT_Render_Glyph. */
+ /* Only used with FT_LOAD_RENDER set, it indicates that the returned */
+ /* glyph image should be 1-bit monochrome. This really tells the */
+ /* glyph loader to use `ft_render_mode_mono' when calling */
+ /* FT_Render_Glyph(). */
/* */
- /* */
#define FT_LOAD_MONOCHROME 4096
@@ -1835,7 +1864,6 @@
#define FT_LOAD_LINEAR_DESIGN 8192
-
/*************************************************************************/
/* */
/* <Constant> */
@@ -1857,8 +1885,8 @@
/* */
/* <Description> */
/* A function used to set the transformation that is applied to glyph */
- /* images just before they're converted to bitmaps in a glyph slot */
- /* when FT_Render_Glyph is called.. */
+ /* images just before they are converted to bitmaps in a glyph slot */
+ /* when FT_Render_Glyph() is called. */
/* */
/* <InOut> */
/* face :: A handle to the source face object. */
@@ -1870,50 +1898,44 @@
/* vector. */
/* */
/* <Note> */
- /* The transformation is only applied to scalable image formats. */
+ /* The transformation is only applied to scalable image formats after */
+ /* the glyph has been loaded. It means that hinting is unaltered by */
+ /* the transformation and is performed on the character size given in */
+ /* the last call to FT_Set_Char_Sizes() or FT_Set_Pixel_Sizes(). */
/* */
- /* The transformation is simply applied to the glyph after it is */
- /* loaded. It means that hinting is unaltered by the transform and */
- /* is performed on the character size given in the last call to */
- /* FT_Set_Char_Sizes or FT_Set_Pixel_Sizes */
- /* */
FT_EXPORT_DEF( void ) FT_Set_Transform( FT_Face face,
FT_Matrix* matrix,
FT_Vector* delta );
- /*************************************************************************
- *
- * <Enum>
- * FT_Render_Mode
- *
- * <Description>
- * An enumeration type that lists the render modes supported by the
- * FreeType 2 renderer(s). A renderer is in charge of converting a
- * glyph image into a bitmap..
- *
- * <Fields>
- * ft_render_mode_normal :: this is the default render mode,
- * it corresponds to 8-bit anti-aliased
- * bitmaps, using 256 levels of gray.
- *
- * ft_render_mode_mono :: this render mode is used to produce
- * 1-bit monochrome bitmaps
- *
- * <Note>
- * There is no render mode to produce 8-bit "monochrome" bitmaps,
- * you'll have to make the conversion yourself if you need such
- * things (besides, FreeType is not a graphics library..)
- *
- * More modes might appear later for specific display modes (e.g.
- * TV, LCDs, etc..). They will be supported through the simple
- * addition of a renderer module, with no changes to the rest of
- * the engine..
- *
- *
- *************************************************************************/
-
- typedef enum FT_Render_Mode_
+ /*************************************************************************/
+ /* */
+ /* <Enum> */
+ /* FT_Render_Mode */
+ /* */
+ /* <Description> */
+ /* An enumeration type that lists the render modes supported by the */
+ /* FreeType 2 renderer(s). A renderer is in charge of converting a */
+ /* glyph image into a bitmap. */
+ /* */
+ /* <Fields> */
+ /* ft_render_mode_normal :: This is the default render mode; it */
+ /* corresponds to 8-bit anti-aliased */
+ /* bitmaps, using 256 levels of gray. */
+ /* */
+ /* ft_render_mode_mono :: This render mode is used to produce 1-bit */
+ /* monochrome bitmaps. */
+ /* */
+ /* <Note> */
+ /* There is no render mode to produce 8-bit `monochrome' bitmaps -- */
+ /* you have to make the conversion yourself if you need such things */
+ /* (besides, FreeType is not a graphics library). */
+ /* */
+ /* More modes might appear later for specific display modes (e.g. TV, */
+ /* LCDs, etc.). They will be supported through the simple addition */
+ /* of a renderer module, with no changes to the rest of the engine. */
+ /* */
+ typedef enum FT_Render_Mode_
{
ft_render_mode_normal = 0,
ft_render_mode_mono = 1
@@ -1921,53 +1943,51 @@
} FT_Render_Mode;
+ /*************************************************************************/
+ /* */
+ /* <Function> */
+ /* FT_Render_Glyph */
+ /* */
+ /* <Description> */
+ /* Converts a given glyph image to a bitmap. It does so by */
+ /* inspecting the glyph image format, find the relevant renderer, and */
+ /* invoke it. */
+ /* */
+ /* <Input> */
+ /* slot :: A handle to the glyph slot containing the image to */
+ /* convert. */
+ /* */
+ /* render_mode :: This is the render mode used to render the glyph */
+ /* image into a bitmap. See FT_Render_Mode for a list */
+ /* of possible values. */
+ /* */
+ /* <Return> */
+ /* FreeType error code. 0 means success. */
+ /* */
+ FT_EXPORT_DEF( FT_Error ) FT_Render_Glyph( FT_GlyphSlot slot,
+ FT_UInt render_mode );
- /*************************************************************************
- *
- * <Function>
- * FT_Render_Glyph
- *
- * <Description>
- * Converts a given glyph image to a bitmap. It does so by inspecting
- * the glyph image format, find the relevant renderer, and invoke it
- *
- * <Input>
- * slot :: handle to the glyph slot containing the image to
- * convert
- *
- * render_mode :: this is the render mode used to render the glyph image
- * into a bitmap. See FT_Render_Mode for possible values.
- *
- * <Return>
- * Error code. 0 means success.
- *
- *************************************************************************/
-
- FT_EXPORT_DEF(FT_Error) FT_Render_Glyph( FT_GlyphSlot slot,
- FT_UInt render_mode );
-
- /**************************************************************************
- *
- * <Enum>
- * FT_Kerning_Mode
- *
- * <Description>
- * A list of enumerations used to specify which kerning values to
- * return in FT_Get_Kerning
- *
- * <Field>
- * ft_kerning_default :: used to returned scaled and grid-fitted kerning
- * distances. (value is 0)
- *
- * ft_kerning_unfitted :: used to returned scaled by un-grid-fitted
- * kerning distances.
- *
- * ft_kerning_unscaled :: used to return the kerning vector in original
- * font units..
- *
- **************************************************************************/
- typedef enum FT_Kerning_Mode_
+ /*************************************************************************/
+ /* */
+ /* <Enum> */
+ /* FT_Kerning_Mode */
+ /* */
+ /* <Description> */
+ /* An enumeration used to specify which kerning values to return in */
+ /* FT_Get_Kerning(). */
+ /* */
+ /* <Field> */
+ /* ft_kerning_default :: Return scaled and grid-fitted kerning */
+ /* distances (value is 0). */
+ /* */
+ /* ft_kerning_unfitted :: Return scaled but un-grid-fitted kerning */
+ /* distances. */
+ /* */
+ /* ft_kerning_unscaled :: Return the kerning vector in original font */
+ /* units. */
+ /* */
+ typedef enum FT_Kerning_Mode_
{
ft_kerning_default = 0,
ft_kerning_unfitted,
@@ -1975,6 +1995,7 @@
} FT_Kerning_Mode;
+
/*************************************************************************/
/* */
/* <Function> */
@@ -1990,8 +2011,9 @@
/* */
/* right_glyph :: The index of the right glyph in the kern pair. */
/* */
- /* kern_mode :: see FT_Kerning_Mode for more info. Determines the */
- /* scale/dimension of the returned kerning vector */
+ /* kern_mode :: See FT_Kerning_Mode() for more information. */
+ /* Determines the scale/dimension of the returned */
+ /* kerning vector. */
/* */
/* <Output> */
/* kerning :: The kerning vector. This is in font units for */
@@ -2007,14 +2029,13 @@
/* kernings, are out of the scope of this API function -- they can be */
/* implemented through format-specific interfaces. */
/* */
- FT_EXPORT_DEF(FT_Error) FT_Get_Kerning( FT_Face face,
- FT_UInt left_glyph,
- FT_UInt right_glyph,
- FT_UInt kern_mode,
- FT_Vector* kerning );
+ FT_EXPORT_DEF( FT_Error ) FT_Get_Kerning( FT_Face face,
+ FT_UInt left_glyph,
+ FT_UInt right_glyph,
+ FT_UInt kern_mode,
+ FT_Vector* kerning );
-
/*************************************************************************/
/* */
/* <Function> */
@@ -2021,21 +2042,23 @@
/* FT_Select_Charmap */
/* */
/* <Description> */
- /* Selects a given charmap by its encoding tag. */
+ /* Selects a given charmap by its encoding tag (as listed in */
+ /* `freetype.h'). */
/* */
/* <Input> */
/* face :: A handle to the source face object. */
- /* encoding :: handle to the selected charmap */
/* */
+ /* encoding :: A handle to the selected charmap. */
+ /* */
/* <Return> */
- /* Error code. 0 means success. */
+ /* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* This function will return an error if no charmap in the face */
- /* corresponds to the encoding queried here */
+ /* corresponds to the encoding queried here. */
/* */
- FT_EXPORT_DEF(FT_Error) FT_Select_Charmap( FT_Face face,
- FT_Encoding encoding );
+ FT_EXPORT_DEF( FT_Error ) FT_Select_Charmap( FT_Face face,
+ FT_Encoding encoding );
/*************************************************************************/
@@ -2049,19 +2072,20 @@
/* */
/* <Input> */
/* face :: A handle to the source face object. */
- /* charmap :: handle to the selected charmap */
+ /* charmap :: A handle to the selected charmap. */
/* */
/* <Return> */
- /* Error code. 0 means success. */
+ /* FreeType error code. 0 means success. */
/* */
/* <Note> */
- /* this function will return an error when the charmap is not part */
- /* of the face (i.e. if it is not listed in the face->charmaps[] */
+ /* This function will return an error if the charmap is not part of */
+ /* the face (i.e., if it is not listed in the face->charmaps[] */
/* table). */
/* */
- FT_EXPORT_DEF(FT_Error) FT_Set_Charmap( FT_Face face,
- FT_CharMap charmap );
+ FT_EXPORT_DEF( FT_Error ) FT_Set_Charmap( FT_Face face,
+ FT_CharMap charmap );
+
/*************************************************************************/
/* */
/* <Function> */
@@ -2072,14 +2096,15 @@
/* uses a charmap object to do the translation. */
/* */
/* <Input> */
- /* charmap :: A handle to a filter charmap object. */
+ /* face :: A handle to the source face object. */
+ /* */
/* charcode :: The character code. */
/* */
/* <Return> */
/* The glyph index. 0 means `undefined character code'. */
/* */
- FT_EXPORT_DEF(FT_UInt) FT_Get_Char_Index( FT_Face face,
- FT_ULong charcode );
+ FT_EXPORT_DEF( FT_UInt ) FT_Get_Char_Index( FT_Face face,
+ FT_ULong charcode );
/*************************************************************************/
@@ -2088,7 +2113,7 @@
/* FT_MulDiv */
/* */
/* <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 */
/* whenever necessary). */
/* */
@@ -2102,12 +2127,12 @@
/* */
/* <Return> */
/* The result of `(a*b)/c'. This function never traps when trying to */
- /* divide by zero, it simply returns `MaxInt' or `MinInt' depending */
+ /* divide by zero; it simply returns `MaxInt' or `MinInt' depending */
/* on the signs of `a' and `b'. */
/* */
- FT_EXPORT_DEF(FT_Long) FT_MulDiv( FT_Long a,
- FT_Long b,
- FT_Long c );
+ FT_EXPORT_DEF( FT_Long ) FT_MulDiv( FT_Long a,
+ FT_Long b,
+ FT_Long c );
/*************************************************************************/
@@ -2117,7 +2142,7 @@
/* */
/* <Description> */
/* 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 maximal accuracy. Most of the time this is */
/* used to multiply a given value by a 16.16 fixed float factor. */
/* */
/* <Input> */
@@ -2133,14 +2158,14 @@
/* value of `a' is less than 2048, and `b' is a 16.16 scaling factor. */
/* As this happens mainly when scaling from notional units to */
/* fractional pixels in FreeType, it resulted in noticeable speed */
- /* improvements between versions 2.0 and 1.x. */
+ /* improvements between versions 2.x and 1.x. */
/* */
/* As a conclusion, always try to place a 16.16 factor as the */
/* _second_ argument of this function; this can make a great */
/* difference. */
/* */
- FT_EXPORT_DEF(FT_Long) FT_MulFix( FT_Long a,
- FT_Long b );
+ FT_EXPORT_DEF( FT_Long ) FT_MulFix( FT_Long a,
+ FT_Long b );
/*************************************************************************/
@@ -2150,8 +2175,8 @@
/* */
/* <Description> */
/* A very simple function used to perform the computation */
- /* `(A*0x10000)/B' with maximal accuracy. Most of the time, this is */
- /* used to divide a given value by a 16.16 fixed float factor. */
+ /* `(a*0x10000)/b' with maximal accuracy. Most of the time, this is */
+ /* used to divide a given value by a 16.16 fixed float factor. */
/* */
/* <Input> */
/* a :: The first multiplier. */
@@ -2162,12 +2187,12 @@
/* The result of `(a*0x10000)/b'. */
/* */
/* <Note> */
- /* The optimisation for FT_DivFix() is simple : if (a << 16) fits */
- /* in 32 bits, then the division is computed directly. Otherwise, */
- /* we use a specialised version of the old FT_MulDiv64 */
+ /* The optimization for FT_DivFix() is simple: If (a << 16) fits in */
+ /* 32 bits, then the division is computed directly. Otherwise, we */
+ /* use a specialized version of the old FT_MulDiv64(). */
/* */
- FT_EXPORT_DEF(FT_Long) FT_DivFix( FT_Long a,
- FT_Long b );
+ FT_EXPORT_DEF( FT_Long ) FT_DivFix( FT_Long a,
+ FT_Long b );
/*************************************************************************/
@@ -2179,7 +2204,7 @@
/* Transforms a single vector through a 2x2 matrix. */
/* */
/* <InOut> */
- /* vector :: The target vector to transform */
+ /* vector :: The target vector to transform. */
/* */
/* <Input> */
/* matrix :: A pointer to the source 2x2 matrix. */
@@ -2187,8 +2212,11 @@
/* <MT-Note> */
/* Yes. */
/* */
- FT_EXPORT_DEF(void) FT_Vector_Transform( FT_Vector* vec,
- FT_Matrix* matrix );
+ /* <Note> */
+ /* The result is undefined if either `vector' or `matrix' is invalid. */
+ /* */
+ FT_EXPORT_DEF( void ) FT_Vector_Transform( FT_Vector* vec,
+ FT_Matrix* matrix );
--- a/include/freetype/fterrors.h
+++ b/include/freetype/fterrors.h
@@ -7,112 +7,160 @@
/* Copyright 1996-2000 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
-/* This file is part of the FreeType project, and may only be used */
-/* modified and distributed under the terms of the FreeType project */
+/* 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. */
/* */
-/* This file is used to define the FreeType error enumeration constants */
-/* It can also be used to create an error message table easily with */
-/* something like: */
-/* */
-/* { */
-/* */
-/* #undef FTERRORS_H */
-/* #define FT_ERRORDEF( e, v, s ) { e, s ], */
-/* #define FT_ERROR_START_LIST { */
-/* #define FT_ERROR_END_LIST { 0, 0 } }; */
-/* */
-/* const struct { int err_code; const char* err_msg } ft_errors[] = */
-/* #include <freetype/fterrors.h> */
-/* } */
-/* */
/***************************************************************************/
+
+ /*************************************************************************/
+ /* */
+ /* This file is used to define the FreeType error enumeration constants */
+ /* It can also be used to create an error message table easily with */
+ /* something like: */
+ /* */
+ /* { */
+ /* #undef FTERRORS_H */
+ /* #define FT_ERRORDEF( e, v, s ) { e, s }, */
+ /* #define FT_ERROR_START_LIST { */
+ /* #define FT_ERROR_END_LIST { 0, 0 } }; */
+ /* */
+ /* const struct */
+ /* { */
+ /* int err_code; */
+ /* const char* err_msg */
+ /* } ft_errors[] = */
+ /* */
+ /* #include <freetype/fterrors.h> */
+ /* } */
+ /* */
+ /*************************************************************************/
+
+
#ifndef FTERRORS_H
#define FTERRORS_H
+
#ifndef FT_ERRORDEF
-#define FT_ERRORDEF( e, v, s ) e = v,
-#define FT_ERROR_START_LIST enum {
-#define FT_ERROR_END_LIST FT_Err_Max };
-#endif /* FT_ERRORDEF */
+#define FT_ERRORDEF( e, v, s ) e = v,
+#define FT_ERROR_START_LIST enum {
+#define FT_ERROR_END_LIST FT_Err_Max };
+
+#endif /* !FT_ERRORDEF */
+
+
#ifdef FT_ERROR_START_LIST
-FT_ERROR_START_LIST
+ FT_ERROR_START_LIST
#endif
- FT_ERRORDEF( FT_Err_Ok, 0x0000, "no error" )
- FT_ERRORDEF( FT_Err_Cannot_Open_Resource, 0x0001, "can't open stream" )
- FT_ERRORDEF( FT_Err_Unknown_File_Format, 0x0002, "unknown file format" )
- FT_ERRORDEF( FT_Err_Invalid_File_Format, 0x0003, "broken file" )
+ FT_ERRORDEF( FT_Err_Ok, 0x0000, \
+ "no error" )
+ FT_ERRORDEF( FT_Err_Cannot_Open_Resource, 0x0001, \
+ "can't open stream" )
+ FT_ERRORDEF( FT_Err_Unknown_File_Format, 0x0002, \
+ "unknown file format" )
+ FT_ERRORDEF( FT_Err_Invalid_File_Format, 0x0003, \
+ "broken file" )
- FT_ERRORDEF( FT_Err_Invalid_Argument, 0x0010, "invalid argument" )
- FT_ERRORDEF( FT_Err_Invalid_Handle, 0x0011, "invalid object handle" )
- FT_ERRORDEF( FT_Err_Invalid_Glyph_Index, 0x0012, "invalid glyph index" )
- FT_ERRORDEF( FT_Err_Invalid_Character_Code, 0x0013, "invalid character code" )
+ FT_ERRORDEF( FT_Err_Invalid_Argument, 0x0010, \
+ "invalid argument" )
+ FT_ERRORDEF( FT_Err_Invalid_Handle, 0x0011, \
+ "invalid object handle" )
+ FT_ERRORDEF( FT_Err_Invalid_Glyph_Index, 0x0012, \
+ "invalid glyph index" )
+ FT_ERRORDEF( FT_Err_Invalid_Character_Code, 0x0013, \
+ "invalid character code" )
- FT_ERRORDEF( FT_Err_Unimplemented_Feature, 0x0020, "unimplemented feature" )
- FT_ERRORDEF( FT_Err_Invalid_Glyph_Format, 0x0021, "unsupported glyph image format" )
- FT_ERRORDEF( FT_Err_Cannot_Render_Glyph, 0x0022, "cannot render this glyph format" )
+ FT_ERRORDEF( FT_Err_Unimplemented_Feature, 0x0020, \
+ "unimplemented feature" )
+ FT_ERRORDEF( FT_Err_Invalid_Glyph_Format, 0x0021, \
+ "unsupported glyph image format" )
+ FT_ERRORDEF( FT_Err_Cannot_Render_Glyph, 0x0022, \
+ "cannot render this glyph format" )
- FT_ERRORDEF( FT_Err_Invalid_Library_Handle, 0x0030, "invalid library handle" )
- FT_ERRORDEF( FT_Err_Invalid_Driver_Handle, 0x0031, "invalid module handle" )
- FT_ERRORDEF( FT_Err_Invalid_Face_Handle, 0x0032, "invalid face handle" )
- FT_ERRORDEF( FT_Err_Invalid_Size_Handle, 0x0033, "invalid size handle" )
- FT_ERRORDEF( FT_Err_Invalid_Slot_Handle, 0x0034, "invalid glyph slot handle" )
- FT_ERRORDEF( FT_Err_Invalid_CharMap_Handle, 0x0035, "invalid charmap handle" )
- FT_ERRORDEF( FT_Err_Invalid_Outline, 0x0036, "invalid outline" )
- FT_ERRORDEF( FT_Err_Invalid_Dimensions, 0x0037, "invalid dimensions" )
- FT_ERRORDEF( FT_Err_Invalid_Version, 0x0038, "invalid FreeType version" )
- FT_ERRORDEF( FT_Err_Lower_Module_Version, 0x0039, "module version is too low" )
+ FT_ERRORDEF( FT_Err_Invalid_Library_Handle, 0x0030, \
+ "invalid library handle" )
+ FT_ERRORDEF( FT_Err_Invalid_Driver_Handle, 0x0031, \
+ "invalid module handle" )
+ FT_ERRORDEF( FT_Err_Invalid_Face_Handle, 0x0032, \
+ "invalid face handle" )
+ FT_ERRORDEF( FT_Err_Invalid_Size_Handle, 0x0033, \
+ "invalid size handle" )
+ FT_ERRORDEF( FT_Err_Invalid_Slot_Handle, 0x0034, \
+ "invalid glyph slot handle" )
+ FT_ERRORDEF( FT_Err_Invalid_CharMap_Handle, 0x0035, \
+ "invalid charmap handle" )
+ FT_ERRORDEF( FT_Err_Invalid_Outline, 0x0036, \
+ "invalid outline" )
+ FT_ERRORDEF( FT_Err_Invalid_Version, 0x0037, \
+ "invalid FreeType version" )
+ FT_ERRORDEF( FT_Err_Lower_Module_Version, 0x0038, \
+ "module version is too low" )
- FT_ERRORDEF( FT_Err_Unavailable_Outline, 0x0040, "unavailable outline" )
- FT_ERRORDEF( FT_Err_Unavailable_Bitmap, 0x0041, "unavailable bitmap" )
- FT_ERRORDEF( FT_Err_File_Is_Not_Collection, 0x0042, "file is not a font collection" )
- FT_ERRORDEF( FT_Err_Too_Many_Drivers, 0x0043, "too many modules" )
- FT_ERRORDEF( FT_Err_Too_Many_Glyph_Formats, 0x0044, "too many glyph formats" )
- FT_ERRORDEF( FT_Err_Too_Many_Extensions, 0x0045, "too many extensions" )
+ FT_ERRORDEF( FT_Err_Too_Many_Drivers, 0x0040, \
+ "too many modules" )
+ FT_ERRORDEF( FT_Err_Too_Many_Extensions, 0x0041, \
+ "too many extensions" )
- FT_ERRORDEF( FT_Err_Out_Of_Memory, 0x0050, "out of memory" )
- FT_ERRORDEF( FT_Err_Unlisted_Object, 0x0051, "unlisted object" )
+ FT_ERRORDEF( FT_Err_Out_Of_Memory, 0x0050, \
+ "out of memory" )
+ FT_ERRORDEF( FT_Err_Unlisted_Object, 0x0051, \
+ "unlisted object" )
- FT_ERRORDEF( FT_Err_Invalid_Stream_Handle, 0x0060, "invalid stream handle" )
- FT_ERRORDEF( FT_Err_Cannot_Open_Stream, 0x0061, "cannot open stream" )
- FT_ERRORDEF( FT_Err_Invalid_Stream_Seek, 0x0062, "invalid stream seek" )
- FT_ERRORDEF( FT_Err_Invalid_Stream_Skip, 0x0063, "invalid stream skip" )
- FT_ERRORDEF( FT_Err_Invalid_Stream_Read, 0x0064, "invalid stream read" )
- FT_ERRORDEF( FT_Err_Invalid_Stream_Operation, 0x0065, "invalid stream operation" )
- FT_ERRORDEF( FT_Err_Invalid_Frame_Operation, 0x0066, "invalid frame operation" )
- FT_ERRORDEF( FT_Err_Nested_Frame_Access, 0x0067, "nested frame access" )
- FT_ERRORDEF( FT_Err_Invalid_Frame_Read, 0x0068, "invalid frame read" )
+ FT_ERRORDEF( FT_Err_Invalid_Stream_Handle, 0x0060, \
+ "invalid stream handle" )
+ FT_ERRORDEF( FT_Err_Cannot_Open_Stream, 0x0061, \
+ "cannot open stream" )
+ FT_ERRORDEF( FT_Err_Invalid_Stream_Seek, 0x0062, \
+ "invalid stream seek" )
+ FT_ERRORDEF( FT_Err_Invalid_Stream_Skip, 0x0063, \
+ "invalid stream skip" )
+ FT_ERRORDEF( FT_Err_Invalid_Stream_Read, 0x0064, \
+ "invalid stream read" )
+ FT_ERRORDEF( FT_Err_Invalid_Stream_Operation, 0x0065, \
+ "invalid stream operation" )
+ FT_ERRORDEF( FT_Err_Invalid_Frame_Operation, 0x0066, \
+ "invalid frame operation" )
+ FT_ERRORDEF( FT_Err_Nested_Frame_Access, 0x0067, \
+ "nested frame access" )
+ FT_ERRORDEF( FT_Err_Invalid_Frame_Read, 0x0068, \
+ "invalid frame read" )
- FT_ERRORDEF( FT_Err_Too_Many_Points, 0x0070, "too many points in glyph" )
- FT_ERRORDEF( FT_Err_Too_Many_Contours, 0x0071, "too many contours in glyph" )
- FT_ERRORDEF( FT_Err_Invalid_Composite, 0x0072, "invalid composite glyph" )
- FT_ERRORDEF( FT_Err_Too_Many_Hints, 0x0073, "too many hints in glyph" )
- FT_ERRORDEF( FT_Err_Too_Many_Edges, 0x0074, "too many edges in glyph" )
- FT_ERRORDEF( FT_Err_Too_Many_Strokes, 0x0075, "too many strokes in glyph" )
+ FT_ERRORDEF( FT_Err_Invalid_Composite, 0x0070, \
+ "invalid composite glyph" )
+ FT_ERRORDEF( FT_Err_Too_Many_Hints, 0x0071, \
+ "too many hints" )
-/* range 0x400 - 0x4FF is reserved for TrueType specific stuff */
+ FT_ERRORDEF( FT_Err_Raster_Uninitialized, 0x0080, \
+ "raster uninitialized" )
+ FT_ERRORDEF( FT_Err_Raster_Corrupted, 0x0081, \
+ "raster corrupted" )
+ FT_ERRORDEF( FT_Err_Raster_Overflow, 0x0082, \
+ "raster overflow" )
+ FT_ERRORDEF( FT_Err_Raster_Negative_Height, 0x0083, \
+ "negative height while rastering" )
-/* range 0x500 - 0x5FF is reserved for TrueDoc specific stuff */
+ /* range 0x400 - 0x4FF is reserved for TrueType specific stuff */
-/* range 0x600 - 0x6FF is reserved for Type1 specific stuff */
+ /* range 0x500 - 0x5FF is reserved for CFF specific stuff */
- FT_ERRORDEF( FT_Err_Raster_Uninitialized, 0x0080, "raster uninitialized" )
- FT_ERRORDEF( FT_Err_Raster_Corrupted, 0x0081, "raster corrupted !!" )
- FT_ERRORDEF( FT_Err_Raster_Overflow, 0x0082, "raster overflow !!" )
+ /* range 0x600 - 0x6FF is reserved for Type1 specific stuff */
#ifdef FT_ERROR_END_LIST
-FT_ERROR_END_LIST
+ FT_ERROR_END_LIST
#endif
+
#undef FT_ERROR_START_LIST
#undef FT_ERROR_END_LIST
#undef FT_ERRORDEF
+
#endif /* FTERRORS_H */
+
/* END */
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -199,6 +199,32 @@
/*************************************************************************/
/*************************************************************************/
+
+#define FT_SUBGLYPH_FLAG_ARGS_ARE_WORDS 1
+#define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES 2
+#define FT_SUBGLYPH_FLAG_ROUND_XY_TO_GRID 4
+#define FT_SUBGLYPH_FLAG_SCALE 8
+#define FT_SUBGLYPH_FLAG_XY_SCALE 0x40
+#define FT_SUBGLYPH_FLAG_2X2 0x80
+#define FT_SUBGLYPH_FLAG_USE_MY_METRICS 0x200
+
+
+ enum
+ {
+ ft_glyph_own_bitmap = 1
+ };
+
+
+ struct FT_SubGlyph_
+ {
+ FT_Int index;
+ FT_UShort flags;
+ FT_Int arg1;
+ FT_Int arg2;
+ FT_Matrix transform;
+ };
+
+
typedef struct FT_GlyphLoad_
{
FT_Outline outline; /* outline */
@@ -209,7 +235,7 @@
} FT_GlyphLoad;
- struct FT_GlyphLoader_
+ struct FT_GlyphLoader_
{
FT_Memory memory;
FT_UInt max_points;
--- a/include/freetype/internal/t1errors.h
+++ b/include/freetype/internal/t1errors.h
@@ -41,9 +41,6 @@
#define T1_Err_Invalid_Glyph_Index FT_Err_Invalid_Glyph_Index
#define T1_Err_Unimplemented_Feature FT_Err_Unimplemented_Feature
-#define T1_Err_Unavailable_Outline FT_Err_Unavailable_Outline
-#define T1_Err_Unavailable_Bitmap FT_Err_Unavailable_Bitmap
-#define T1_Err_File_Is_Not_Collection FT_Err_File_Is_Not_Collection
#define T1_Err_Invalid_Engine FT_Err_Invalid_Driver_Handle
@@ -54,13 +51,7 @@
/* ------------ general glyph outline errors ------ */
-#define T1_Err_Too_Many_Points FT_Err_Too_Many_Points
-#define T1_Err_Too_Many_Contours FT_Err_Too_Many_Contours
-#define T1_Err_Too_Many_Hints FT_Err_Too_Many_Hints
#define T1_Err_Invalid_Composite FT_Err_Invalid_Composite
-#define T1_Err_Too_Many_Edges FT_Err_Too_Many_Edges
-#define T1_Err_Too_Many_Strokes FT_Err_Too_Many_Strokes
-
#define T1_Err_Syntax_Error FT_Err_Invalid_File_Format
#define T1_Err_Stack_Underflow FT_Err_Invalid_File_Format
--- a/include/freetype/internal/t2errors.h
+++ b/include/freetype/internal/t2errors.h
@@ -46,10 +46,6 @@
#define T2_Err_Invalid_Glyph_Index FT_Err_Invalid_Glyph_Index
#define T2_Err_Unimplemented_Feature FT_Err_Unimplemented_Feature
-#define T2_Err_Unavailable_Outline FT_Err_Unavailable_Outline
-#define T2_Err_Unavailable_Bitmap FT_Err_Unavailable_Bitmap
-#define T2_Err_Unavailable_Pixmap FT_Err_Unavailable_Pixmap
-#define T2_Err_File_Is_Not_Collection FT_Err_File_Is_Not_Collection
#define T2_Err_Invalid_Engine FT_Err_Invalid_Driver_Handle
@@ -60,9 +56,6 @@
/* General glyph outline errors. */
-#define T2_Err_Too_Many_Points FT_Err_Too_Many_Points
-#define T2_Err_Too_Many_Contours FT_Err_Too_Many_Contours
-#define T2_Err_Too_Many_Ins FT_Err_Too_Many_Hints
#define T2_Err_Invalid_Composite FT_Err_Invalid_Composite
/* Bytecode interpreter error codes. */
@@ -72,53 +65,53 @@
/* broken font file, a broken glyph within a font */
/* file, or a bug in the interpreter! */
-#define T2_Err_Invalid_Opcode 0x400
-#define T2_Err_Too_Few_Arguments 0x401
-#define T2_Err_Stack_Overflow 0x402
-#define T2_Err_Code_Overflow 0x403
-#define T2_Err_Bad_Argument 0x404
-#define T2_Err_Divide_By_Zero 0x405
-#define T2_Err_Storage_Overflow 0x406
-#define T2_Err_Cvt_Overflow 0x407
-#define T2_Err_Invalid_Reference 0x408
-#define T2_Err_Invalid_Distance 0x409
-#define T2_Err_Interpolate_Twilight 0x40A
-#define T2_Err_Debug_OpCode 0x40B
-#define T2_Err_ENDF_In_Exec_Stream 0x40C
-#define T2_Err_Out_Of_CodeRanges 0x40D
-#define T2_Err_Nested_DEFS 0x40E
-#define T2_Err_Invalid_CodeRange 0x40F
-#define T2_Err_Invalid_Displacement 0x410
-#define T2_Err_Execution_Too_Long 0x411
+#define T2_Err_Invalid_Opcode 0x500
+#define T2_Err_Too_Few_Arguments 0x501
+#define T2_Err_Stack_Overflow 0x502
+#define T2_Err_Code_Overflow 0x503
+#define T2_Err_Bad_Argument 0x504
+#define T2_Err_Divide_By_Zero 0x505
+#define T2_Err_Storage_Overflow 0x506
+#define T2_Err_Cvt_Overflow 0x507
+#define T2_Err_Invalid_Reference 0x508
+#define T2_Err_Invalid_Distance 0x509
+#define T2_Err_Interpolate_Twilight 0x50A
+#define T2_Err_Debug_OpCode 0x50B
+#define T2_Err_ENDF_In_Exec_Stream 0x50C
+#define T2_Err_Out_Of_CodeRanges 0x50D
+#define T2_Err_Nested_DEFS 0x50E
+#define T2_Err_Invalid_CodeRange 0x50F
+#define T2_Err_Invalid_Displacement 0x510
+#define T2_Err_Execution_Too_Long 0x511
-#define T2_Err_Too_Many_Instruction_Defs 0x412
-#define T2_Err_Too_Many_Function_Defs 0x412
+#define T2_Err_Too_Many_Instruction_Defs 0x512
+#define T2_Err_Too_Many_Function_Defs 0x513
/* Other TrueType specific error codes. */
-#define T2_Err_Table_Missing 0x420
-#define T2_Err_Too_Many_Extensions 0x421
-#define T2_Err_Extensions_Unsupported 0x422
-#define T2_Err_Invalid_Extension_Id 0x423
+#define T2_Err_Table_Missing 0x520
+#define T2_Err_Too_Many_Extensions 0x521
+#define T2_Err_Extensions_Unsupported 0x522
+#define T2_Err_Invalid_Extension_Id 0x523
-#define T2_Err_No_Vertical_Data 0x424
+#define T2_Err_No_Vertical_Data 0x524
-#define T2_Err_Max_Profile_Missing 0x430
-#define T2_Err_Header_Table_Missing 0x431
-#define T2_Err_Horiz_Header_Missing 0x432
-#define T2_Err_Locations_Missing 0x433
-#define T2_Err_Name_Table_Missing 0x434
-#define T2_Err_CMap_Table_Missing 0x435
-#define T2_Err_Hmtx_Table_Missing 0x436
-#define T2_Err_OS2_Table_Missing 0x437
-#define T2_Err_Post_Table_Missing 0x438
+#define T2_Err_Max_Profile_Missing 0x530
+#define T2_Err_Header_Table_Missing 0x531
+#define T2_Err_Horiz_Header_Missing 0x532
+#define T2_Err_Locations_Missing 0x533
+#define T2_Err_Name_Table_Missing 0x534
+#define T2_Err_CMap_Table_Missing 0x535
+#define T2_Err_Hmtx_Table_Missing 0x536
+#define T2_Err_OS2_Table_Missing 0x537
+#define T2_Err_Post_Table_Missing 0x538
-#define T2_Err_Invalid_Horiz_Metrics 0x440
-#define T2_Err_Invalid_CharMap_Format 0x441
-#define T2_Err_Invalid_PPem 0x442
-#define T2_Err_Invalid_Vert_Metrics 0x443
+#define T2_Err_Invalid_Horiz_Metrics 0x540
+#define T2_Err_Invalid_CharMap_Format 0x541
+#define T2_Err_Invalid_PPem 0x542
+#define T2_Err_Invalid_Vert_Metrics 0x543
-#define T2_Err_Could_Not_Find_Context 0x450
+#define T2_Err_Could_Not_Find_Context 0x550
#endif /* FTERRID_H */
--- a/include/freetype/internal/tterrors.h
+++ b/include/freetype/internal/tterrors.h
@@ -47,9 +47,6 @@
#define TT_Err_Invalid_Glyph_Index FT_Err_Invalid_Glyph_Index
#define TT_Err_Unimplemented_Feature FT_Err_Unimplemented_Feature
-#define TT_Err_Unavailable_Outline FT_Err_Unavailable_Outline
-#define TT_Err_Unavailable_Bitmap FT_Err_Unavailable_Bitmap
-#define TT_Err_File_Is_Not_Collection FT_Err_File_Is_Not_Collection
#define TT_Err_Invalid_Engine FT_Err_Invalid_Driver_Handle
@@ -60,8 +57,6 @@
/* General glyph outline errors. */
-#define TT_Err_Too_Many_Points FT_Err_Too_Many_Points
-#define TT_Err_Too_Many_Contours FT_Err_Too_Many_Contours
#define TT_Err_Too_Many_Ins FT_Err_Too_Many_Hints
#define TT_Err_Invalid_Composite FT_Err_Invalid_Composite
--- a/src/base/ftcalc.c
+++ b/src/base/ftcalc.c
@@ -26,7 +26,7 @@
/* */
/* Implementing basic computation routines. */
/* */
- /* FT_MulDiv() and FT_MulFix() are declared in freetype.h. */
+ /* FT_MulDiv(), FT_MulFix(), and FT_DivFix() are declared in freetype.h. */
/* */
/*************************************************************************/
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -856,7 +856,10 @@
/* vector. */
/* */
/* <Note> */
- /* The transformation is only applied to scalable image formats. */
+ /* The transformation is only applied to scalable image formats after */
+ /* the glyph has been loaded. It means that hinting is unaltered by */
+ /* the transformation and is performed on the character size given in */
+ /* the last call to FT_Set_Char_Sizes() or FT_Set_Pixel_Sizes(). */
/* */
FT_EXPORT_FUNC( void ) FT_Set_Transform( FT_Face face,
FT_Matrix* matrix,
@@ -1730,9 +1733,15 @@
FT_ListNode node = 0;
- if ( !face || !asize || !face->driver )
- return FT_Err_Invalid_Handle;
+ if ( !face )
+ return FT_Err_Invalid_Face_Handle;
+ if ( !asize )
+ return FT_Err_Invalid_Size_Handle;
+
+ if ( !face->driver )
+ return FT_Err_Invalid_Driver_Handle;
+
*asize = 0;
driver = face->driver;
@@ -2220,6 +2229,7 @@
/* */
/* <Input> */
/* face :: A handle to the source face object. */
+ /* */
/* charcode :: The character code. */
/* */
/* <Return> */
@@ -2621,8 +2631,8 @@
/* convert. */
/* */
/* render_mode :: This is the render mode used to render the glyph */
- /* image into a bitmap. See FT_Render_Mode() for a */
- /* list of possible values. */
+ /* image into a bitmap. See FT_Render_Mode for a list */
+ /* of possible values. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
@@ -2980,7 +2990,7 @@
}
}
}
- return FT_Err_Invalid_Handle;
+ return FT_Err_Invalid_Driver_Handle;
}
--- a/src/base/ftoutln.c
+++ b/src/base/ftoutln.c
@@ -697,7 +697,7 @@
if ( !error || error != FT_Err_Cannot_Render_Glyph )
break;
- /* FT_Err_Cannot_Render_Glyph is returned when the render mode */
+ /* FT_Err_Cannot_Render_Glyph is returned if the render mode */
/* is unsupported by the current renderer for this glyph image */
/* format */
--- a/src/cff/t2gload.c
+++ b/src/cff/t2gload.c
@@ -1309,8 +1309,8 @@
FT_Int dx = 0, dy = 0; /* used in horizontal/vertical */
/* algorithm below */
FT_Int horizontal, count;
-
+
FT_TRACE4(( " flex1" ));
/* adding five more points; 4 control points, 1 on-curve point */
@@ -1343,7 +1343,7 @@
/* strange test, but here it is... */
horizontal = ( dx > dy );
-
+
for ( count = 5; count > 0; count-- )
{
x += args[0];
@@ -1351,7 +1351,7 @@
add_point( builder, x, y, (FT_Bool)( count == 3 ) );
args += 2;
}
-
+
if ( horizontal )
{
x += args[0];
--- a/src/cff/t2load.c
+++ b/src/cff/t2load.c
@@ -386,9 +386,8 @@
goto Exit;
break;
-
default: /* hmm... that's wrong */
- error = FT_Err_Invalid_File_Format;
+ error = T2_Err_Invalid_File_Format;
}
Exit:
--- a/src/cff/t2objs.c
+++ b/src/cff/t2objs.c
@@ -103,7 +103,7 @@
if ( !charset_offset )
{
FT_ERROR(( "CFF.Build_Unicode_Charmap: charset table is missing\n" ));
- error = FT_Err_Invalid_File_Format;
+ error = T2_Err_Invalid_File_Format;
goto Exit;
}
@@ -177,7 +177,7 @@
default: /* unknown charset format! */
FT_ERROR(( "CFF: unknown charset format!\n" ));
- error = FT_Err_Invalid_File_Format;
+ error = T2_Err_Invalid_File_Format;
goto Fail;
}
--- a/src/cff/t2objs.h
+++ b/src/cff/t2objs.h
@@ -94,7 +94,7 @@
{
TT_CharMapRec root;
PS_Unicodes unicodes;
-
+
} T2_CharMapRec, *T2_CharMap;
--- a/src/raster1/ftraster.c
+++ b/src/raster1/ftraster.c
@@ -158,7 +158,14 @@
#define FT_TRACE( x ) do ; while ( 0 ) /* nothing */
#endif
+#define Raster_Err_None 0
+#define Raster_Err_Not_Ini -1
+#define Raster_Err_Overflow -2
+#define Raster_Err_Neg_Height -3
+#define Raster_Err_Invalid -4
+#define Raster_Err_Unsupported -5
+
#else /* _STANDALONE_ */
@@ -165,17 +172,16 @@
#include <freetype/internal/ftobjs.h>
#include <freetype/internal/ftdebug.h> /* for FT_TRACE() and FT_ERROR() */
+#define Raster_Err_None FT_Err_Ok
+#define Raster_Err_Not_Ini FT_Err_Raster_Uninitialized
+#define Raster_Err_Overflow FT_Err_Raster_Overflow
+#define Raster_Err_Neg_Height FT_Err_Raster_Negative_Height
+#define Raster_Err_Invalid FT_Err_Invalid_Outline
+#define Raster_Err_Unsupported FT_Err_Unimplemented_Feature
+
#endif /* _STANDALONE_ */
-
-#define Raster_Err_None 0
-#define Raster_Err_Not_Ini -1
-#define Raster_Err_Overflow -2
-#define Raster_Err_Neg_Height -3
-#define Raster_Err_Invalid -4
-#define Raster_Err_Gray_Unsupported -5
-#define Raster_Err_Unsupported -6
/* FMulDiv means `Fast MulDiv'; it is used in case where `b' is */
/* typically a small value and the result of a*b is known to fit into */
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -94,12 +94,11 @@
#define FT_COMPONENT trace_aaraster
- /* XXX: Adapt error code to FreeType conventions */
-#define ErrRaster_Invalid_Outline -1
-
#ifdef _STANDALONE_
+
#define ErrRaster_Invalid_Mode -2
+#define ErrRaster_Invalid_Outline -1
#include "ftimage.h"
#include "ftgrays.h"
@@ -140,6 +139,7 @@
#include <freetype/ftoutln.h> /* for FT_Outline_Decompose() */
#define ErrRaster_Invalid_Mode FT_Err_Cannot_Render_Glyph
+#define ErrRaster_Invalid_Outline FT_Err_Invalid_Outline
#endif /* _STANDALONE_ */
--- a/src/smooth/ftsmooth.c
+++ b/src/smooth/ftsmooth.c
@@ -38,8 +38,8 @@
FT_Error ft_smooth_init( FT_Renderer render )
{
FT_Library library = FT_MODULE_LIBRARY( render );
-
+
render->clazz->raster_class->raster_reset( render->raster,
library->raster_pool,
library->raster_pool_size );
@@ -46,8 +46,8 @@
return 0;
}
-
+
/* sets render-specific mode */
static
FT_Error ft_smooth_set_mode( FT_Renderer render,
@@ -58,7 +58,7 @@
return render->clazz->raster_class->raster_set_mode( render->raster,
mode_tag,
data );
- }
+ }
/* transform a given glyph image */
static
@@ -68,20 +68,20 @@
FT_Vector* delta )
{
FT_Error error = FT_Err_Ok;
-
+
if ( slot->format != render->glyph_format )
{
error = FT_Err_Invalid_Argument;
goto Exit;
}
-
+
if ( matrix )
FT_Outline_Transform( &slot->outline, matrix );
-
+
if ( delta )
FT_Outline_Translate( &slot->outline, delta->x, delta->y );
-
+
Exit:
return error;
}
@@ -97,9 +97,9 @@
if ( slot->format == render->glyph_format )
FT_Outline_Get_CBox( &slot->outline, cbox );
- }
-
+ }
+
/* convert a slot's glyph image into a bitmap */
static
FT_Error ft_smooth_render( FT_Renderer render,
@@ -113,10 +113,10 @@
FT_UInt width, height, pitch;
FT_Bitmap* bitmap;
FT_Memory memory;
-
+
FT_Raster_Params params;
-
+
/* check glyph image format */
if ( slot->format != render->glyph_format )
{
@@ -123,20 +123,20 @@
error = FT_Err_Invalid_Argument;
goto Exit;
}
-
+
/* check mode */
if ( mode != ft_render_mode_normal )
return FT_Err_Cannot_Render_Glyph;
-
+
outline = &slot->outline;
-
+
/* translate the outline to the new origin if needed */
if ( origin )
FT_Outline_Translate( outline, origin->x, origin->y );
-
+
/* compute the control box, and grid fit it */
FT_Outline_Get_CBox( outline, &cbox );
-
+
cbox.xMin &= -64;
cbox.yMin &= -64;
cbox.xMax = ( cbox.xMax + 63 ) & -64;
@@ -146,7 +146,7 @@
height = ( cbox.yMax - cbox.yMin ) >> 6;
bitmap = &slot->bitmap;
memory = render->root.memory;
-
+
/* release old bitmap buffer */
if ( slot->flags & ft_glyph_own_bitmap )
{
@@ -153,7 +153,7 @@
FREE( bitmap->buffer );
slot->flags &= ~ft_glyph_own_bitmap;
}
-
+
/* allocate new one, depends on pixel format */
pitch = width;
bitmap->pixel_mode = ft_pixel_mode_grays;
@@ -161,12 +161,12 @@
bitmap->width = width;
bitmap->rows = height;
bitmap->pitch = pitch;
-
+
if ( ALLOC( bitmap->buffer, (FT_ULong)pitch * height ) )
goto Exit;
slot->flags |= ft_glyph_own_bitmap;
-
+
/* translate outline to render it into the bitmap */
FT_Outline_Translate( outline, -cbox.xMin, -cbox.yMin );
@@ -179,7 +179,7 @@
error = render->raster_render( render->raster, ¶ms );
if ( error )
goto Exit;
-
+
slot->format = ft_glyph_format_bitmap;
slot->bitmap_left = cbox.xMin >> 6;
slot->bitmap_top = cbox.yMax >> 6;
@@ -194,13 +194,13 @@
{
ft_module_renderer,
sizeof( FT_RendererRec ),
-
+
"smooth",
0x10000L,
0x20000L,
-
+
0, /* module specific interface */
-
+
(FT_Module_Constructor)ft_smooth_init,
(FT_Module_Destructor) 0,
(FT_Module_Requester) 0
@@ -207,12 +207,12 @@
},
ft_glyph_format_outline,
-
+
(FTRenderer_render) ft_smooth_render,
(FTRenderer_transform)ft_smooth_transform,
(FTRenderer_getCBox) ft_smooth_get_cbox,
(FTRenderer_setMode) ft_smooth_set_mode,
-
+
(FT_Raster_Funcs*) &ft_grays_raster
};
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -436,20 +436,20 @@
ft_module_font_driver |
ft_module_driver_scalable |
ft_module_driver_has_hinter,
-
+
sizeof ( TT_DriverRec ),
-
+
"truetype", /* driver name */
0x10000L, /* driver version == 1.0 */
0x20000L, /* driver requires FreeType 2.0 or above */
-
+
(void*)0, /* driver specific interface */
-
+
(FT_Module_Constructor)TT_Init_Driver,
(FT_Module_Destructor) TT_Done_Driver,
(FT_Module_Requester) tt_get_interface,
},
-
+
sizeof ( TT_FaceRec ),
sizeof ( TT_SizeRec ),
sizeof ( FT_GlyphSlotRec ),
@@ -466,7 +466,7 @@
(FTDriver_setPixelSizes)Set_Pixel_Sizes,
(FTDriver_loadGlyph) Load_Glyph,
(FTDriver_getCharIndex) Get_Char_Index,
-
+
(FTDriver_getKerning) Get_Kerning,
(FTDriver_attachFile) 0,
(FTDriver_getAdvances) 0
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -217,7 +217,7 @@
Exit:
return error;
-
+
Bad_Format:
error = FT_Err_Unknown_File_Format;
goto Exit;
@@ -683,7 +683,7 @@
/* set `extra' in glyph loader */
error = FT_GlyphLoader_Create_Extra( FT_DRIVER( driver )->glyph_loader );
-
+
/* init extension registry if needed */
#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
--- a/src/type1/t1driver.c
+++ b/src/type1/t1driver.c
@@ -287,13 +287,13 @@
{
ft_module_font_driver | ft_module_driver_scalable,
sizeof( FT_DriverRec ),
-
+
"type1", /* driver name */
0x10000L, /* driver version 1.0 */
0x20000L, /* driver requires FreeType 2.0 or above */
-
+
0, /* module specific interface */
-
+
(FT_Module_Constructor)0,
(FT_Module_Destructor) 0,
#ifdef T1_CONFIG_OPTION_NO_AFM
--- a/src/type1/t1gload.c
+++ b/src/type1/t1gload.c
@@ -84,7 +84,7 @@
{
if ( reset_base )
FT_GlyphLoader_Rewind( builder->loader );
-
+
FT_GlyphLoader_Prepare( builder->loader );
}
}
@@ -130,7 +130,7 @@
{
FT_GlyphLoader* loader = FT_SLOT( glyph )->loader;
-
+
builder->loader = loader;
builder->base = &loader->base.outline;
builder->current = &loader->current.outline;
@@ -311,7 +311,7 @@
error = FT_GlyphLoader_Check_Subglyphs( loader, 2 );
if ( error )
goto Exit;
-
+
subg = loader->current.subglyphs;
/* subglyph 0 = base character */
@@ -332,7 +332,7 @@
glyph->num_subglyphs = 2;
glyph->subglyphs = loader->current.subglyphs;
glyph->format = ft_glyph_format_composite;
-
+
loader->current.num_subglyphs = 2;
goto Exit;
}
@@ -339,7 +339,7 @@
/* First load `bchar' in builder */
/* now load the unscaled outline */
-
+
if ( decoder->builder.loader )
FT_GlyphLoader_Prepare( decoder->builder.loader ); /* prepare loader */
@@ -384,7 +384,7 @@
{
FT_Outline dummy;
-
+
dummy.n_points = base->n_points - n_base_points;
dummy.points = base->points + n_base_points;
@@ -1266,14 +1266,14 @@
FT_Int first = 0;
FT_Vector* p1 = cur->points + first;
FT_Vector* p2 = cur->points + cur->n_points - 1;
-
+
if ( cur->n_contours > 1 )
{
first = cur->contours[cur->n_contours - 2] + 1;
p1 = cur->points + first;
}
-
+
if ( p1->x == p2->x && p1->y == p2->y )
cur->n_points--;
}
@@ -1546,16 +1546,16 @@
FT_UInt old_points, old_contours;
FT_GlyphLoader* loader = decoder->builder.loader;
FT_Error error;
-
+
/* Pass 1 -- try to load first glyph, simply recording points */
old_points = loader->base.outline.n_points;
old_contours = loader->base.outline.n_contours;
-
+
FT_GlyphLoader_Prepare( decoder->builder.loader );
T1_Reset_Builder( builder, 0 );
-
+
builder->no_recurse = recurse;
builder->pass = 0;
glyph->hints->hori_stems.num_stems = 0;
@@ -1568,7 +1568,7 @@
type1->subrs,
type1->subrs_len );
if ( error )
- goto Exit;
+ goto Exit;
/* check for composite (i.e. `seac' operator) */
if ( glyph->root.format == ft_glyph_format_composite )
@@ -1603,7 +1603,7 @@
error = t1_load_hinted_glyph( decoder, subglyph->index, 0 );
if ( error )
goto Exit;
-
+
/* Finally, move the accent */
dx = FT_MulFix( subglyph->arg1, size->root.metrics.x_scale );
dy = FT_MulFix( subglyph->arg2, size->root.metrics.y_scale );
@@ -1612,7 +1612,7 @@
{
FT_Outline dummy;
-
+
dummy.n_points = loader->base.outline.n_points - n_base_points;
dummy.points = loader->base.outline.points + n_base_points;
@@ -1628,7 +1628,7 @@
{
/* All right, pass 1 is finished, now grid-fit all stem hints */
T1_Hint_Stems( &decoder->builder );
-
+
/* undo the end-char */
builder->base->n_points = old_points;
builder->base->n_contours = old_contours;
@@ -1635,10 +1635,10 @@
/* Pass 2 -- record and scale/hint the points */
T1_Reset_Builder( builder, 0 );
-
+
builder->pass = 1;
builder->no_recurse = 0;
-
+
error = T1_Parse_CharStrings( decoder,
type1->charstrings [glyph_index],
type1->charstrings_len[glyph_index],
@@ -1646,14 +1646,14 @@
type1->subrs,
type1->subrs_len );
}
-
+
/* save new glyph tables */
if ( recurse )
T1_Done_Builder( builder );
-
+
Exit:
return error;
- }
+ }
#endif /* !T1_CONFIG_OPTION_DISABLE_HINTER */
@@ -1694,7 +1694,7 @@
T1_Init_Decoder( &decoder, &t1_hinter_funcs );
T1_Init_Builder( &decoder.builder, face, size, glyph,
&gload_builder_interface );
-
+
error = t1_load_hinted_glyph( &decoder, glyph_index, 1 );
}
else
--- a/src/type1/t1load.c
+++ b/src/type1/t1load.c
@@ -890,7 +890,7 @@
tokzer->cursor += count; /* skip */
-
+
if ( face->type1.private_dict.lenIV >= 0 )
{
t1_decrypt( base, count, 4330 );
--- a/src/type1/t1objs.c
+++ b/src/type1/t1objs.c
@@ -291,10 +291,10 @@
psnames = (PSNames_Interface*)
FT_Get_Module_Interface( FT_FACE_LIBRARY( face ),
"psnames" );
-
+
face->psnames = psnames;
}
-
+
/* open the tokenizer, this will also check the font format */
error = New_Tokenizer( stream, &tokenizer );
if ( error )
--- a/src/type1/t1tokens.c
+++ b/src/type1/t1tokens.c
@@ -946,7 +946,7 @@
tok->token.kind = ( c >= '0' && c <= '9' ? tok_number : tok_any );
goto L2;
}
-
+
if ( grow( tok ) )
goto Exit;
base = tok->base;
--- a/src/type1z/z1driver.c
+++ b/src/type1z/z1driver.c
@@ -83,16 +83,16 @@
{
FT_UNUSED( driver );
FT_UNUSED( interface );
-
+
#ifndef Z1_CONFIG_OPTION_NO_MM_SUPPORT
if ( strcmp( (const char*)interface, "get_mm" ) == 0 )
return (FT_Module_Interface)Z1_Get_Multi_Master;
-
+
if ( strcmp( (const char*)interface, "set_mm_design") == 0 )
- return (FT_Module_Interface)Z1_Set_MM_Design;
+ return (FT_Module_Interface)Z1_Set_MM_Design;
if ( strcmp( (const char*)interface, "set_mm_blend") == 0 )
- return (FT_Module_Interface)Z1_Set_MM_Blend;
+ return (FT_Module_Interface)Z1_Set_MM_Blend;
#endif
return 0;
}
@@ -259,13 +259,13 @@
{
ft_module_font_driver | ft_module_driver_scalable,
sizeof( FT_DriverRec ),
-
+
"type1z",
0x10000L,
0x20000L,
-
+
0, /* format interface */
-
+
(FT_Module_Constructor)Z1_Init_Driver,
(FT_Module_Destructor) Z1_Done_Driver,
(FT_Module_Requester) Get_Interface,
--- a/src/type1z/z1gload.c
+++ b/src/type1z/z1gload.c
@@ -156,8 +156,8 @@
if ( glyph )
{
FT_GlyphLoader* loader = glyph->root.loader;
-
+
builder->loader = loader;
builder->current = &loader->current.outline;
builder->base = &loader->base.outline;
@@ -303,7 +303,7 @@
{
if ( outline->n_contours > 0 )
outline->contours[outline->n_contours - 1] = outline->n_points - 1;
-
+
outline->n_contours++;
}
@@ -346,18 +346,18 @@
FT_Int first = 0;
FT_Vector* p1 = outline->points + first;
FT_Vector* p2 = outline->points + outline->n_points-1;
-
+
if ( outline->n_contours > 1 )
{
first = outline->contours[outline->n_contours - 2] + 1;
p1 = outline->points + first;
}
-
+
if ( p1->x == p2->x && p1->y == p2->y )
outline->n_points--;
}
-
+
if ( outline->n_contours > 0 )
outline->contours[outline->n_contours - 1] = outline->n_points - 1;
}
@@ -474,7 +474,7 @@
error = FT_GlyphLoader_Check_Subglyphs( loader, 2 );
if ( error )
goto Exit;
-
+
subg = loader->current.subglyphs;
/* subglyph 0 = base character */
@@ -495,13 +495,13 @@
glyph->num_subglyphs = 2;
glyph->subglyphs = loader->base.subglyphs;
glyph->format = ft_glyph_format_composite;
-
+
loader->current.num_subglyphs = 2;
}
/* First load `bchar' in builder */
/* now load the unscaled outline */
-
+
FT_GlyphLoader_Prepare( decoder->builder.loader ); /* prepare loader */
error = Z1_Parse_CharStrings( decoder,
@@ -546,7 +546,7 @@
{
FT_Outline dummy;
-
+
dummy.n_points = base->n_points - n_base_points;
dummy.points = base->points + n_base_points;
FT_Outline_Translate( &dummy, adx - asb, ady );
@@ -889,7 +889,7 @@
/* counter control hints, clear stack */
top = decoder->stack;
break;
-
+
case 14:
case 15:
case 16:
@@ -901,7 +901,7 @@
FT_Int* delta;
FT_Int* values;
-
+
if ( !blend )
{
FT_ERROR(( "Z1_Parse_CharStrings:" ));
@@ -908,7 +908,7 @@
FT_ERROR(( " unexpected multiple masters operator!\n" ));
goto Syntax_Error;
}
-
+
num_points = top[1] - 13 + ( top[1] == 18 );
if ( top[0] != (FT_Int)( num_points * blend->num_designs ) )
{
@@ -916,7 +916,7 @@
FT_ERROR(( " incorrect number of mm arguments\n" ));
goto Syntax_Error;
}
-
+
top -= blend->num_designs*num_points;
if ( top < decoder->stack )
goto Stack_Underflow;
@@ -951,7 +951,7 @@
/* note that `top' will be incremented later by calls to `pop' */
break;
}
-
+
default:
Unexpected_OtherSubr:
FT_ERROR(( "Z1_Parse_CharStrings: invalid othersubr [%d %d]!\n",
--- a/src/type1z/z1load.c
+++ b/src/type1z/z1load.c
@@ -104,7 +104,7 @@
/***** *****/
/*************************************************************************/
/*************************************************************************/
-
+
static
FT_Error t1_allocate_blend( T1_Face face,
FT_UInt num_designs,
@@ -113,17 +113,17 @@
T1_Blend* blend;
FT_Memory memory = face->root.memory;
FT_Error error = 0;
-
-
+
+
blend = face->blend;
if ( !blend )
{
if ( ALLOC( blend, sizeof ( *blend ) ) )
goto Exit;
-
+
face->blend = blend;
}
-
+
/* allocate design data if needed */
if ( num_designs > 0 )
{
@@ -134,9 +134,9 @@
ALLOC_ARRAY( blend->privates[1], num_designs, T1_Private ) ||
ALLOC_ARRAY( blend->weight_vector, num_designs * 2, FT_Fixed ) )
goto Exit;
-
+
blend->default_weight_vector = blend->weight_vector + num_designs;
-
+
blend->font_infos[0] = &face->type1.font_info;
blend->privates [0] = &face->type1.private_dict;
blend->num_designs = num_designs;
@@ -144,16 +144,16 @@
else if ( blend->num_designs != num_designs )
goto Fail;
}
-
+
/* allocate axis data if needed */
if ( num_axis > 0 )
{
if ( blend->num_axis != 0 && blend->num_axis != num_axis )
goto Fail;
-
+
blend->num_axis = num_axis;
}
-
+
/* allocate the blend design pos table if needed */
num_designs = blend->num_designs;
num_axis = blend->num_axis;
@@ -160,25 +160,25 @@
if ( num_designs && num_axis && blend->design_pos[0] == 0 )
{
FT_UInt n;
-
-
+
+
if ( ALLOC_ARRAY( blend->design_pos[0],
num_designs * num_axis, FT_Fixed ) )
goto Exit;
-
+
for ( n = 1; n < num_designs; n++ )
blend->design_pos[n] = blend->design_pos[0] + num_axis * n;
}
-
+
Exit:
return error;
-
+
Fail:
error = -1;
goto Exit;
- }
-
-
+ }
+
+
LOCAL_FUNC
FT_Error Z1_Get_Multi_Master( T1_Face face,
FT_Multi_Master* master )
@@ -186,21 +186,21 @@
T1_Blend* blend = face->blend;
FT_UInt n;
FT_Error error;
-
-
+
+
error = T1_Err_Invalid_Argument;
-
+
if ( blend )
{
master->num_axis = blend->num_axis;
master->num_designs = blend->num_designs;
-
+
for ( n = 0; n < blend->num_axis; n++ )
{
FT_MM_Axis* axis = master->axis + n;
T1_DesignMap* map = blend->design_map + n;
-
-
+
+
axis->name = blend->axis_names[n];
axis->minimum = map->design_points[0];
axis->maximum = map->design_points[map->num_points - 1];
@@ -208,9 +208,9 @@
error = 0;
}
return error;
- }
-
-
+ }
+
+
LOCAL_FUNC
FT_Error Z1_Set_MM_Blend( T1_Face face,
FT_UInt num_coords,
@@ -219,8 +219,8 @@
T1_Blend* blend = face->blend;
FT_Error error;
FT_UInt n, m;
-
+
error = T1_Err_Invalid_Argument;
if ( blend && blend->num_axis == num_coords )
@@ -236,16 +236,16 @@
for ( m = 0; m < blend->num_axis; m++ )
{
FT_Fixed factor;
-
+
/* get current blend axis position */
factor = coords[m];
if ( factor < 0 ) factor = 0;
if ( factor > 0x10000L ) factor = 0x10000L;
-
+
if ( ( n & ( 1 << m ) ) == 0 )
factor = 0x10000L - factor;
-
+
result = FT_MulFix( result, factor );
}
blend->weight_vector[n] = result;
@@ -255,8 +255,8 @@
}
return error;
}
-
-
+
+
LOCAL_FUNC
FT_Error Z1_Set_MM_Design( T1_Face face,
FT_UInt num_coords,
@@ -266,14 +266,14 @@
FT_Error error;
FT_UInt n, p;
-
+
error = T1_Err_Invalid_Argument;
if ( blend && blend->num_axis == num_coords )
{
/* compute the blend coordinates through the blend design map */
FT_Fixed final_blends[T1_MAX_MM_DESIGNS];
-
+
for ( n = 0; n < blend->num_axis; n++ )
{
FT_Long design = coords[n];
@@ -282,12 +282,12 @@
FT_Fixed* designs = map->design_points;
FT_Fixed* blends = map->blend_points;
FT_Int before = -1, after = -1;
-
+
for ( p = 0; p < map->num_points; p++ )
{
FT_Fixed p_design = designs[p];
-
+
/* exact match ? */
if ( design == p_design )
{
@@ -294,23 +294,23 @@
the_blend = blends[p];
goto Found;
}
-
+
if ( design < p_design )
{
after = p;
break;
}
-
+
before = p;
}
-
+
/* now, interpolate if needed */
if ( before < 0 )
the_blend = blends[0];
-
+
else if ( after < 0 )
the_blend = blends[map->num_points - 1];
-
+
else
the_blend = FT_MulDiv( design - designs[before],
blends [after] - blends [before],
@@ -319,33 +319,33 @@
Found:
final_blends[n] = the_blend;
}
-
- error = Z1_Set_MM_Blend( face, num_coords, final_blends );
+
+ error = Z1_Set_MM_Blend( face, num_coords, final_blends );
}
return error;
}
-
-
+
+
LOCAL_FUNC
void Z1_Done_Blend( T1_Face face )
{
FT_Memory memory = face->root.memory;
T1_Blend* blend = face->blend;
-
+
if ( blend )
{
FT_UInt num_designs = blend->num_designs;
FT_UInt num_axis = blend->num_axis;
FT_UInt n;
-
+
/* release design pos table */
FREE( blend->design_pos[0] );
for ( n = 1; n < num_designs; n++ )
blend->design_pos[n] = 0;
-
+
/* release blend `private' and `font info' dictionaries */
FREE( blend->privates[1] );
FREE( blend->font_infos[1] );
@@ -355,15 +355,15 @@
blend->privates [n] = 0;
blend->font_infos[n] = 0;
}
-
+
/* release weight vectors */
FREE( blend->weight_vector );
blend->default_weight_vector = 0;
-
+
/* release axis names */
for ( n = 0; n < num_axis; n++ )
FREE( blend->axis_names[n] );
-
+
/* release design map */
for ( n = 0; n < num_axis; n++ )
{
@@ -373,12 +373,12 @@
FREE( dmap->design_points );
dmap->num_points = 0;
}
-
+
FREE( face->blend );
}
}
-
-
+
+
static
void parse_blend_axis_types( T1_Face face,
Z1_Loader* loader )
@@ -388,8 +388,8 @@
FT_Error error = 0;
T1_Blend* blend;
FT_Memory memory;
-
+
/* take an array of objects */
Z1_ToTokenArray( &loader->parser, axis_tokens,
T1_MAX_MM_AXIS, &num_axis );
@@ -400,15 +400,15 @@
error = T1_Err_Invalid_File_Format;
goto Exit;
}
-
+
/* allocate blend if necessary */
error = t1_allocate_blend( face, 0, (FT_UInt)num_axis );
if ( error )
goto Exit;
-
+
blend = face->blend;
memory = face->root.memory;
-
+
/* each token is an immediate containing the name of the axis */
for ( n = 0; n < num_axis; n++ )
{
@@ -415,11 +415,11 @@
Z1_Token_Rec* token = axis_tokens + n;
FT_Byte* name;
FT_Int len;
-
+
/* skip first slash, if any */
if (token->start[0] == '/')
token->start++;
-
+
len = token->limit - token->start;
if ( len <= 0 )
{
@@ -426,20 +426,20 @@
error = T1_Err_Invalid_File_Format;
goto Exit;
}
-
+
if ( ALLOC( blend->axis_names[n], len + 1 ) )
goto Exit;
-
+
name = (FT_Byte*)blend->axis_names[n];
MEM_Copy( name, token->start, len );
name[len] = 0;
}
-
- Exit:
+
+ Exit:
loader->parser.error = error;
}
-
-
+
+
static
void parse_blend_design_positions( T1_Face face,
Z1_Loader* loader )
@@ -448,12 +448,12 @@
FT_Int num_designs;
FT_Int num_axis;
Z1_Parser* parser = &loader->parser;
-
+
FT_Error error = 0;
T1_Blend* blend;
-
- /* get the array of design tokens - compute number of designs */
+
+ /* get the array of design tokens - compute number of designs */
Z1_ToTokenArray( parser, design_tokens, T1_MAX_MM_DESIGNS, &num_designs );
if ( num_designs <= 0 || num_designs > T1_MAX_MM_DESIGNS )
{
@@ -463,13 +463,13 @@
error = T1_Err_Invalid_File_Format;
goto Exit;
}
-
+
{
FT_Byte* old_cursor = parser->cursor;
FT_Byte* old_limit = parser->limit;
FT_UInt n;
-
+
blend = face->blend;
num_axis = 0; /* make compiler happy */
@@ -478,14 +478,14 @@
Z1_Token_Rec axis_tokens[ T1_MAX_MM_DESIGNS ];
Z1_Token_Rec* token;
FT_Int axis, n_axis;
-
+
/* read axis/coordinates tokens */
token = design_tokens + n;
parser->cursor = token->start - 1;
parser->limit = token->limit + 1;
Z1_ToTokenArray( parser, axis_tokens, T1_MAX_MM_AXIS, &n_axis );
-
+
if ( n == 0 )
{
num_axis = n_axis;
@@ -500,7 +500,7 @@
error = T1_Err_Invalid_File_Format;
goto Exit;
}
-
+
/* now, read each axis token into the design position */
for ( axis = 0; axis < n_axis; axis++ )
{
@@ -512,16 +512,16 @@
blend->design_pos[n][axis] = Z1_ToFixed( parser, 0 );
}
}
-
+
loader->parser.cursor = old_cursor;
loader->parser.limit = old_limit;
}
-
+
Exit:
loader->parser.error = error;
}
-
+
static
void parse_blend_design_map( T1_Face face,
Z1_Loader* loader )
@@ -534,8 +534,8 @@
FT_Byte* old_cursor;
FT_Byte* old_limit;
FT_Memory memory = face->root.memory;
-
+
Z1_ToTokenArray( parser, axis_tokens, T1_MAX_MM_AXIS, &num_axis );
if ( num_axis <= 0 || num_axis > T1_MAX_MM_AXIS )
{
@@ -546,12 +546,12 @@
}
old_cursor = parser->cursor;
old_limit = parser->limit;
-
+
error = t1_allocate_blend( face, 0, num_axis );
if ( error )
goto Exit;
blend = face->blend;
-
+
/* now, read each axis design map */
for ( n = 0; n < num_axis; n++ )
{
@@ -558,18 +558,18 @@
T1_DesignMap* map = blend->design_map + n;
Z1_Token_Rec* token;
FT_Int p, num_points;
-
+
token = axis_tokens + n;
parser->cursor = token->start;
parser->limit = token->limit;
-
+
/* count the number of map points */
{
FT_Byte* p = token->start;
FT_Byte* limit = token->limit;
-
+
num_points = 0;
for ( ; p < limit; p++ )
if ( p[0] == '[' )
@@ -581,20 +581,20 @@
error = T1_Err_Invalid_File_Format;
goto Exit;
}
-
+
/* allocate design map data */
if ( ALLOC_ARRAY( map->design_points, num_points * 2, FT_Fixed ) )
goto Exit;
map->blend_points = map->design_points + num_points;
map->num_points = (FT_Byte)num_points;
-
+
for ( p = 0; p < num_points; p++ )
{
map->design_points[p] = Z1_ToInt( parser );
map->blend_points [p] = Z1_ToFixed( parser, 0 );
}
- }
-
+ }
+
parser->cursor = old_cursor;
parser->limit = old_limit;
@@ -601,8 +601,8 @@
Exit:
parser->error = error;
}
-
+
static
void parse_weight_vector( T1_Face face,
Z1_Loader* loader )
@@ -614,8 +614,8 @@
FT_UInt n;
FT_Byte* old_cursor;
FT_Byte* old_limit;
-
+
if ( !blend || blend->num_designs == 0 )
{
FT_ERROR(( "parse_weight_vector: too early!\n" ));
@@ -622,7 +622,7 @@
error = T1_Err_Invalid_File_Format;
goto Exit;
}
-
+
Z1_ToToken( parser, &master );
if ( master.type != t1_token_array )
{
@@ -630,10 +630,10 @@
error = T1_Err_Invalid_File_Format;
goto Exit;
}
-
+
old_cursor = parser->cursor;
old_limit = parser->limit;
-
+
parser->cursor = master.start;
parser->limit = master.limit;
@@ -642,7 +642,7 @@
blend->default_weight_vector[n] =
blend->weight_vector[n] = Z1_ToFixed( parser, 0 );
}
-
+
parser->cursor = old_cursor;
parser->limit = old_limit;
@@ -649,8 +649,8 @@
Exit:
parser->error = error;
}
-
+
/* the keyword `/shareddict' appears in some multiple master fonts */
/* with a lot of Postscript garbage behind it (that's completely out */
/* of spec!); we detect it and terminate the parsing */
@@ -660,10 +660,10 @@
Z1_Loader* loader )
{
Z1_Parser* parser = &loader->parser;
-
+
FT_UNUSED( face );
-
+
parser->cursor = parser->limit;
parser->error = 0;
}
@@ -670,7 +670,7 @@
#endif /* Z1_CONFIG_OPTION_NO_MM_SUPPORT */
-
+
/*************************************************************************/
/*************************************************************************/
/***** *****/
@@ -696,12 +696,12 @@
static \
const Z1_Field_Rec t1_field_ ## _field = \
Z1_FIELD_BOOL( T1TYPE, _field );
-
+
#define Z1_NEW_NUM( _name, _field ) \
static \
const Z1_Field_Rec t1_field_ ## _field = \
Z1_FIELD_NUM( T1TYPE, _field );
-
+
#define Z1_NEW_FIXED( _name, _field ) \
static \
const Z1_Field_Rec t1_field_ ## _field = \
@@ -711,7 +711,7 @@
static \
const Z1_Field_Rec t1_field_ ## _field = \
Z1_FIELD_NUM_ARRAY( T1TYPE, _field, _count, _max );
-
+
#define Z1_NEW_FIXED_TABLE( _name, _field, _max, _count ) \
static \
const Z1_Field_Rec t1_field_ ## _field = \
@@ -721,7 +721,7 @@
static \
const Z1_Field_Rec t1_field_ ## _field = \
Z1_FIELD_NUM_ARRAY2( T1TYPE, _field, _max );
-
+
#define Z1_NEW_FIXED_TABLE2( _name, _field, _max ) \
static \
const Z1_Field_Rec t1_field_ ## _field = \
@@ -767,19 +767,19 @@
t1_keyword_callback = 0,
t1_keyword_field,
t1_keyword_field_table
-
+
} Z1_KeyWord_Type;
-
+
typedef enum Z1_KeyWord_Location_
{
t1_keyword_type1 = 0,
t1_keyword_font_info,
t1_keyword_private
-
+
} Z1_KeyWord_Location;
-
+
typedef struct Z1_KeyWord_
{
const char* name;
@@ -800,7 +800,7 @@
{ \
name, t1_keyword_field, t1_keyword_type1, 0, &t1_field_ ## f \
}
-
+
#define Z1_KEYWORD_FONTINFO( name, f ) \
{ \
name, t1_keyword_field, t1_keyword_font_info, 0, &t1_field_ ## f \
@@ -855,8 +855,8 @@
void** objects;
FT_UInt max_objects;
T1_Blend* blend = face->blend;
-
+
/* if the keyword has a dedicated callback, call it */
if ( keyword->type == t1_keyword_callback )
{
@@ -864,7 +864,7 @@
error = loader->parser.error;
goto Exit;
}
-
+
/* now, the keyword is either a simple field, or a table of fields; */
/* we are now going to take care of it */
switch ( keyword->location )
@@ -880,7 +880,7 @@
max_objects = blend->num_designs;
}
break;
-
+
case t1_keyword_private:
dummy_object = &face->type1.private_dict;
objects = &dummy_object;
@@ -892,13 +892,13 @@
max_objects = blend->num_designs;
}
break;
-
+
default:
dummy_object = &face->type1;
objects = &dummy_object;
max_objects = 0;
}
-
+
if ( keyword->type == t1_keyword_field_table )
error = Z1_Load_Field_Table( &loader->parser, keyword->field,
objects, max_objects, 0 );
@@ -905,10 +905,10 @@
else
error = Z1_Load_Field( &loader->parser, keyword->field,
objects, max_objects, 0 );
-
+
Exit:
return error;
- }
+ }
static
@@ -1392,7 +1392,7 @@
#include <type1z/z1tokens.h>
#endif
-
+
/* now add the special functions... */
Z1_KEYWORD_CALLBACK( "FontName", parse_font_name ),
Z1_KEYWORD_CALLBACK( "FontBBox", parse_font_bbox ),
@@ -1407,7 +1407,7 @@
Z1_KEYWORD_CALLBACK( "BlendAxisTypes", parse_blend_axis_types ),
Z1_KEYWORD_CALLBACK( "WeightVector", parse_weight_vector ),
Z1_KEYWORD_CALLBACK( "shareddict", parse_shared_dict ),
-#endif
+#endif
Z1_KEYWORD_CALLBACK( 0, 0 )
};
@@ -1438,27 +1438,27 @@
strncmp( (char*)cur, "FontDirectory", 13 ) == 0 )
{
FT_Byte* cur2;
-
+
/* skip the `FontDirectory' keyword */
cur += 13;
cur2 = cur;
-
+
/* lookup the `known' keyword */
while ( cur < limit && *cur != 'k' &&
strncmp( (char*)cur, "known", 5 ) )
cur++;
-
+
if ( cur < limit )
{
Z1_Token_Rec token;
-
+
/* skip the `known' keyword and the token following it */
cur += 5;
loader->parser.cursor = cur;
Z1_ToToken( &loader->parser, &token );
-
+
/* if the last token was an array, skip it! */
if ( token.type == t1_token_array )
cur2 = parser->cursor;
@@ -1489,17 +1489,17 @@
{
/* now, compare the immediate name to the keyword table */
Z1_KeyWord* keyword = (Z1_KeyWord*)t1_keywords;
-
+
for (;;)
{
FT_Byte* name;
-
+
name = (FT_Byte*)keyword->name;
if ( !name )
break;
-
+
if ( cur[0] == name[0] &&
len == (FT_Int)strlen( (const char*)name ) )
{
@@ -1509,7 +1509,7 @@
for ( n = 1; n < len; n++ )
if ( cur[n] != name[n] )
break;
-
+
if ( n >= len )
{
/* we found it -- run the parsing callback! */
@@ -1518,7 +1518,7 @@
parser->error = t1_load_keyword( face, loader, keyword );
if ( parser->error )
return parser->error;
-
+
cur = parser->cursor;
break;
}
--- a/src/type1z/z1parse.c
+++ b/src/type1z/z1parse.c
@@ -425,15 +425,15 @@
while ( parser->cursor < parser->limit )
{
Z1_Token_Rec token;
-
+
Z1_ToToken( parser, &token );
if ( !token.type )
break;
-
+
if ( cur < limit )
*cur = token;
-
+
cur++;
}
@@ -867,17 +867,17 @@
{
FT_Memory memory = parser->memory;
FT_UInt len = limit-cur;
-
+
if ( ALLOC( string, len + 1 ) )
goto Exit;
-
+
MEM_Copy( string, cur, len );
- string[len] = 0;
+ string[len] = 0;
*(FT_String**)q = string;
}
break;
-
+
default:
/* an error occured */
goto Fail;
@@ -915,8 +915,8 @@
FT_Byte* old_cursor;
FT_Byte* old_limit;
Z1_Field_Rec fieldrec = *(Z1_Field_Rec*)field;
-
+
Z1_ToTokenArray( parser, elements, 32, &num_elements );
if ( num_elements < 0 )
goto Fail;
@@ -942,7 +942,7 @@
if ( pflags )
*pflags |= 1L << field->flag_bit;
-
+
parser->cursor = old_cursor;
parser->limit = old_limit;
--- a/src/type1z/z1parse.h
+++ b/src/type1z/z1parse.h
@@ -33,10 +33,10 @@
t1_token_any,
t1_token_string,
t1_token_array,
-
+
/* do not remove */
t1_token_max
-
+
} Z1_Token_Type;
@@ -46,10 +46,10 @@
FT_Byte* start; /* first character of token in input stream */
FT_Byte* limit; /* first character after the token */
Z1_Token_Type type; /* type of token.. */
-
- } Z1_Token_Rec;
+ } Z1_Token_Rec;
+
/* enumeration type used to identify object fields */
typedef enum Z1_Field_Type_
{
@@ -60,10 +60,10 @@
t1_field_string,
t1_field_integer_array,
t1_field_fixed_array,
-
+
/* do not remove */
t1_field_max
-
+
} Z1_Field_Type;
@@ -76,7 +76,7 @@
FT_UInt array_max; /* maximum number of elements for array */
FT_UInt count_offset; /* offset of element count for arrays */
FT_Int flag_bit; /* bit number for field flag */
-
+
} Z1_Field_Rec;
--- a/src/winfonts/winfnt.c
+++ b/src/winfonts/winfnt.c
@@ -114,10 +114,10 @@
{
if ( font->fnt_frame )
RELEASE_Frame( font->fnt_frame );
-
+
font->fnt_size = 0;
font->fnt_frame = 0;
- }
+ }
static
@@ -126,8 +126,8 @@
{
FT_Error error;
WinFNT_Header* header = &font->header;
-
+
/* first of all, read the FNT header */
if ( FILE_Seek( font->offset ) ||
READ_Fields( winfnt_header_fields, header ) )
@@ -160,7 +160,7 @@
Exit:
return error;
- }
+ }
static
@@ -170,11 +170,11 @@
FT_Stream stream = FT_FACE(face)->stream;
FNT_Font* cur = face->fonts;
FNT_Font* limit = cur + face->num_fonts;
-
+
for ( ; cur < limit; cur++ )
fnt_done_font( stream, cur );
-
+
FREE( face->fonts );
face->num_fonts = 0;
}
@@ -201,12 +201,12 @@
{
/* yes, now look for a NE header in the file */
WinNE_Header ne_header;
-
+
if ( FILE_Seek( mz_header.lfanew ) ||
READ_Fields( winne_header_fields, &ne_header ) )
goto Exit;
-
+
error = FT_Err_Unknown_File_Format;
if ( ne_header.magic == WINFNT_NE_MAGIC )
{
@@ -213,30 +213,30 @@
/* good, now look in the resource table for each FNT resource */
FT_ULong res_offset = mz_header.lfanew +
ne_header.resource_tab_offset;
-
+
FT_UShort size_shift;
FT_UShort font_count = 0;
FT_ULong font_offset = 0;
-
+
if ( FILE_Seek( res_offset ) ||
ACCESS_Frame( ne_header.rname_tab_offset -
ne_header.resource_tab_offset ) )
goto Exit;
-
+
size_shift = GET_UShortLE();
-
+
for (;;)
{
FT_UShort type_id, count;
-
+
type_id = GET_UShortLE();
if ( !type_id )
break;
-
+
count = GET_UShortLE();
-
+
if ( type_id == 0x8008 )
{
font_count = count;
@@ -243,7 +243,7 @@
font_offset = FILE_Pos() + 4 + ( stream->cursor - stream->limit );
break;
}
-
+
stream->cursor += 4 + count * 12;
}
FORGET_Frame();
@@ -253,23 +253,23 @@
FT_TRACE2(( "this file doesn't contain any FNT resources!\n" ));
error = FT_Err_Unknown_File_Format;
goto Exit;
- }
+ }
if ( FILE_Seek( font_offset ) ||
- ALLOC_ARRAY( face->fonts, font_count, FNT_Font ) )
+ ALLOC_ARRAY( face->fonts, font_count, FNT_Font ) )
goto Exit;
-
+
face->num_fonts = font_count;
-
+
if ( ACCESS_Frame( (FT_Long)font_count * 12 ) )
goto Exit;
-
+
/* now read the offset and position of each FNT font */
{
FNT_Font* cur = face->fonts;
FNT_Font* limit = cur + font_count;
-
+
for ( ; cur < limit; cur++ )
{
cur->offset = (FT_ULong)GET_UShortLE() << size_shift;
@@ -279,13 +279,13 @@
}
}
FORGET_Frame();
-
+
/* finally, try to load each font there */
{
FNT_Font* cur = face->fonts;
FNT_Font* limit = cur + font_count;
-
+
for ( ; cur < limit; cur++ )
{
error = fnt_load_font( stream, cur );
@@ -309,15 +309,15 @@
void FNT_Done_Face( FNT_Face face )
{
FT_Memory memory = FT_FACE_MEMORY( face );
-
+
fnt_done_fonts( face );
-
+
FREE( face->root.available_sizes );
face->root.num_fixed_sizes = 0;
}
-
+
static
FT_Error FNT_Init_Face( FT_Stream stream,
FNT_Face face,
@@ -327,12 +327,12 @@
{
FT_Error error;
FT_Memory memory = FT_FACE_MEMORY( face );
-
+
FT_UNUSED( num_params );
FT_UNUSED( params );
FT_UNUSED( face_index );
-
+
/* try to load several fonts from a DLL */
error = fnt_get_dll_fonts( face );
if ( error )
@@ -340,16 +340,16 @@
/* this didn't work, now try to load a single FNT font */
FT_Memory memory = FT_FACE_MEMORY( face );
FNT_Font* font;
-
+
if ( ALLOC( face->fonts, sizeof ( *face->fonts ) ) )
goto Exit;
-
+
face->num_fonts = 1;
font = face->fonts;
-
+
font->offset = 0;
font->fnt_size = stream->size;
-
+
error = fnt_load_font( stream, font );
if ( error )
goto Fail;
@@ -356,7 +356,7 @@
}
/* all right, one or more fonts were loaded; we now need to */
- /* fill the root FT_Face fields with relevant information */
+ /* fill the root FT_Face fields with relevant information */
{
FT_Face root = FT_FACE( face );
FNT_Font* fonts = face->fonts;
@@ -370,10 +370,10 @@
if ( fonts->header.avg_width == fonts->header.max_width )
root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
-
+
if ( fonts->header.italic )
root->style_flags |= FT_STYLE_FLAG_ITALIC;
-
+
if ( fonts->header.weight >= 800 )
root->style_flags |= FT_STYLE_FLAG_BOLD;
@@ -382,12 +382,12 @@
FT_Bitmap_Size ) )
goto Fail;
- root->num_fixed_sizes = face->num_fonts;
-
+ root->num_fixed_sizes = face->num_fonts;
+
{
FT_Bitmap_Size* size = root->available_sizes;
-
+
for ( cur = fonts; cur < limit; cur++, size++ )
{
size->width = cur->header.pixel_width;
@@ -394,7 +394,7 @@
size->height = cur->header.pixel_height;
}
}
-
+
/* Setup the `charmaps' array */
root->charmaps = &face->charmap_handle;
root->num_charmaps = 1;
@@ -403,15 +403,15 @@
face->charmap.platform_id = 3;
face->charmap.encoding_id = 1;
face->charmap.face = root;
-
+
face->charmap_handle = &face->charmap;
-
+
root->charmap = face->charmap_handle;
- /* setup remaining flags */
+ /* setup remaining flags */
root->num_glyphs = fonts->header.last_char -
fonts->header.first_char + 1;
-
+
root->family_name = (FT_String*)fonts->fnt_frame +
fonts->header.face_name_offset;
root->style_name = "Regular";
@@ -426,14 +426,14 @@
else if ( root->style_flags & FT_STYLE_FLAG_ITALIC )
root->style_name = "Italic";
}
-
+
Fail:
if ( error )
FNT_Done_Face( face );
-
+
Exit:
return error;
- }
+ }
static
@@ -454,10 +454,10 @@
{
size->font = cur;
break;
- }
+ }
}
- return ( size->font ? FT_Err_Ok : FT_Err_Invalid_Argument );
+ return ( size->font ? FT_Err_Ok : FT_Err_Invalid_Argument );
}
@@ -466,15 +466,15 @@
FT_ULong char_code )
{
FT_UInt result = char_code;
-
+
if ( charmap )
{
FNT_Font* font = ((FNT_Face)charmap->face)->fonts;
FT_UInt first = font->header.first_char;
FT_UInt count = font->header.last_char - first + 1;
-
+
char_code -= first;
if ( char_code < count )
result = char_code;
@@ -499,11 +499,11 @@
FT_Bitmap* bitmap = &slot->bitmap;
FT_ULong offset;
FT_Bool new_format;
-
+
FT_UNUSED( slot );
FT_UNUSED( load_flags );
-
+
if ( !font )
{
error = FT_Err_Invalid_Argument;
@@ -513,19 +513,19 @@
new_format = font->header.version == 0x300;
len = new_format ? 6 : 4;
- /* jump to glyph entry */
+ /* jump to glyph entry */
p = font->fnt_frame + 118 + len * glyph_index;
-
+
bitmap->width = NEXT_ShortLE(p);
-
+
if ( new_format )
offset = NEXT_ULongLE(p);
else
offset = NEXT_UShortLE(p);
-
+
/* jump to glyph data */
p = font->fnt_frame + /* font->header.bits_offset */ + offset;
-
+
/* allocate and build bitmap */
{
FT_Memory memory = FT_FACE_MEMORY( slot->face );
@@ -532,32 +532,32 @@
FT_Int pitch = ( bitmap->width + 7 ) >> 3;
FT_Byte* column;
FT_Byte* write;
-
+
bitmap->pitch = pitch;
bitmap->rows = font->header.pixel_height;
bitmap->pixel_mode = ft_pixel_mode_mono;
-
+
if ( ALLOC( bitmap->buffer, pitch * bitmap->rows ) )
goto Exit;
-
+
column = (FT_Byte*)bitmap->buffer;
for ( ; pitch > 0; pitch--, column++ )
{
FT_Byte* limit = p + bitmap->rows;
-
+
for ( write = column; p < limit; p++, write += bitmap->pitch )
write[0] = p[0];
}
}
-
+
slot->flags = ft_glyph_own_bitmap;
slot->bitmap_left = 0;
slot->bitmap_top = font->header.ascent;
slot->format = ft_glyph_format_bitmap;
-
+
/* now set up metrics */
slot->metrics.horiAdvance = bitmap->width << 6;
slot->metrics.horiBearingX = 0;
@@ -564,10 +564,10 @@
slot->metrics.horiBearingY = slot->bitmap_top << 6;
slot->linearHoriAdvance = (FT_Fixed)bitmap->width << 16;
-
+
Exit:
return error;
- }
+ }
const FT_Driver_Class winfnt_driver_class =
@@ -575,22 +575,22 @@
{
ft_module_font_driver,
sizeof ( FT_DriverRec ),
-
+
"winfonts",
0x10000L,
0x20000L,
-
+
0,
-
+
(FT_Module_Constructor)0,
(FT_Module_Destructor) 0,
(FT_Module_Requester) 0
},
-
+
sizeof( FNT_FaceRec ),
sizeof( FNT_SizeRec ),
sizeof( FT_GlyphSlotRec ),
-
+
(FTDriver_initFace) FNT_Init_Face,
(FTDriver_doneFace) FNT_Done_Face,
(FTDriver_initSize) 0,
--- a/src/winfonts/winfnt.h
+++ b/src/winfonts/winfnt.h
@@ -27,7 +27,7 @@
FT_UShort magic;
/* skipped content */
FT_UShort lfanew;
-
+
} WinMZ_Header;
@@ -37,7 +37,7 @@
/* skipped content */
FT_UShort resource_tab_offset;
FT_UShort rname_tab_offset;
-
+
} WinNE_Header;
@@ -49,7 +49,7 @@
FT_UShort id;
FT_UShort handle;
FT_UShort usage;
-
+
} WinNameInfo;
@@ -57,7 +57,7 @@
{
FT_UShort type_id;
FT_UShort count;
-
+
} WinResourceInfo;
@@ -103,7 +103,7 @@
FT_UShort C_space;
FT_UShort color_table_offset;
FT_Byte reserved2[4];
-
+
} WinFNT_Header;
@@ -111,12 +111,12 @@
{
FT_ULong offset;
FT_Int size_shift;
-
+
WinFNT_Header header;
-
+
FT_Byte* fnt_frame;
FT_ULong fnt_size;
-
+
} FNT_Font;
@@ -124,7 +124,7 @@
{
FT_SizeRec root;
FNT_Font* font;
-
+
} FNT_SizeRec, *FNT_Size;
@@ -131,11 +131,11 @@
typedef struct FNT_FaceRec_
{
FT_FaceRec root;
-
+
FT_UInt num_fonts;
FNT_Font* fonts;
- FT_CharMap charmap_handle;
+ FT_CharMap charmap_handle;
FT_CharMapRec charmap; /* a single charmap per face */
} FNT_FaceRec, *FNT_Face;