diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 8d7702163..48bc71103 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -319,7 +319,7 @@ /* */ /* */ /* An enumeration used to specify encodings supported by charmaps. */ - /* Used in the FT_Select_CharMap() API function. */ + /* Used in the FT_Select_Charmap() API function. */ /* */ /* */ /* Because of 32-bit charcodes defined in Unicode (i.e., surrogates), */ @@ -1590,6 +1590,22 @@ /* */ /* FreeType error code. 0 means success. */ /* */ + /* */ + /* */ + /* The values of `pixel_width' and `pixel_height' correspond to the */ + /* pixel values of the _typographic_ character size, which are NOT */ + /* necessarily the same as the dimensions of the glyph `bitmap */ + /* cells'. */ + /* */ + /* The `character size' is really the size of an abstract square */ + /* called the `EM', used to design the font. However, depending */ + /* on the font design, glyphs will be smaller or greater than the */ + /* EM. */ + /* */ + /* This means that setting the pixel size to, say, 8x8 doesn't */ + /* guarantee in any way that you will get glyph bitmaps that all fit */ + /* within an 8x8 cell (sometimes even far from it). */ + /* */ FT_EXPORT( FT_Error ) FT_Set_Pixel_Sizes( FT_Face face, FT_UInt pixel_width, FT_UInt pixel_height ); @@ -1624,7 +1640,7 @@ /* 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'. */ @@ -2123,10 +2139,10 @@ /* decoding. */ /* */ /* */ - /* face :: A handle to the source face object. */ + /* face :: A handle to the source face object. */ /* */ /* */ - /* charmap :: A handle to the selected charmap. */ + /* charmap :: A handle to the selected charmap. */ /* */ /* */ /* FreeType error code. 0 means success. */ @@ -2263,9 +2279,6 @@ /* */ /* matrix :: A pointer to the source 2x2 matrix. */ /* */ - /* */ - /* Yes. */ - /* */ /* */ /* The result is undefined if either `vector' or `matrix' is invalid. */ /* */ diff --git a/include/freetype/ftglyph.h b/include/freetype/ftglyph.h index d1dfbfdc6..9126d4d12 100644 --- a/include/freetype/ftglyph.h +++ b/include/freetype/ftglyph.h @@ -402,9 +402,6 @@ /* */ /* b :: A pointer to matrix `b'. */ /* */ - /* */ - /* Yes. */ - /* */ /* */ /* The result is undefined if either `a' or `b' is zero. */ /* */ @@ -427,9 +424,6 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - /* */ - /* Yes. */ - /* */ FT_EXPORT( FT_Error ) FT_Matrix_Invert( FT_Matrix* matrix ); diff --git a/include/freetype/ftmac.h b/include/freetype/ftmac.h index 42f1c0346..4b999e194 100644 --- a/include/freetype/ftmac.h +++ b/include/freetype/ftmac.h @@ -48,8 +48,8 @@ /* */ /* fond :: An FOND resource. */ /* */ - /* face_index :: only supported for the -1 `sanity check' */ - /* special case. */ + /* face_index :: Only supported for the -1 `sanity check' special */ + /* case. */ /* */ /* */ /* aface :: A handle to a new face object. */ @@ -60,6 +60,7 @@ /* */ /* This function can be used to create FT_Face abjects from fonts */ /* that are installed in the system like so: */ + /* */ /* fond = GetResource( 'FOND', fontName ); */ /* error = FT_New_Face_From_FOND( library, fond, 0, &face ); */ /* */ diff --git a/include/freetype/ftmodule.h b/include/freetype/ftmodule.h index 055278311..bfe37b058 100644 --- a/include/freetype/ftmodule.h +++ b/include/freetype/ftmodule.h @@ -236,7 +236,7 @@ /* */ /* hook_index :: The index of the debug hook. You should use the */ /* values defined in ftobjs.h, e.g. */ - /* FT_DEBUG_HOOK_TRUETYPE */ + /* FT_DEBUG_HOOK_TRUETYPE. */ /* */ /* debug_hook :: The function used to debug the interpreter. */ /* */ diff --git a/include/freetype/ftnames.h b/include/freetype/ftnames.h index 87517e181..f56684d4e 100644 --- a/include/freetype/ftnames.h +++ b/include/freetype/ftnames.h @@ -81,7 +81,7 @@ /* Retrieves the number of name strings in the SFNT `name' table. */ /* */ /* */ - /* face :: A handle to the source face. */ + /* face :: A handle to the source face. */ /* */ /* */ /* The number of strings in the `name' table. */ diff --git a/include/freetype/ftoutln.h b/include/freetype/ftoutln.h index 8010e1b71..3827980d0 100644 --- a/include/freetype/ftoutln.h +++ b/include/freetype/ftoutln.h @@ -84,9 +84,6 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - /* */ - /* No. */ - /* */ /* */ /* The reason why this function takes a `library' parameter is simply */ /* to use the library's memory allocator. */ @@ -121,9 +118,6 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - /* */ - /* No. */ - /* */ /* */ /* If the outline's `owner' field is not set, only the outline */ /* descriptor will be released. */ @@ -162,9 +156,6 @@ /* */ /* acbox :: The outline's control box. */ /* */ - /* */ - /* Yes. */ - /* */ FT_EXPORT( void ) FT_Outline_Get_CBox( FT_Outline* outline, FT_BBox *acbox ); @@ -185,9 +176,6 @@ /* */ /* yOffset :: The vertical offset. */ /* */ - /* */ - /* Yes. */ - /* */ FT_EXPORT( void ) FT_Outline_Translate( FT_Outline* outline, FT_Pos xOffset, FT_Pos yOffset ); @@ -219,22 +207,21 @@ /*************************************************************************/ /* */ /* */ - /* FT_Vector_Transform */ + /* FT_Outline_Transform */ /* */ /* */ - /* Transforms a single vector through a 2x2 matrix. */ + /* Applies a simple 2x2 matrix to all of an outline's points. Useful */ + /* for applying rotations, slanting, flipping, etc. */ /* */ /* */ - /* vector :: The target vector to transform. */ + /* outline :: A pointer to the target outline descriptor. */ /* */ /* */ - /* matrix :: A pointer to the source 2x2 matrix. */ - /* */ - /* */ - /* Yes. */ + /* matrix :: A pointer to the transformation matrix. */ /* */ /* */ - /* The result is undefined if either `vector' or `matrix' is invalid. */ + /* You can use FT_Outline_Translate() if you need to translate the */ + /* outline's points. */ /* */ FT_EXPORT( void ) FT_Outline_Transform( FT_Outline* outline, FT_Matrix* matrix ); @@ -282,10 +269,6 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - /* */ - /* YES. Rendering is synchronized, so that concurrent calls to the */ - /* scan-line converter will be serialized. */ - /* */ /* */ /* This function does NOT CREATE the bitmap, it only renders an */ /* outline image within the one you pass to it! */ @@ -320,10 +303,6 @@ /* */ /* FreeType error code. 0 means success. */ /* */ - /* */ - /* YES. Rendering is synchronized, so that concurrent calls to the */ - /* scan-line converter will be serialized. */ - /* */ /* */ /* You should know what you are doing and how FT_Raster_Params works */ /* to use this function. */ diff --git a/include/freetype/internal/ftcalc.h b/include/freetype/internal/ftcalc.h index 2b1745a36..dfc6b52d9 100644 --- a/include/freetype/internal/ftcalc.h +++ b/include/freetype/internal/ftcalc.h @@ -40,6 +40,22 @@ #define SQRT_64( z ) FT_Sqrt64( z ) + /*************************************************************************/ + /* */ + /* */ + /* FT_Sqrt64 */ + /* */ + /* */ + /* Computes the square root of a 64-bit value. That sounds stupid, */ + /* but it is needed to obtain maximal accuracy in the TrueType */ + /* bytecode interpreter. */ + /* */ + /* */ + /* l :: A 64-bit integer. */ + /* */ + /* */ + /* The 32-bit square-root. */ + /* */ FT_EXPORT( FT_Int32 ) FT_Sqrt64( FT_Int64 l ); #endif /* FT_CONFIG_OPTION_OLD_CALCS */ @@ -60,14 +76,72 @@ #define MUL_64( x, y, z ) FT_MulTo64( x, y, &z ) #define DIV_64( x, y ) FT_Div64by32( &x, y ) + + /*************************************************************************/ + /* */ + /* */ + /* FT_Add64 */ + /* */ + /* */ + /* Add two Int64 values. */ + /* */ + /* */ + /* x :: A pointer to the first value to be added. */ + /* y :: A pointer to the second value to be added. */ + /* */ + /* */ + /* z :: A pointer to the result of `x + y'. */ + /* */ + /* */ + /* Will be wrapped by the ADD_64() macro. */ + /* */ FT_EXPORT( void ) FT_Add64( FT_Int64* x, FT_Int64* y, FT_Int64 *z ); + + /*************************************************************************/ + /* */ + /* */ + /* FT_MulTo64 */ + /* */ + /* */ + /* Multiplies two Int32 integers. Returns an Int64 integer. */ + /* */ + /* */ + /* x :: The first multiplier. */ + /* y :: The second multiplier. */ + /* */ + /* */ + /* z :: A pointer to the result of `x * y'. */ + /* */ + /* */ + /* Will be wrapped by the MUL_64() macro. */ + /* */ FT_EXPORT( void ) FT_MulTo64( FT_Int32 x, FT_Int32 y, FT_Int64 *z ); + + /*************************************************************************/ + /* */ + /* */ + /* FT_Div64by32 */ + /* */ + /* */ + /* Divides an Int64 value by an Int32 value. Returns an Int32 */ + /* integer. */ + /* */ + /* */ + /* x :: A pointer to the dividend. */ + /* y :: The divisor. */ + /* */ + /* */ + /* The result of `x / y'. */ + /* */ + /* */ + /* Will be wrapped by the DIV_64() macro. */ + /* */ FT_EXPORT( FT_Int32 ) FT_Div64by32( FT_Int64* x, FT_Int32 y ); @@ -78,6 +152,22 @@ #define SQRT_64( z ) FT_Sqrt64( &z ) + /*************************************************************************/ + /* */ + /* */ + /* FT_Sqrt64 */ + /* */ + /* */ + /* Computes the square root of a 64-bits value. That sounds stupid, */ + /* but it is needed to obtain maximal accuracy in the TrueType */ + /* bytecode interpreter. */ + /* */ + /* */ + /* z :: A pointer to a 64-bit integer. */ + /* */ + /* */ + /* The 32-bit square-root. */ + /* */ FT_EXPORT( FT_Int32 ) FT_Sqrt64( FT_Int64* x ); #endif /* FT_CONFIG_OPTION_OLD_CALCS */ @@ -90,7 +180,22 @@ #define SQRT_32( x ) FT_Sqrt32( x ) - FT_BASE( FT_Int32 ) FT_Sqrt32( FT_Int32 x ); + /*************************************************************************/ + /* */ + /* */ + /* FT_Sqrt32 */ + /* */ + /* */ + /* Computes the square root of an Int32 integer (which will be */ + /* handled as an unsigned long value). */ + /* */ + /* */ + /* x :: The value to compute the root for. */ + /* */ + /* */ + /* The result of `sqrt(x)'. */ + /* */ + FT_EXPORT( FT_Int32 ) FT_Sqrt32( FT_Int32 x ); #endif /* !FT_CONFIG_OPTION_OLD_CALCS */ diff --git a/include/freetype/internal/ftdebug.h b/include/freetype/internal/ftdebug.h index b47101df3..935998497 100644 --- a/include/freetype/internal/ftdebug.h +++ b/include/freetype/internal/ftdebug.h @@ -138,6 +138,21 @@ } while ( 0 ) + /*************************************************************************/ + /* */ + /* */ + /* FT_SetTraceLevel */ + /* */ + /* */ + /* Sets the trace level for debugging. */ + /* */ + /* */ + /* component :: The component which should be traced. See above for */ + /* a complete list. If set to `trace_any', all */ + /* components will be traced. */ + /* */ + /* level :: The tracing level. */ + /* */ FT_EXPORT( void ) FT_SetTraceLevel( FT_Trace component, char level ); diff --git a/include/freetype/internal/ftextend.h b/include/freetype/internal/ftextend.h index 94ca4dea4..0a7b97247 100644 --- a/include/freetype/internal/ftextend.h +++ b/include/freetype/internal/ftextend.h @@ -130,6 +130,22 @@ } FT_Extension_Class; + /*************************************************************************/ + /* */ + /* */ + /* FT_Register_Extension */ + /* */ + /* */ + /* Registers a new extension. */ + /* */ + /* */ + /* driver :: A handle to the driver object. */ + /* */ + /* class :: A pointer to a class describing the extension. */ + /* */ + /* */ + /* FreeType error code. 0 means success. */ + /* */ FT_EXPORT( FT_Error ) FT_Register_Extension( FT_Driver driver, FT_Extension_Class* clazz ); @@ -159,7 +175,26 @@ #endif - /* return an extension's data & interface according to its ID */ + /*************************************************************************/ + /* */ + /* */ + /* FT_Get_Extension */ + /* */ + /* */ + /* Queries an extension block by an extension ID string. */ + /* */ + /* */ + /* face :: A handle to the face object. */ + /* extension_id :: An ID string identifying the extension. */ + /* */ + /* */ + /* extension_interface :: A generic pointer, usually pointing to a */ + /* table of functions implementing the */ + /* extension interface. */ + /* */ + /* */ + /* A generic pointer to the extension block. */ + /* */ FT_EXPORT( void* ) FT_Get_Extension( FT_Face face, const char* extension_id, void** extension_interface ); diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h index 31ece537b..6197823d5 100644 --- a/include/freetype/internal/ftobjs.h +++ b/include/freetype/internal/ftobjs.h @@ -299,11 +299,43 @@ /* this must be kept exported -- it is used by the cache manager */ /* even though it shouldn't be considered public for now */ + + /*************************************************************************/ + /* */ + /* */ + /* FT_New_Size */ + /* */ + /* */ + /* Creates a new size object from a given face object. */ + /* */ + /* */ + /* face :: A handle to a parent face object. */ + /* */ + /* */ + /* asize :: A handle to a new size object. */ + /* */ + /* */ + /* FreeType error code. 0 means success. */ + /* */ FT_EXPORT( FT_Error ) FT_New_Size( FT_Face face, FT_Size* size ); - FT_EXPORT( FT_Error ) FT_Done_Size( FT_Size size ); + /*************************************************************************/ + /* */ + /* */ + /* FT_Done_Size */ + /* */ + /* */ + /* Discards a given size object. */ + /* */ + /* */ + /* size :: A handle to a target size object. */ + /* */ + /* */ + /* FreeType error code. 0 means success. */ + /* */ + FT_EXPORT( FT_Error ) FT_Done_Size( FT_Size size ); FT_BASE( FT_Error ) FT_New_GlyphSlot( FT_Face face, @@ -429,7 +461,7 @@ FT_ModuleRec root; FT_Renderer_Class* clazz; FT_Glyph_Format glyph_format; - const FT_Glyph_Class glyph_class; + FT_Glyph_Class glyph_class; FT_Raster raster; FT_Raster_Render_Func raster_render; @@ -597,13 +629,66 @@ #ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM + /*************************************************************************/ + /* */ + /* */ + /* FT_New_Stream */ + /* */ + /* */ + /* Creates a new stream object. */ + /* */ + /* */ + /* filepathname :: The name of the stream (usually a file) to be */ + /* opened. */ + /* */ + /* stream :: A pointer to the stream object. */ + /* */ + /* */ + /* FreeType error code. 0 means success. */ + /* */ FT_EXPORT( FT_Error ) FT_New_Stream( const char* filepathname, FT_Stream astream ); + + /*************************************************************************/ + /* */ + /* */ + /* FT_Done_Stream */ + /* */ + /* */ + /* Closes and destroys a stream object. */ + /* */ + /* */ + /* stream :: The stream to be closed and destroyed. */ + /* */ FT_EXPORT( void ) FT_Done_Stream( FT_Stream stream ); + + /*************************************************************************/ + /* */ + /* */ + /* FT_New_Memory */ + /* */ + /* */ + /* Creates a new memory object. */ + /* */ + /* */ + /* A pointer to the new memory object. 0 in case of error. */ + /* */ FT_EXPORT( FT_Memory ) FT_New_Memory( void ); + + /*************************************************************************/ + /* */ + /* */ + /* FT_Done_Memory */ + /* */ + /* */ + /* Discards memory manager. */ + /* */ + /* */ + /* memory :: A handle to the memory manager. */ + /* */ FT_EXPORT( void ) FT_Done_Memory( FT_Memory memory ); #endif /* !FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM */ diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h index 9d6bd3d48..5657fa3b8 100644 --- a/include/freetype/internal/tttypes.h +++ b/include/freetype/internal/tttypes.h @@ -22,6 +22,7 @@ #include +#include #ifdef __cplusplus diff --git a/src/base/ftbbox.c b/src/base/ftbbox.c index fb08ab4e0..d17234baa 100644 --- a/src/base/ftbbox.c +++ b/src/base/ftbbox.c @@ -335,27 +335,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Outline_Get_BBox */ - /* */ - /* */ - /* Computes the exact bounding box of an outline. This is slower */ - /* than computing the control box. However, it uses an advanced */ - /* algorithm which returns _very_ quickly when the two boxes */ - /* coincide. Otherwise, the outline Bezier arcs are walked over to */ - /* extract their extrema. */ - /* */ - /* */ - /* outline :: A pointer to the source outline. */ - /* */ - /* */ - /* abbox :: A pointer to the outline's exact bounding box. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /* documentation is in ftbbox.h */ + FT_EXPORT_DEF( FT_Error ) FT_Outline_Get_BBox( FT_Outline* outline, FT_BBox *abbox ) { diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c index 1d5e2a2cd..71da9717c 100644 --- a/src/base/ftcalc.c +++ b/src/base/ftcalc.c @@ -67,21 +67,8 @@ #else - /*************************************************************************/ - /* */ - /* */ - /* FT_Sqrt32 */ - /* */ - /* */ - /* Computes the square root of an Int32 integer (which will be */ - /* handled as an unsigned long value). */ - /* */ - /* */ - /* x :: The value to compute the root for. */ - /* */ - /* */ - /* The result of `sqrt(x)'. */ - /* */ + /* documentation is in ftcalc.h */ + FT_EXPORT_DEF( FT_Int32 ) FT_Sqrt32( FT_Int32 x ) { FT_ULong val, root, newroot, mask; @@ -113,29 +100,8 @@ #ifdef FT_LONG64 - /*************************************************************************/ - /* */ - /* */ - /* FT_MulDiv */ - /* */ - /* */ - /* A very simple function used to perform the computation `(a*b)/c' */ - /* with maximal accuracy (it uses a 64-bit intermediate integer */ - /* whenever necessary). */ - /* */ - /* This function isn't necessarily as fast as some processor specific */ - /* operations, but is at least completely portable. */ - /* */ - /* */ - /* a :: The first multiplier. */ - /* b :: The second multiplier. */ - /* c :: The divisor. */ - /* */ - /* */ - /* The result of `(a*b)/c'. This function never traps when trying to */ - /* divide by zero; it simply returns `MaxInt' or `MinInt' depending */ - /* on the signs of `a' and `b'. */ - /* */ + /* documentation is in freetype.h */ + FT_EXPORT_DEF( FT_Long ) FT_MulDiv( FT_Long a, FT_Long b, FT_Long c ) @@ -153,35 +119,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_MulFix */ - /* */ - /* */ - /* A very simple function used to perform the computation */ - /* `(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. */ - /* */ - /* */ - /* a :: The first multiplier. */ - /* b :: The second multiplier. Use a 16.16 factor here whenever */ - /* possible (see note below). */ - /* */ - /* */ - /* The result of `(a*b)/0x10000'. */ - /* */ - /* */ - /* This function has been optimized for the case where the absolute */ - /* 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.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. */ - /* */ + /* documentation is in freetype.h */ + FT_EXPORT_DEF( FT_Long ) FT_MulFix( FT_Long a, FT_Long b ) { @@ -196,29 +135,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_DivFix */ - /* */ - /* */ - /* 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 :: The first multiplier. */ - /* b :: The second multiplier. Use a 16.16 factor here whenever */ - /* possible (see note below). */ - /* */ - /* */ - /* The result of `(a*0x10000)/b'. */ - /* */ - /* */ - /* 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(). */ - /* */ + /* documentation is in freetype.h */ + FT_EXPORT_DEF( FT_Long ) FT_DivFix( FT_Long a, FT_Long b ) { @@ -259,22 +177,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Sqrt64 */ - /* */ - /* */ - /* Computes the square root of a 64-bit value. That sounds stupid, */ - /* but it is needed to obtain maximal accuracy in the TrueType */ - /* bytecode interpreter. */ - /* */ - /* */ - /* l :: A 64-bit integer. */ - /* */ - /* */ - /* The 32-bit square-root. */ - /* */ + /* documentation is in ftcalc.h */ + FT_EXPORT_DEF( FT_Int32 ) FT_Sqrt64( FT_Int64 l ) { FT_Int64 r, s; @@ -301,6 +205,7 @@ FT_Int64 z; + z = (FT_Int64)(x) << 16; return FT_Sqrt64( z ); } @@ -311,46 +216,8 @@ #else /* FT_LONG64 */ - /*************************************************************************/ - /* */ - /* */ - /* FT_MulDiv */ - /* */ - /* */ - /* A very simple function used to perform the computation `(a*b)/c' */ - /* with maximal accuracy (it uses a 64-bit intermediate integer */ - /* whenever necessary). */ - /* */ - /* This function isn't necessarily as fast as some processor specific */ - /* operations, but is at least completely portable. */ - /* */ - /* */ - /* a :: The first multiplier. */ - /* b :: The second multiplier. */ - /* c :: The divisor. */ - /* */ - /* */ - /* The result of `(a*b)/c'. This function never traps when trying to */ - /* divide by zero; it simply returns `MaxInt' or `MinInt' depending */ - /* on the signs of `a' and `b'. */ - /* */ - /* */ - /* The FT_MulDiv() function has been optimized thanks to ideas from */ - /* Graham Asher. The trick is to optimize computation if everything */ - /* fits within 32 bits (a rather common case). */ - /* */ - /* We compute `a*b+c/2', then divide it by `c' (positive values). */ - /* */ - /* 46340 is FLOOR(SQRT(2^31-1)). */ - /* */ - /* if ( a <= 46340 && b <= 46340 ) then ( a*b <= 0x7FFEA810 ) */ - /* */ - /* 0x7FFFFFFF - 0x7FFEA810 = 0x157F0 */ - /* */ - /* if ( c < 0x157F0*2 ) then ( a*b+c/2 <= 0x7FFFFFFF ) */ - /* */ - /* and 2*0x157F0 = 176096. */ - /* */ + /* documentation is in freetype.h */ + FT_EXPORT_DEF( FT_Long ) FT_MulDiv( FT_Long a, FT_Long b, FT_Long c ) @@ -387,37 +254,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_MulFix */ - /* */ - /* */ - /* A very simple function used to perform the computation */ - /* `(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. */ - /* */ - /* */ - /* a :: The first multiplier. */ - /* b :: The second multiplier. Use a 16.16 factor here whenever */ - /* possible (see note below). */ - /* */ - /* */ - /* The result of `(a*b)/0x10000'. */ - /* */ - /* */ - /* The optimization for FT_MulFix() is different. We could simply be */ - /* happy by applying the same principles as with FT_MulDiv(), because */ - /* */ - /* c = 0x10000 < 176096 */ - /* */ - /* However, in most cases, we have a `b' with a value around 0x10000 */ - /* which is greater than 46340. */ - /* */ - /* According to some testing, most cases have `a' < 2048, so a good */ - /* idea is to use bounds like 2048 and 1048576 (=floor((2^31-1)/2048) */ - /* for `a' and `b', respectively. */ - /* */ + /* documentation is in freetype.h */ + FT_EXPORT_DEF( FT_Long ) FT_MulFix( FT_Long a, FT_Long b ) { @@ -452,29 +290,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_DivFix */ - /* */ - /* */ - /* 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 :: The first multiplier. */ - /* b :: The second multiplier. Use a 16.16 factor here whenever */ - /* possible (see note below). */ - /* */ - /* */ - /* The result of `(a*0x10000)/b'. */ - /* */ - /* */ - /* The optimization for FT_DivFix() is simple: If (a << 16) fits into */ - /* 32 bits, then the division is computed directly. Otherwise, we */ - /* use a specialized version of the old FT_MulDiv64(). */ - /* */ + /* documentation is in freetype.h */ + FT_EXPORT_DEF( FT_Long ) FT_DivFix( FT_Long a, FT_Long b ) { @@ -512,24 +329,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Add64 */ - /* */ - /* */ - /* Add two Int64 values. */ - /* */ - /* */ - /* x :: A pointer to the first value to be added. */ - /* y :: A pointer to the second value to be added. */ - /* */ - /* */ - /* z :: A pointer to the result of `x + y'. */ - /* */ - /* */ - /* Will be wrapped by the ADD_64() macro. */ - /* */ + /* documentation is in ftcalc.h */ + FT_EXPORT_DEF( void ) FT_Add64( FT_Int64* x, FT_Int64* y, FT_Int64 *z ) @@ -545,24 +346,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_MulTo64 */ - /* */ - /* */ - /* Multiplies two Int32 integers. Returns an Int64 integer. */ - /* */ - /* */ - /* x :: The first multiplier. */ - /* y :: The second multiplier. */ - /* */ - /* */ - /* z :: A pointer to the result of `x * y'. */ - /* */ - /* */ - /* Will be wrapped by the MUL_64() macro. */ - /* */ + /* documentation is in ftcalc.h */ + FT_EXPORT_DEF( void ) FT_MulTo64( FT_Int32 x, FT_Int32 y, FT_Int64 *z ) @@ -609,25 +394,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Div64by32 */ - /* */ - /* */ - /* Divides an Int64 value by an Int32 value. Returns an Int32 */ - /* integer. */ - /* */ - /* */ - /* x :: A pointer to the dividend. */ - /* y :: The divisor. */ - /* */ - /* */ - /* The result of `x / y'. */ - /* */ - /* */ - /* Will be wrapped by the DIV_64() macro. */ - /* */ + /* documentation is in ftcalc.h */ + FT_EXPORT_DEF( FT_Int32 ) FT_Div64by32( FT_Int64* x, FT_Int32 y ) { @@ -725,22 +493,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Sqrt64 */ - /* */ - /* */ - /* Computes the square root of a 64-bits value. That sounds stupid, */ - /* but it is needed to obtain maximal accuracy in the TrueType */ - /* bytecode interpreter. */ - /* */ - /* */ - /* z :: A pointer to a 64-bit integer. */ - /* */ - /* */ - /* The 32-bit square-root. */ - /* */ + /* documentation is in ftcalc.h */ + FT_EXPORT_DEF( FT_Int32 ) FT_Sqrt64( FT_Int64* l ) { FT_Int64 l2; @@ -769,7 +523,7 @@ } - FT_EXPORT( FT_Int32 ) FT_SqrtFixed( FT_Int32 x ) + FT_EXPORT( FT_Int32 ) FT_SqrtFixed( FT_Int32 x ) { FT_Int64 z; diff --git a/src/base/ftdebug.c b/src/base/ftdebug.c index 45f34bbe5..f291579af 100644 --- a/src/base/ftdebug.c +++ b/src/base/ftdebug.c @@ -82,21 +82,6 @@ #ifdef FT_DEBUG_LEVEL_TRACE - - /*************************************************************************/ - /* */ - /* */ - /* FT_SetTraceLevel */ - /* */ - /* */ - /* Sets the trace level for debugging. */ - /* */ - /* */ - /* component :: The component which should be traced. See ftdebug.h */ - /* for a complete list. If set to `trace_any', all */ - /* components will be traced. */ - /* level :: The tracing level. */ - /* */ FT_EXPORT_DEF( void ) FT_SetTraceLevel( FT_Trace component, char level ) { diff --git a/src/base/ftextend.c b/src/base/ftextend.c index 5ad457466..7fd23c3d8 100644 --- a/src/base/ftextend.c +++ b/src/base/ftextend.c @@ -109,22 +109,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Register_Extension */ - /* */ - /* */ - /* Registers a new extension. */ - /* */ - /* */ - /* driver :: A handle to the driver object. */ - /* */ - /* class :: A pointer to a class describing the extension. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /* documentation is in ftextend.h */ + FT_EXPORT_DEF( FT_Error ) FT_Register_Extension( FT_Driver driver, FT_Extension_Class* clazz ) @@ -164,26 +150,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Get_Extension */ - /* */ - /* */ - /* Queries an extension block by an extension ID string. */ - /* */ - /* */ - /* face :: A handle to the face object. */ - /* extension_id :: An ID string identifying the extension. */ - /* */ - /* */ - /* extension_interface :: A generic pointer, usually pointing to a */ - /* table of functions implementing the */ - /* extension interface. */ - /* */ - /* */ - /* A generic pointer to the extension block. */ - /* */ + /* documentation is in ftextend.h */ + FT_EXPORT_DEF( void* ) FT_Get_Extension( FT_Face face, const char* extension_id, diff --git a/src/base/ftglyph.c b/src/base/ftglyph.c index 9b362a76e..8ec96a7ea 100644 --- a/src/base/ftglyph.c +++ b/src/base/ftglyph.c @@ -52,26 +52,8 @@ /*************************************************************************/ - /*************************************************************************/ - /* */ - /* */ - /* FT_Matrix_Multiply */ - /* */ - /* */ - /* Performs the matrix operation `b = a*b'. */ - /* */ - /* */ - /* a :: A pointer to matrix `a'. */ - /* */ - /* */ - /* b :: A pointer to matrix `b'. */ - /* */ - /* */ - /* Yes. */ - /* */ - /* */ - /* The result is undefined if either `a' or `b' is zero. */ - /* */ + /* documentation is in ftglyph.h */ + FT_EXPORT_DEF( void ) FT_Matrix_Multiply( FT_Matrix* a, FT_Matrix* b ) { @@ -91,24 +73,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Matrix_Invert */ - /* */ - /* */ - /* Inverts a 2x2 matrix. Returns an error if it can't be inverted. */ - /* */ - /* */ - /* matrix :: A pointer to the target matrix. Remains untouched in */ - /* case of error. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - /* */ - /* Yes. */ - /* */ + /* documentation is in ftglyph.h */ + FT_EXPORT_DEF( FT_Error ) FT_Matrix_Invert( FT_Matrix* matrix ) { FT_Pos delta, xx, yy; @@ -405,24 +371,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Glyph_Copy */ - /* */ - /* */ - /* A function used to copy a glyph image. */ - /* */ - /* */ - /* source :: A handle to the source glyph object. */ - /* */ - /* */ - /* target :: A handle to the target glyph object. 0 in case of */ - /* error. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /* documentation is in ftglyph.h */ + FT_EXPORT_DEF( FT_Error ) FT_Glyph_Copy( FT_Glyph source, FT_Glyph *target ) { @@ -458,23 +408,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Get_Glyph */ - /* */ - /* */ - /* A function used to extract a glyph image from a slot. */ - /* */ - /* */ - /* slot :: A handle to the source glyph slot. */ - /* */ - /* */ - /* aglyph :: A handle to the glyph object. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /* documentation is in ftglyph.h */ + FT_EXPORT_DEF( FT_Error ) FT_Get_Glyph( FT_GlyphSlot slot, FT_Glyph *aglyph ) { @@ -538,30 +473,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Glyph_Transform */ - /* */ - /* */ - /* Transforms a glyph image if its format is scalable. */ - /* */ - /* */ - /* glyph :: A handle to the target glyph object. */ - /* */ - /* matrix :: A pointer to a 2x2 matrix to apply. */ - /* */ - /* delta :: A pointer to a 2d vector to apply. Coordinates are */ - /* expressed in 1/64th of a pixel. */ - /* */ - /* */ - /* FreeType error code (the glyph format is not scalable if it is */ - /* not zero). */ - /* */ - /* */ - /* The 2x2 transformation matrix is also applied to the glyph's */ - /* advance vector. */ - /* */ + /* documentation is in ftglyph.h */ + FT_EXPORT_DEF( FT_Error ) FT_Glyph_Transform( FT_Glyph glyph, FT_Matrix* matrix, FT_Vector* delta ) @@ -591,59 +504,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Glyph_Get_CBox */ - /* */ - /* */ - /* Returns the glyph image's bounding box. */ - /* */ - /* */ - /* glyph :: A handle to the source glyph object. */ - /* */ - /* mode :: The mode which indicates how to interpret the returned */ - /* bounding box values. */ - /* */ - /* */ - /* box :: The glyph bounding box. Coordinates are expressed in */ - /* 1/64th of pixels if it is grid-fitted. */ - /* */ - /* */ - /* Coordinates are relative to the glyph origin, using the Y-upwards */ - /* convention. */ - /* */ - /* If the glyph has been loaded with FT_LOAD_NO_SCALE, `bbox_mode' */ - /* must be set to `ft_glyph_bbox_unscaled' to get unscaled font */ - /* units. */ - /* */ - /* If `bbox_mode' is set to `ft_glyph_bbox_subpixels' the bbox */ - /* coordinates are returned in 26.6 pixels (i.e. 1/64th of pixels). */ - /* */ - /* Note that the maximum coordinates are exclusive, which means that */ - /* one can compute the width and height of the glyph image (be it in */ - /* integer or 26.6 pixels) as: */ - /* */ - /* width = bbox.xMax - bbox.xMin; */ - /* height = bbox.yMax - bbox.yMin; */ - /* */ - /* Note also that for 26.6 coordinates, if `bbox_mode' is set to */ - /* `ft_glyph_bbox_gridfit', the coordinates will also be grid-fitted, */ - /* which corresponds to: */ - /* */ - /* bbox.xMin = FLOOR(bbox.xMin); */ - /* bbox.yMin = FLOOR(bbox.yMin); */ - /* bbox.xMax = CEILING(bbox.xMax); */ - /* bbox.yMax = CEILING(bbox.yMax); */ - /* */ - /* To get the bbox in pixel coordinates, set `bbox_mode' to */ - /* `ft_glyph_bbox_truncate'. */ - /* */ - /* To get the bbox in grid-fitted pixel coordinates, set `bbox_mode' */ - /* to `ft_glyph_bbox_pixels'. */ - /* */ - /* The default value for `bbox_mode' is `ft_glyph_bbox_pixels'. */ - /* */ + /* documentation is in ftglyph.h */ + FT_EXPORT_DEF( void ) FT_Glyph_Get_CBox( FT_Glyph glyph, FT_UInt bbox_mode, FT_BBox *acbox ) @@ -687,77 +549,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Glyph_To_Bitmap */ - /* */ - /* */ - /* Converts a given glyph object to a bitmap glyph object. */ - /* */ - /* */ - /* glyph :: A pointer to a handle to the target glyph. */ - /* */ - /* */ - /* render_mode :: A set of bit flags that describe how the data is */ - /* */ - /* */ - /* origin :: A pointer to a vector used to translate the glyph */ - /* image before rendering. Can be 0 (if no */ - /* translation). The origin is expressed in */ - /* 26.6 pixels. */ - /* */ - /* destroy :: A boolean that indicates that the original glyph */ - /* image should be destroyed by this function. It is */ - /* never destroyed in case of error. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - /* */ - /* The glyph image is translated with the `origin' vector before */ - /* rendering. In case of error, it it translated back to its */ - /* original position and the glyph is left untouched. */ - /* */ - /* The first parameter is a pointer to a FT_Glyph handle, that will */ - /* be replaced by this function. Typically, you would use (omitting */ - /* error handling): */ - /* */ - /* */ - /* { */ - /* FT_Glyph glyph; */ - /* FT_BitmapGlyph glyph_bitmap; */ - /* */ - /* */ - /* // load glyph */ - /* error = FT_Load_Char( face, glyph_index, FT_LOAD_DEFAUT ); */ - /* */ - /* // extract glyph image */ - /* error = FT_Get_Glyph( face->glyph, &glyph ); */ - /* */ - /* // convert to a bitmap (default render mode + destroy old) */ - /* if ( glyph->format != ft_glyph_format_bitmap ) */ - /* { */ - /* error = FT_Glyph_To_Bitmap( &glyph, ft_render_mode_default, */ - /* 0, 1 ); */ - /* if ( error ) // glyph unchanged */ - /* ... */ - /* } */ - /* */ - /* // access bitmap content by typecasting */ - /* glyph_bitmap = (FT_BitmapGlyph)glyph; */ - /* */ - /* // do funny stuff with it, like blitting/drawing */ - /* ... */ - /* */ - /* // discard glyph image (bitmap or not) */ - /* FT_Done_Glyph( glyph ); */ - /* } */ - /* */ - /* */ - /* This function will always fail if the glyph's format isn't */ - /* scalable. */ - /* */ + /* documentation is in ftglyph.h */ + FT_EXPORT_DEF( FT_Error ) FT_Glyph_To_Bitmap( FT_Glyph* the_glyph, FT_ULong render_mode, FT_Vector* origin, @@ -844,17 +637,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Done_Glyph */ - /* */ - /* */ - /* Destroys a given glyph. */ - /* */ - /* */ - /* glyph :: A handle to the target glyph object. */ - /* */ + /* documentation is in ftglyph.h */ + FT_EXPORT_DEF( void ) FT_Done_Glyph( FT_Glyph glyph ) { if ( glyph ) diff --git a/src/base/ftinit.c b/src/base/ftinit.c index 87c5b3db1..79f751c89 100644 --- a/src/base/ftinit.c +++ b/src/base/ftinit.c @@ -72,19 +72,8 @@ const FT_Module_Class* const ft_default_modules[] = }; - /*************************************************************************/ - /* */ - /* */ - /* FT_Add_Default_Modules */ - /* */ - /* */ - /* Adds the set of default drivers to a given library object. */ - /* This is only useful when you create a library object with */ - /* FT_New_Library() (usually to plug a custom memory manager). */ - /* */ - /* */ - /* library :: A handle to a new library object. */ - /* */ + /* documentation is in ftmodule.h */ + FT_EXPORT_DEF( void ) FT_Add_Default_Modules( FT_Library library ) { FT_Error error; @@ -108,21 +97,8 @@ const FT_Module_Class* const ft_default_modules[] = } - /*************************************************************************/ - /* */ - /* */ - /* FT_Init_FreeType */ - /* */ - /* */ - /* Initializes a new FreeType library object. The set of drivers */ - /* that are registered by this function is determined at build time. */ - /* */ - /* */ - /* library :: A handle to a new library object. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /* documentation is in freetype.h */ + FT_EXPORT_DEF( FT_Error ) FT_Init_FreeType( FT_Library *alibrary ) { FT_Error error; @@ -150,21 +126,8 @@ const FT_Module_Class* const ft_default_modules[] = } - /*************************************************************************/ - /* */ - /* */ - /* FT_Done_FreeType */ - /* */ - /* */ - /* Destroys a given FreeType library object and all of its childs, */ - /* including resources, drivers, faces, sizes, etc. */ - /* */ - /* */ - /* library :: A handle to the target library object. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /* documentation is in freetype.h */ + FT_EXPORT_DEF( FT_Error ) FT_Done_FreeType( FT_Library library ) { if ( library ) diff --git a/src/base/ftmac.c b/src/base/ftmac.c index ff7eb5940..6feaa31e6 100644 --- a/src/base/ftmac.c +++ b/src/base/ftmac.c @@ -614,36 +614,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_New_Face_From_FOND */ - /* */ - /* */ - /* Creates a new face object from an FOND resource. */ - /* */ - /* */ - /* library :: A handle to the library resource. */ - /* */ - /* */ - /* fond :: An FOND resource. */ - /* */ - /* face_index :: Only supported for the -1 `sanity check' special */ - /* case. */ - /* */ - /* */ - /* aface :: A handle to a new face object. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - /* */ - /* This function can be used to create FT_Face objects from fonts */ - /* that are installed in the system like so: */ - /* */ - /* fond = GetResource( 'FOND', fontName ); */ - /* error = FT_New_Face_From_FOND( library, fond, 0, &face ); */ - /* */ + /* documentation in ftmac.h */ + FT_EXPORT_DEF( FT_Error ) FT_New_Face_From_FOND( FT_Library library, Handle fond, FT_Long face_index, @@ -698,7 +670,7 @@ /* This is the Mac-specific implementation of FT_New_Face. In */ /* addition to the standard FT_New_Face() functionality, it also */ /* accepts pathnames to Mac suitcase files. For further */ - /* documentation see the original FT_New_Face() in ftobjs.c. */ + /* documentation see the original FT_New_Face() in freetype.h. */ /* */ FT_EXPORT_DEF( FT_Error ) FT_New_Face( FT_Library library, const char* pathname, diff --git a/src/base/ftmm.c b/src/base/ftmm.c index c32c9f67d..d6c06050d 100644 --- a/src/base/ftmm.c +++ b/src/base/ftmm.c @@ -30,23 +30,8 @@ #define FT_COMPONENT trace_mm - /*************************************************************************/ - /* */ - /* */ - /* FT_Get_Multi_Master */ - /* */ - /* */ - /* Retrieves the Multiple Master descriptor of a given font. */ - /* */ - /* */ - /* face :: A handle to the source face. */ - /* */ - /* */ - /* master :: The Multiple Masters descriptor. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /* documentation is in ftmm.h */ + FT_EXPORT_DEF( FT_Error ) FT_Get_Multi_Master( FT_Face face, FT_Multi_Master *amaster ) { @@ -74,26 +59,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Set_MM_Design_Coordinates */ - /* */ - /* */ - /* For Multiple Masters fonts, choose an interpolated font design */ - /* through design coordinates. */ - /* */ - /* */ - /* face :: A handle to the source face. */ - /* */ - /* num_coords :: The number of design coordinates (must be equal to */ - /* the number of axes in the font). */ - /* */ - /* coords :: The design coordinates. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /* documentation is in ftmm.h */ + FT_EXPORT_DEF( FT_Error ) FT_Set_MM_Design_Coordinates( FT_Face face, FT_UInt num_coords, @@ -123,27 +90,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Set_MM_Blend_Coordinates */ - /* */ - /* */ - /* For Multiple Masters fonts, choose an interpolated font design */ - /* through normalized blend coordinates. */ - /* */ - /* */ - /* face :: A handle to the source face. */ - /* */ - /* num_coords :: The number of design coordinates (must be equal to */ - /* the number of axes in the font). */ - /* */ - /* coords :: The design coordinates (each one must be between 0 */ - /* and 1.0). */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /* documentation is in ftmm.h */ + FT_EXPORT_DEF( FT_Error ) FT_Set_MM_Blend_Coordinates( FT_Face face, FT_UInt num_coords, diff --git a/src/base/ftnames.c b/src/base/ftnames.c index 03caf3951..f5cb8d94e 100644 --- a/src/base/ftnames.c +++ b/src/base/ftnames.c @@ -26,53 +26,16 @@ #ifdef TT_CONFIG_OPTION_SFNT_NAMES - /*************************************************************************/ - /* */ - /* */ - /* FT_Get_Sfnt_Name_Count */ - /* */ - /* */ - /* Retrieves the number of name strings in the SFNT `name' table. */ - /* */ - /* */ - /* face :: A handle to the source face. */ - /* */ - /* */ - /* The number of strings in the `name' table. */ - /* */ + /* documentation is in ftnames.h */ + FT_EXPORT_DEF( FT_UInt ) FT_Get_Sfnt_Name_Count( FT_Face face ) { return face && ( FT_IS_SFNT( face ) ? ((TT_Face)face)->num_names : 0 ); } - /*************************************************************************/ - /* */ - /* */ - /* FT_Get_Sfnt_Name */ - /* */ - /* */ - /* Retrieves a string of the SFNT `name' table for a given index. */ - /* */ - /* */ - /* face :: A handle to the source face. */ - /* */ - /* index :: The index of the `name' string. */ - /* */ - /* */ - /* aname :: The indexed FT_SfntName structure. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - /* */ - /* The `string' array returned in the `aname' structure is not */ - /* null-terminated. */ - /* */ - /* Use FT_Get_Sfnt_Name_Count() to get the total number of available */ - /* `name' table entries, then do a loop until you get the right */ - /* platform, encoding, and name ID. */ - /* */ + /* documentation is in ftnames.h */ + FT_EXPORT_DEF( FT_Error ) FT_Get_Sfnt_Name( FT_Face face, FT_UInt index, FT_SfntName *aname ) diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index b4018a967..0d55ec986 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -283,17 +283,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Done_Stream */ - /* */ - /* */ - /* Closes and destroys a stream object. */ - /* */ - /* */ - /* stream :: The stream to be closed and destroyed. */ - /* */ + /* documentation is in ftobjs.h */ + FT_EXPORT_DEF( void ) FT_Done_Stream( FT_Stream stream ) { if ( stream && stream->close ) @@ -857,31 +848,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Set_Transform */ - /* */ - /* */ - /* A function used to set the transformation that is applied to glyph */ - /* images just before they are converted to bitmaps in a glyph slot */ - /* when FT_Render_Glyph() is called. */ - /* */ - /* */ - /* face :: A handle to the source face object. */ - /* */ - /* */ - /* matrix :: A pointer to the transformation's 2x2 matrix. Use 0 for */ - /* the identity matrix. */ - /* delta :: A pointer to the translation vector. Use 0 for the null */ - /* vector. */ - /* */ - /* */ - /* 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(). */ - /* */ + /* documentation is in freetype.h */ + FT_EXPORT_DEF( void ) FT_Set_Transform( FT_Face face, FT_Matrix* matrix, FT_Vector* delta ) @@ -931,39 +899,8 @@ static FT_Renderer ft_lookup_glyph_renderer( FT_GlyphSlot slot ); - /*************************************************************************/ - /* */ - /* */ - /* FT_Load_Glyph */ - /* */ - /* */ - /* A function used to load a single glyph within a given glyph slot, */ - /* for a given size. */ - /* */ - /* */ - /* face :: A handle to the target face object where the glyph */ - /* will be loaded. */ - /* */ - /* glyph_index :: The index of the glyph in the font file. */ - /* */ - /* load_flags :: A flag indicating what to load for this glyph. The */ - /* FT_LOAD_XXX constants can be used to control the */ - /* glyph loading process (e.g., whether the outline */ - /* should be scaled, whether to load bitmaps or not, */ - /* whether to hint the outline, etc). */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - /* */ - /* 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. */ - /* */ - /* Note that this also transforms the `face.glyph.advance' field, but */ - /* *not* the values in `face.glyph.metrics'. */ - /* */ + /* documentation is in freetype.h */ + FT_EXPORT_DEF( FT_Error ) FT_Load_Glyph( FT_Face face, FT_UInt glyph_index, FT_Int load_flags ) @@ -1096,44 +1033,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Load_Char */ - /* */ - /* */ - /* A function used to load a single glyph within a given glyph slot, */ - /* for a given size, according to its character code. */ - /* */ - /* */ - /* face :: A handle to a target face object where the glyph */ - /* will be loaded. */ - /* */ - /* char_code :: The glyph's character code, according to the */ - /* current charmap used in the face. */ - /* */ - /* load_flags :: A flag indicating what to load for this glyph. The */ - /* FT_LOAD_XXX constants can be used to control the */ - /* glyph loading process (e.g., whether the outline */ - /* should be scaled, whether to load bitmaps or not, */ - /* whether to hint the outline, etc). */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - /* */ - /* If the face has no current charmap, or if the character code */ - /* is not defined in the charmap, this function will return an */ - /* 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(). */ - /* */ - /* Note that this also transforms the `face.glyph.advance' field, but */ - /* *not* the values in `face.glyph.metrics'. */ - /* */ + /* documentation is in freetype.h */ + FT_EXPORT_DEF( FT_Error ) FT_Load_Char( FT_Face face, FT_ULong char_code, FT_Int load_flags ) @@ -1296,44 +1197,8 @@ #ifndef macintosh - /*************************************************************************/ - /* */ - /* */ - /* FT_New_Face */ - /* */ - /* */ - /* Creates a new face object from a given resource and typeface index */ - /* using a pathname to the font file. */ - /* */ - /* */ - /* library :: A handle to the library resource. */ - /* */ - /* */ - /* pathname :: A path to the font file. */ - /* */ - /* face_index :: The index of the face within the resource. The */ - /* first face has index 0. */ - /* */ - /* aface :: A handle to a new face object. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - /* */ - /* 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 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_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. */ - /* */ + /* documentation is in freetype.h */ + FT_EXPORT_DEF( FT_Error ) FT_New_Face( FT_Library library, const char* pathname, FT_Long face_index, @@ -1355,46 +1220,8 @@ #endif /* !macintosh */ - /*************************************************************************/ - /* */ - /* */ - /* FT_New_Memory_Face */ - /* */ - /* */ - /* Creates a new face object from a given resource and typeface index */ - /* using a font file already loaded into memory. */ - /* */ - /* */ - /* library :: A handle to the library resource. */ - /* */ - /* */ - /* 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. */ - /* */ - /* face :: A handle to a new face object. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - /* */ - /* 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 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_New_Memory_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. */ - /* */ + /* documentation is in freetype.h */ + FT_EXPORT_DEF( FT_Error ) FT_New_Memory_Face( FT_Library library, FT_Byte* file_base, FT_Long file_size, @@ -1416,46 +1243,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Open_Face */ - /* */ - /* */ - /* 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. */ - /* */ - /* */ - /* library :: A handle to the library resource. */ - /* */ - /* */ - /* args :: A pointer to an `FT_Open_Args' structure which must */ - /* be filled by the caller. */ - /* */ - /* face_index :: The index of the face within the resource. The */ - /* first face has index 0. */ - /* */ - /* aface :: A handle to a new face object. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - /* */ - /* 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 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_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. */ - /* */ + /* documentation is in freetype.h */ + FT_EXPORT_DEF( FT_Error ) FT_Open_Face( FT_Library library, FT_Open_Args* args, FT_Long face_index, @@ -1629,38 +1418,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Attach_File */ - /* */ - /* */ - /* `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. */ - /* */ - /* */ - /* face :: The target face object. */ - /* */ - /* */ - /* filepathname :: An 8-bit pathname naming the `metrics' file. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - /* */ - /* If your font file is in memory, or if you want to provide your */ - /* own input stream object, use FT_Attach_Stream(). */ - /* */ - /* 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 are doing */ - /* when invoking this function. Most drivers simply do not implement */ - /* file attachments. */ - /* */ + /* documentation is in freetype.h */ + FT_EXPORT_DEF( FT_Error ) FT_Attach_File( FT_Face face, const char* filepathname ) { @@ -1679,32 +1438,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Attach_Stream */ - /* */ - /* */ - /* This function is similar to FT_Attach_File() with the exception */ - /* that it reads the attachment from an arbitrary stream. */ - /* */ - /* */ - /* face :: The target face object. */ - /* */ - /* parameters :: A pointer to an FT_Open_Args structure used to */ - /* describe the input stream to FreeType. */ - /* */ - /* 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 */ - /* depends on the font format (and thus the font driver). */ - /* */ - /* Client applications are expected to know what they are doing */ - /* when invoking this function. Most drivers simply do not implement */ - /* file attachments. */ - /* */ + /* documentation is in freetype.h */ + FT_EXPORT_DEF( FT_Error ) FT_Attach_Stream( FT_Face face, FT_Open_Args* parameters ) { @@ -1746,21 +1481,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Done_Face */ - /* */ - /* */ - /* Discards a given face object, as well as all of its child slots */ - /* and sizes. */ - /* */ - /* */ - /* face :: A handle to a target face object. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /* documentation is in freetype.h */ + FT_EXPORT_DEF( FT_Error ) FT_Done_Face( FT_Face face ) { FT_Error error; @@ -1792,23 +1514,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_New_Size */ - /* */ - /* */ - /* Creates a new size object from a given face object. */ - /* */ - /* */ - /* face :: A handle to a parent face object. */ - /* */ - /* */ - /* asize :: A handle to a new size object. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /* documentation is in ftobjs.h */ + FT_EXPORT_DEF( FT_Error ) FT_New_Size( FT_Face face, FT_Size *asize ) { @@ -1868,20 +1575,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Done_Size */ - /* */ - /* */ - /* Discards a given size object. */ - /* */ - /* */ - /* size :: A handle to a target size object. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /* documentation is in ftobjs.h */ + FT_EXPORT_DEF( FT_Error ) FT_Done_Size( FT_Size size ) { FT_Error error; @@ -1947,40 +1642,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Set_Char_Size */ - /* */ - /* */ - /* 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. */ - /* */ - /* */ - /* size :: A handle to a target size object. */ - /* */ - /* */ - /* 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. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - /* */ - /* When dealing with fixed-size faces (i.e., non-scalable formats), */ - /* use the function FT_Set_Pixel_Sizes(). */ - /* */ + /* documentation is in freetype.h */ + FT_EXPORT_DEF( FT_Error ) FT_Set_Char_Size( FT_Face face, FT_F26Dot6 char_width, FT_F26Dot6 char_height, @@ -2051,44 +1714,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Set_Pixel_Sizes */ - /* */ - /* */ - /* 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. */ - /* */ - /* */ - /* face :: A handle to the target face object. */ - /* */ - /* */ - /* pixel_width :: The character width, in integer pixels. */ - /* */ - /* pixel_height :: The character height, in integer pixels. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - /* */ - /* The values of `pixel_width' and `pixel_height' correspond to the */ - /* pixel values of the _typographic_ character size, which are NOT */ - /* necessarily the same as the dimensions of the glyph `bitmap */ - /* cells". */ - /* */ - /* The `character size' is really the size of an abstract square */ - /* called the `EM', used to design the font. However, depending */ - /* on the font design, glyphs will be smaller or greater than the */ - /* EM. */ - /* */ - /* This means that setting the pixel size to, say, 8x8 doesn't */ - /* guarantee in any way that you will get glyph bitmaps that all fit */ - /* within an 8x8 cell (sometimes even far from it). */ - /* */ + /* documentation is in freetype.h */ + FT_EXPORT_DEF( FT_Error ) FT_Set_Pixel_Sizes( FT_Face face, FT_UInt pixel_width, FT_UInt pixel_height ) @@ -2141,39 +1768,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Get_Kerning */ - /* */ - /* */ - /* Returns the kerning vector between two glyphs of a same face. */ - /* */ - /* */ - /* face :: A handle to a source face object. */ - /* */ - /* left_glyph :: The index of the left glyph in the kern pair. */ - /* */ - /* right_glyph :: The index of the right glyph in the kern pair. */ - /* */ - /* kern_mode :: See FT_Kerning_Mode() for more information. */ - /* Determines the scale/dimension of the returned */ - /* kerning vector. */ - /* */ - /* */ - /* kerning :: The kerning vector. This is in font units for */ - /* scalable formats, and in pixels for fixed-sizes */ - /* formats. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - /* */ - /* Only horizontal layouts (left-to-right & right-to-left) are */ - /* supported by this method. Other layouts, or more sophisticated */ - /* kernings, are out of the scope of this API function -- they can be */ - /* implemented through format-specific interfaces. */ - /* */ + /* documentation is in freetype.h */ + FT_EXPORT_DEF( FT_Error ) FT_Get_Kerning( FT_Face face, FT_UInt left_glyph, FT_UInt right_glyph, @@ -2223,27 +1819,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Select_Charmap */ - /* */ - /* */ - /* Selects a given charmap by its encoding tag (as listed in */ - /* `freetype.h'). */ - /* */ - /* */ - /* face :: A handle to the source face object. */ - /* */ - /* encoding :: A handle to the selected charmap. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - /* */ - /* This function will return an error if no charmap in the face */ - /* corresponds to the encoding queried here. */ - /* */ + /* documentation is in freetype.h */ + FT_EXPORT_DEF( FT_Error ) FT_Select_Charmap( FT_Face face, FT_Encoding encoding ) { @@ -2273,27 +1850,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Set_Charmap */ - /* */ - /* */ - /* Selects a given charmap for character code to glyph index */ - /* decoding. */ - /* */ - /* */ - /* face :: A handle to the source face object. */ - /* charmap :: A handle to the selected charmap. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - /* */ - /* 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). */ - /* */ + /* documentation is in freetype.h */ + FT_EXPORT_DEF( FT_Error ) FT_Set_Charmap( FT_Face face, FT_CharMap charmap ) { @@ -2322,23 +1880,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Get_Char_Index */ - /* */ - /* */ - /* Returns the glyph index of a given character code. This function */ - /* uses a charmap object to do the translation. */ - /* */ - /* */ - /* face :: A handle to the source face object. */ - /* */ - /* charcode :: The character code. */ - /* */ - /* */ - /* The glyph index. 0 means `undefined character code'. */ - /* */ + /* documentation is in freetype.h */ + FT_EXPORT_DEF( FT_UInt ) FT_Get_Char_Index( FT_Face face, FT_ULong charcode ) { @@ -2356,41 +1899,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Get_Glyph_Name */ - /* */ - /* */ - /* Retrieves the ASCII name of a given glyph in a face. This only */ - /* works for those faces where FT_HAS_GLYPH_NAME(face) returns true. */ - /* */ - /* */ - /* face :: A handle to a source face object. */ - /* */ - /* glyph_index :: The glyph index. */ - /* */ - /* buffer :: A pointer to a target buffer where the name will be */ - /* copied to. */ - /* */ - /* buffer_max :: The maximal number of bytes available in the */ - /* buffer. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - /* */ - /* An error is returned if the face doesn't provide glyph names or if */ - /* the glyph index is invalid. In all cases of failure, the first */ - /* byte of `buffer' will be set to 0 to indicate an empty name. */ - /* */ - /* The glyph name is truncated to fit within the buffer if it is too */ - /* long. The returned string is always zero-terminated. */ - /* */ - /* This function is not compiled within the library if the config */ - /* macro FT_CONFIG_OPTION_NO_GLYPH_NAMES is defined in */ - /* `include/freetype/config/ftoptions.h' */ - /* */ + /* documentation is in freetype.h */ + FT_EXPORT_DEF( FT_Error ) FT_Get_Glyph_Name( FT_Face face, FT_UInt glyph_index, FT_Pointer buffer, @@ -2428,32 +1938,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Get_Sfnt_Table */ - /* */ - /* */ - /* Returns a pointer to a given SFNT table within a face. */ - /* */ - /* */ - /* face :: A handle to the source face object. */ - /* tag :: An index of an SFNT table. */ - /* */ - /* */ - /* A type-less pointer to the table. This will be 0 in case of */ - /* error, or if the corresponding table was not found *OR* loaded */ - /* from the file. */ - /* */ - /* */ - /* The table is owned by the face object, and disappears with it. */ - /* */ - /* This function is only useful to access SFNT tables that are loaded */ - /* by the sfnt/truetype/opentype drivers. See the FT_Sfnt_Tag */ - /* enumeration in `tttables.h' for a list. */ - /* */ - /* You can load any table with a different function.. XXX */ - /* */ + /* documentation is in tttables.h */ + FT_EXPORT_DEF( void* ) FT_Get_Sfnt_Table( FT_Face face, FT_Sfnt_Tag tag ) { @@ -2631,29 +2117,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Get_Renderer */ - /* */ - /* */ - /* Retrieves the current renderer for a given glyph format. */ - /* */ - /* */ - /* library :: A handle to the library object. */ - /* */ - /* format :: The glyph format. */ - /* */ - /* */ - /* A renderer handle. 0 if none found. */ - /* */ - /* */ - /* An error will be returned if a module already exists by that name, */ - /* or if the module requires a version of FreeType that is too great. */ - /* */ - /* To add a new renderer, simply use FT_Add_Module(). To retrieve a */ - /* renderer by its name, use FT_Get_Module(). */ - /* */ + /* documentation is in ftrender.h */ + FT_EXPORT_DEF( FT_Renderer ) FT_Get_Renderer( FT_Library library, FT_Glyph_Format format ) { @@ -2663,32 +2128,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Set_Renderer */ - /* */ - /* */ - /* Sets the current renderer to use, and set additional mode. */ - /* */ - /* */ - /* library :: A handle to the library object. */ - /* */ - /* renderer :: A handle to the renderer object. */ - /* */ - /* num_params :: The number of additional parameters. */ - /* */ - /* parameters :: Additional parameters. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - /* */ - /* In case of success, the renderer will be used to convert glyph */ - /* images in the renderer's known format into bitmaps. */ - /* */ - /* This doesn't change the current renderer for other formats. */ - /* */ + /* documentation is in ftrender.h */ + FT_EXPORT( FT_Error ) FT_Set_Renderer( FT_Library library, FT_Renderer renderer, FT_UInt num_params, @@ -2792,27 +2233,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Render_Glyph */ - /* */ - /* */ - /* Converts a given glyph image to a bitmap. It does so by */ - /* inspecting the glyph image format, find the relevant renderer, and */ - /* invoke it. */ - /* */ - /* */ - /* 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. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /* documentation is in freetype.h */ + FT_EXPORT_DEF( FT_Error ) FT_Render_Glyph( FT_GlyphSlot slot, FT_UInt render_mode ) { @@ -2888,26 +2310,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Add_Module */ - /* */ - /* */ - /* Adds a new module to a given library instance. */ - /* */ - /* */ - /* library :: A handle to the library object. */ - /* */ - /* clazz :: A pointer to class descriptor for the module. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - /* */ - /* An error will be returned if a module already exists by that name, */ - /* or if the module requires a version of FreeType that is too great. */ - /* */ + /* documentation is in ftmodule.h */ + FT_EXPORT_DEF( FT_Error ) FT_Add_Module( FT_Library library, const FT_Module_Class* clazz ) { @@ -3032,26 +2436,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Get_Module */ - /* */ - /* */ - /* Finds a module by its name. */ - /* */ - /* */ - /* library :: A handle to the library object. */ - /* */ - /* module_name :: The module's name (as an ASCII string). */ - /* */ - /* */ - /* A module handle. 0 if none was found. */ - /* */ - /* */ - /* You should better be familiar with FreeType internals to know */ - /* which module to look for :-) */ - /* */ + /* documentation is in ftmodule.h */ + FT_EXPORT_DEF( FT_Module ) FT_Get_Module( FT_Library library, const char* module_name ) { @@ -3112,25 +2498,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Remove_Module */ - /* */ - /* */ - /* Removes a given module from a library instance. */ - /* */ - /* */ - /* library :: A handle to a library object. */ - /* */ - /* module :: A handle to a module object. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - /* */ - /* The module object is destroyed by the function in case of success. */ - /* */ + /* documentation is in ftmodule.h */ + FT_EXPORT_DEF( FT_Error ) FT_Remove_Module( FT_Library library, FT_Module module ) { @@ -3183,25 +2552,8 @@ /*************************************************************************/ - /*************************************************************************/ - /* */ - /* */ - /* FT_New_Library */ - /* */ - /* */ - /* This function is used to create a new FreeType library instance */ - /* from a given memory object. It is thus possible to use libraries */ - /* with distinct memory allocators within the same program. */ - /* */ - /* */ - /* memory :: A handle to the original memory object. */ - /* */ - /* */ - /* alibrary :: A pointer to handle of a new library object. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /* documentation is in ftmodule.h */ + FT_EXPORT_DEF( FT_Error ) FT_New_Library( FT_Memory memory, FT_Library *alibrary ) { @@ -3234,21 +2586,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Done_Library */ - /* */ - /* */ - /* Discards a given library object. This closes all drivers and */ - /* discards all resource objects. */ - /* */ - /* */ - /* library :: A handle to the target library. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /* documentation is in ftmodule.h */ + FT_EXPORT_DEF( FT_Error ) FT_Done_Library( FT_Library library ) { FT_Memory memory; @@ -3286,28 +2625,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Set_Debug_Hook */ - /* */ - /* */ - /* Sets a debug hook function for debugging the interpreter of a font */ - /* format. */ - /* */ - /* */ - /* library :: A handle to the library object. */ - /* */ - /* hook_index :: The index of the debug hook. You should use the */ - /* values defined in ftobjs.h, e.g. */ - /* FT_DEBUG_HOOK_TRUETYPE */ - /* */ - /* debug_hook :: The function used to debug the interpreter. */ - /* */ - /* */ - /* Currently, four debug hook slots are available, but only two (for */ - /* the TrueType and the Type 1 interpreter) are defined. */ - /* */ + /* documentation is in ftmodule.h */ + FT_EXPORT_DEF( void ) FT_Set_Debug_Hook( FT_Library library, FT_UInt hook_index, FT_DebugHook_Func debug_hook ) diff --git a/src/base/ftoutln.c b/src/base/ftoutln.c index 440530aac..fdd0098d7 100644 --- a/src/base/ftoutln.c +++ b/src/base/ftoutln.c @@ -41,30 +41,8 @@ const FT_Outline null_outline = { 0, 0, 0, 0, 0, 0 }; - /*************************************************************************/ - /* */ - /* */ - /* FT_Outline_Decompose */ - /* */ - /* */ - /* Walks over an outline's structure to decompose it into individual */ - /* segments and Bezier arcs. This function is also able to emit */ - /* `move to' and `close to' operations to indicate the start and end */ - /* of new contours in the outline. */ - /* */ - /* */ - /* outline :: A pointer to the source target. */ - /* */ - /* interface :: A table of `emitters', i.e,. function pointers called */ - /* during decomposition to indicate path operations. */ - /* */ - /* user :: A typeless pointer which is passed to each emitter */ - /* during the decomposition. It can be used to store */ - /* the state during the decomposition. */ - /* */ - /* */ - /* FreeType error code. 0 means sucess. */ - /* */ + /* documentation is in ftoutln.h */ + FT_EXPORT_DEF( FT_Error ) FT_Outline_Decompose( FT_Outline* outline, const FT_Outline_Funcs* interface, @@ -303,38 +281,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Outline_New */ - /* */ - /* */ - /* Creates a new outline of a given size. */ - /* */ - /* */ - /* library :: A handle to the library object from where the */ - /* outline is allocated. Note however that the new */ - /* outline will NOT necessarily be FREED, when */ - /* destroying the library, by FT_Done_FreeType(). */ - /* */ - /* numPoints :: The maximal number of points within the outline. */ - /* */ - /* numContours :: The maximal number of contours within the outline. */ - /* */ - /* */ - /* outline :: A handle to the new outline. NULL in case of */ - /* error. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - /* */ - /* No. */ - /* */ - /* */ - /* The reason why this function takes a `library' parameter is simply */ - /* to use the library's memory allocator. */ - /* */ + /* documentation is in ftoutln.h */ + FT_EXPORT_DEF( FT_Error ) FT_Outline_New( FT_Library library, FT_UInt numPoints, FT_Int numContours, @@ -348,25 +296,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Outline_Copy */ - /* */ - /* */ - /* Copies an outline into another one. Both objects must have the */ - /* same sizes (number of points & number of contours) when this */ - /* function is called. */ - /* */ - /* */ - /* source :: A handle to the source outline. */ - /* */ - /* */ - /* target :: A handle to the target outline. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /* documentation is in ftoutln.h */ + FT_EXPORT_DEF( FT_Error ) FT_Outline_Copy( FT_Outline* source, FT_Outline *target ) { @@ -418,33 +349,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Outline_Done */ - /* */ - /* */ - /* Destroys an outline created with FT_Outline_New(). */ - /* */ - /* */ - /* library :: A handle of the library object used to allocate the */ - /* outline. */ - /* */ - /* outline :: A pointer to the outline object to be discarded. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - /* */ - /* No. */ - /* */ - /* */ - /* If the outline's `owner' field is not set, only the outline */ - /* descriptor will be released. */ - /* */ - /* The reason why this function takes an `outline' parameter is */ - /* simply to use FT_Free(). */ - /* */ + /* documentation is in ftoutln.h */ + FT_EXPORT_DEF( FT_Error ) FT_Outline_Done( FT_Library library, FT_Outline* outline ) { @@ -457,32 +363,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Outline_Get_CBox */ - /* */ - /* */ - /* Returns an outline's `control box'. The control box encloses all */ - /* the outline's points, including Bezier control points. Though it */ - /* coincides with the exact bounding box for most glyphs, it can be */ - /* slightly larger in some situations (like when rotating an outline */ - /* which contains Bezier outside arcs). */ - /* */ - /* Computing the control box is very fast, while getting the bounding */ - /* box can take much more time as it needs to walk over all segments */ - /* and arcs in the outline. To get the latter, you can use the */ - /* `ftbbox' component which is dedicated to this single task. */ - /* */ - /* */ - /* outline :: A pointer to the source outline descriptor. */ - /* */ - /* */ - /* cbox :: The outline's control box. */ - /* */ - /* */ - /* Yes. */ - /* */ + /* documentation is in ftoutln.h */ + FT_EXPORT_DEF( void ) FT_Outline_Get_CBox( FT_Outline* outline, FT_BBox *acbox ) { @@ -530,24 +412,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Outline_Translate */ - /* */ - /* */ - /* Applies a simple translation to the points of an outline. */ - /* */ - /* */ - /* outline :: A pointer to the target outline descriptor. */ - /* */ - /* xOffset :: The horizontal offset. */ - /* */ - /* yOffset :: The vertical offset. */ - /* */ - /* */ - /* Yes. */ - /* */ + /* documentation is in ftoutln.h */ + FT_EXPORT_DEF( void ) FT_Outline_Translate( FT_Outline* outline, FT_Pos xOffset, FT_Pos yOffset ) @@ -565,22 +431,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Outline_Reverse */ - /* */ - /* */ - /* Reverses the drawing direction of an outline. This is used to */ - /* ensure consistent fill conventions for mirrored glyphs. */ - /* */ - /* */ - /* outline :: A pointer to the target outline descriptor. */ - /* */ - /* */ - /* This functions toggles the bit flag `ft_outline_reverse_fill' in */ - /* the outline's `flags' field. */ - /* */ + /* documentation is in ftoutln.h */ + FT_EXPORT_DEF( void ) FT_Outline_Reverse( FT_Outline* outline ) { FT_UShort n; @@ -634,40 +486,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Outline_Render */ - /* */ - /* */ - /* Renders an outline within a bitmap using the current scan-convert. */ - /* This functions uses an FT_Raster_Params structure as an argument, */ - /* allowing advanced features like direct composition, translucency, */ - /* etc. */ - /* */ - /* */ - /* library :: A handle to a FreeType library object. */ - /* */ - /* outline :: A pointer to the source outline descriptor. */ - /* */ - /* params :: A pointer to a FT_Raster_Params structure used to */ - /* describe the rendering operation. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - /* */ - /* YES. Rendering is synchronized, so that concurrent calls to the */ - /* scan-line converter will be serialized. */ - /* */ - /* */ - /* You should know what you are doing and how FT_Raster_Params works */ - /* to use this function. */ - /* */ - /* The field `params.source' will be set to `outline' before the scan */ - /* converter is called, which means that the value you give to it is */ - /* actually ignored. */ - /* */ + /* documentation is in ftoutln.h */ + FT_EXPORT_DEF( FT_Error ) FT_Outline_Render( FT_Library library, FT_Outline* outline, FT_Raster_Params* params ) @@ -716,35 +536,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Outline_Get_Bitmap */ - /* */ - /* */ - /* Renders an outline within a bitmap. The outline's image is simply */ - /* OR-ed to the target bitmap. */ - /* */ - /* */ - /* library :: A handle to a FreeType library object. */ - /* */ - /* outline :: A pointer to the source outline descriptor. */ - /* */ - /* map :: A pointer to the target bitmap descriptor. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - /* */ - /* YES. Rendering is synchronized, so that concurrent calls to the */ - /* scan-line converter will be serialized. */ - /* */ - /* */ - /* This function does NOT CREATE the bitmap, it only renders an */ - /* outline image within the one you pass to it! */ - /* */ - /* It will use the raster correponding to the default glyph format. */ - /* */ + /* documentation is in ftoutln.h */ + FT_EXPORT_DEF( FT_Error ) FT_Outline_Get_Bitmap( FT_Library library, FT_Outline* outline, FT_Bitmap *abitmap ) @@ -767,26 +560,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Vector_Transform */ - /* */ - /* */ - /* Transforms a single vector through a 2x2 matrix. */ - /* */ - /* */ - /* vector :: The target vector to transform. */ - /* */ - /* */ - /* matrix :: A pointer to the source 2x2 matrix. */ - /* */ - /* */ - /* Yes. */ - /* */ - /* */ - /* The result is undefined if either `vector' or `matrix' is invalid. */ - /* */ + /* documentation is in ftoutln.h */ + FT_EXPORT_DEF( void ) FT_Vector_Transform( FT_Vector* vector, FT_Matrix* matrix ) { @@ -807,27 +582,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Outline_Transform */ - /* */ - /* */ - /* Applies a simple 2x2 matrix to all of an outline's points. Useful */ - /* for applying rotations, slanting, flipping, etc. */ - /* */ - /* */ - /* outline :: A pointer to the target outline descriptor. */ - /* */ - /* matrix :: A pointer to the transformation matrix. */ - /* */ - /* */ - /* Yes. */ - /* */ - /* */ - /* You can use FT_Outline_Translate() if you need to translate the */ - /* outline's points. */ - /* */ + /* documentation is in ftoutln.h */ + FT_EXPORT_DEF( void ) FT_Outline_Transform( FT_Outline* outline, FT_Matrix* matrix ) { @@ -839,4 +595,5 @@ FT_Vector_Transform( vec, matrix ); } + /* END */ diff --git a/src/base/ftsystem.c b/src/base/ftsystem.c index 357df3b2a..da77ae61a 100644 --- a/src/base/ftsystem.c +++ b/src/base/ftsystem.c @@ -213,23 +213,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_New_Stream */ - /* */ - /* */ - /* Creates a new stream object. */ - /* */ - /* */ - /* filepathname :: The name of the stream (usually a file) to be */ - /* opened. */ - /* */ - /* stream :: A pointer to the stream object. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ + /* documentation is in ftobjs.h */ + FT_EXPORT_DEF( FT_Error ) FT_New_Stream( const char* filepathname, FT_Stream astream ) { @@ -267,17 +252,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_New_Memory */ - /* */ - /* */ - /* Creates a new memory object. */ - /* */ - /* */ - /* A pointer to the new memory object. 0 in case of error. */ - /* */ + /* documentation is in ftobjs.h */ + FT_EXPORT_DEF( FT_Memory ) FT_New_Memory( void ) { FT_Memory memory; @@ -296,17 +272,8 @@ } - /*************************************************************************/ - /* */ - /* */ - /* FT_Done_Memory */ - /* */ - /* */ - /* Discards memory manager. */ - /* */ - /* */ - /* memory :: A handle to the memory manager. */ - /* */ + /* documentation is in ftobjs.h */ + FT_EXPORT_DEF( void ) FT_Done_Memory( FT_Memory memory ) { free( memory ); diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c index 28e885c51..ee3f193dd 100644 --- a/src/sfnt/sfobjs.c +++ b/src/sfnt/sfobjs.c @@ -19,10 +19,12 @@ #ifdef FT_FLAT_COMPILE #include "sfobjs.h" +#include "ttload.h" #else #include +#include #endif @@ -30,6 +32,7 @@ #include #include #include +#include #include diff --git a/src/smooth/ftgrays.h b/src/smooth/ftgrays.h index e1792c270..5055f6d26 100644 --- a/src/smooth/ftgrays.h +++ b/src/smooth/ftgrays.h @@ -31,7 +31,7 @@ /*************************************************************************/ /* */ /* To make ftgrays.h independent from configuration files we check */ - /* whether FT_EXPORT has been defined already. */ + /* whether FT_EXPORT_VAR has been defined already. */ /* */ /* On some systems and compilers (Win32 mostly), an extra keyword is */ /* necessary to compile the library as a DLL. */ diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index e62a4c24f..1e9a39947 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -765,25 +765,8 @@ }; - /*************************************************************************/ - /* */ - /* */ - /* TT_New_Context */ - /* */ - /* */ - /* Queries the face context for a given font. Note that there is */ - /* now a _single_ execution context in the TrueType driver which is */ - /* shared among faces. */ - /* */ - /* */ - /* face :: A handle to the source face object. */ - /* */ - /* */ - /* A handle to the execution context. Initialized for `face'. */ - /* */ - /* */ - /* Only the glyph loader and debugger should call this function. */ - /* */ + /* documentation is in ttinterp.h */ + FT_EXPORT_DEF( TT_ExecContext ) TT_New_Context( TT_Face face ) { TT_Driver driver; @@ -6794,27 +6777,8 @@ /*************************************************************************/ - /*************************************************************************/ - /* */ - /* */ - /* TT_RunIns */ - /* */ - /* */ - /* Executes one or more instruction in the execution context. This */ - /* is the main function of the TrueType opcode interpreter. */ - /* */ - /* */ - /* exec :: A handle to the target execution context. */ - /* */ - /* */ - /* FreeType error code. 0 means success. */ - /* */ - /* */ - /* Only the object manager and debugger should call this function. */ - /* */ - /* This function is publicly exported because it is directly */ - /* invoked by the TrueType debugger. */ - /* */ + /* documentation is in ttinterp.h */ + FT_EXPORT_DEF( FT_Error ) TT_RunIns( TT_ExecContext exc ) { FT_Long ins_counter = 0; /* executed instructions counter */ diff --git a/src/truetype/ttinterp.h b/src/truetype/ttinterp.h index dbe9f03de..1094aedac 100644 --- a/src/truetype/ttinterp.h +++ b/src/truetype/ttinterp.h @@ -243,8 +243,29 @@ FT_Error TT_Clear_CodeRange( TT_ExecContext exec, FT_Int range ); + + /*************************************************************************/ + /* */ + /* */ + /* TT_New_Context */ + /* */ + /* */ + /* Queries the face context for a given font. Note that there is */ + /* now a _single_ execution context in the TrueType driver which is */ + /* shared among faces. */ + /* */ + /* */ + /* face :: A handle to the source face object. */ + /* */ + /* */ + /* A handle to the execution context. Initialized for `face'. */ + /* */ + /* */ + /* Only the glyph loader and debugger should call this function. */ + /* */ FT_EXPORT( TT_ExecContext ) TT_New_Context( TT_Face face ); + FT_LOCAL FT_Error TT_Done_Context( TT_ExecContext exec ); @@ -265,6 +286,28 @@ FT_Error TT_Run_Context( TT_ExecContext exec, FT_Bool debug ); + + /*************************************************************************/ + /* */ + /* */ + /* TT_RunIns */ + /* */ + /* */ + /* Executes one or more instruction in the execution context. This */ + /* is the main function of the TrueType opcode interpreter. */ + /* */ + /* */ + /* exec :: A handle to the target execution context. */ + /* */ + /* */ + /* FreeType error code. 0 means success. */ + /* */ + /* */ + /* Only the object manager and debugger should call this function. */ + /* */ + /* This function is publicly exported because it is directly */ + /* invoked by the TrueType debugger. */ + /* */ FT_EXPORT( FT_Error ) TT_RunIns( TT_ExecContext exec ); diff --git a/src/type1/t1driver.h b/src/type1/t1driver.h index 8b5fcb672..5354a4fa6 100644 --- a/src/type1/t1driver.h +++ b/src/type1/t1driver.h @@ -26,7 +26,7 @@ #endif - FT_EXPORT_VAR( const FT_Driver_Class ) t1_driver_class; + FT_EXPORT_VAR( const FT_Driver_Class ) t1_driver_class; #ifdef __cplusplus }