Formatting, fixing descriptions.

This commit is contained in:
Werner Lemberg 2000-05-29 20:46:12 +00:00
parent b1677a87ca
commit a519b3b7a3
2 changed files with 117 additions and 102 deletions

View File

@ -458,9 +458,9 @@
/* glyph from the font. Thus, bbox.yMax can */ /* glyph from the font. Thus, bbox.yMax can */
/* be seen as the `maximal ascender', */ /* be seen as the `maximal ascender', */
/* bbox.yMin as the `minimal descender', and */ /* bbox.yMin as the `minimal descender', and */
/* the maximum glyph width is given by */ /* the maximal glyph width is given by */
/* `bbox.xMax-bbox.xMin' (not to be confused */ /* `bbox.xMax-bbox.xMin' (not to be confused */
/* with the maximum _advance_width_). Only */ /* with the maximal _advance_width_). Only */
/* relevant for scalable formats. */ /* relevant for scalable formats. */
/* */ /* */
/* units_per_EM :: The number of font units per EM square for */ /* units_per_EM :: The number of font units per EM square for */
@ -496,13 +496,13 @@
/* `external leading'. Only relevant for */ /* `external leading'. Only relevant for */
/* scalable formats. */ /* scalable formats. */
/* */ /* */
/* max_advance_width :: The maximum advance width, in font units, */ /* max_advance_width :: The maximal advance width, in font units, */
/* for all glyphs in this face. This can be */ /* for all glyphs in this face. This can be */
/* used to make word wrapping computations */ /* used to make word wrapping computations */
/* faster. Only relevant for scalable */ /* faster. Only relevant for scalable */
/* formats. */ /* formats. */
/* */ /* */
/* max_advance_height :: The maximum advance height, in font units, */ /* max_advance_height :: The maximal advance height, in font units, */
/* for all glyphs in this face. This is only */ /* for all glyphs in this face. This is only */
/* relevant for vertical layouts, and should */ /* relevant for vertical layouts, and should */
/* be set to the `height' for fonts that do */ /* be set to the `height' for fonts that do */
@ -536,14 +536,14 @@
/* */ /* */
/* sizes_list :: The list of child sizes for this face. */ /* sizes_list :: The list of child sizes for this face. */
/* */ /* */
/* max_points :: The maximum number of points used to store */ /* max_points :: The maximal number of points used to store */
/* the vectorial outline of any glyph in this */ /* the vectorial outline of any glyph in this */
/* face. If this value cannot be known in */ /* face. If this value cannot be known in */
/* advance, or if the face isn't scalable, */ /* advance, or if the face isn't scalable, */
/* this should be set to 0. Only relevant for */ /* this should be set to 0. Only relevant for */
/* scalable formats. */ /* scalable formats. */
/* */ /* */
/* max_contours :: The maximum number of contours used to */ /* max_contours :: The maximal number of contours used to */
/* store the vectorial outline of any glyph in */ /* store the vectorial outline of any glyph in */
/* this face. If this value cannot be known */ /* this face. If this value cannot be known */
/* in advance, or if the face isn't scalable, */ /* in advance, or if the face isn't scalable, */
@ -1730,7 +1730,7 @@
/* */ /* */
/* <Description> */ /* <Description> */
/* A very simple function used to perform the computation `(A*B)/C' */ /* A very simple function used to perform the computation `(A*B)/C' */
/* with maximum accuracy (it uses a 64-bit intermediate integer */ /* with maximal accuracy (it uses a 64-bit intermediate integer */
/* whenever necessary). */ /* whenever necessary). */
/* */ /* */
/* This function isn't necessarily as fast as some processor specific */ /* This function isn't necessarily as fast as some processor specific */
@ -1758,7 +1758,7 @@
/* */ /* */
/* <Description> */ /* <Description> */
/* A very simple function used to perform the computation */ /* A very simple function used to perform the computation */
/* `(A*B)/0x10000' with maximum 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. */ /* used to multiply a given value by a 16.16 fixed float factor. */
/* */ /* */
/* <Input> */ /* <Input> */
@ -1791,7 +1791,7 @@
/* */ /* */
/* <Description> */ /* <Description> */
/* A very simple function used to perform the computation */ /* A very simple function used to perform the computation */
/* `(A*0x10000)/B' with maximum accuracy. Most of the time, this is */ /* `(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. */ /* used to divide a given value by a 16.16 fixed float factor. */
/* */ /* */
/* <Input> */ /* <Input> */
@ -1921,9 +1921,9 @@
/* outline will NOT necessarily be FREED when */ /* outline will NOT necessarily be FREED when */
/* destroying the library, by FT_Done_FreeType(). */ /* destroying the library, by FT_Done_FreeType(). */
/* */ /* */
/* numPoints :: The maximum number of points within the outline. */ /* numPoints :: The maximal number of points within the outline. */
/* */ /* */
/* numContours :: The maximum number of contours within the outline. */ /* numContours :: The maximal number of contours within the outline. */
/* */ /* */
/* <Output> */ /* <Output> */
/* outline :: A handle to the new outline. NULL in case of */ /* outline :: A handle to the new outline. NULL in case of */

View File

@ -30,6 +30,7 @@
/* */ /* */
/*************************************************************************/ /*************************************************************************/
#include <freetype/internal/ftcalc.h> #include <freetype/internal/ftcalc.h>
#include <freetype/internal/ftdebug.h> #include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftobjs.h> /* for ABS() */ #include <freetype/internal/ftobjs.h> /* for ABS() */
@ -53,7 +54,9 @@
536870912, 759250125, 1073741824, 1518500250, 536870912, 759250125, 1073741824, 1518500250,
2147483647 2147483647
}; };
#else #else
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Function> */ /* <Function> */
@ -69,13 +72,13 @@
/* <Return> */ /* <Return> */
/* The result of `sqrt(x)'. */ /* The result of `sqrt(x)'. */
/* */ /* */
FT_EXPORT_FUNC(FT_Int32) FT_Sqrt32( FT_Int32 x ) FT_EXPORT_FUNC( FT_Int32 ) FT_Sqrt32( FT_Int32 x )
{ {
FT_ULong val, root, newroot, mask; FT_ULong val, root, newroot, mask;
root = 0; root = 0;
mask = 0x40000000; mask = 0x40000000L;
val = (FT_ULong)x; val = (FT_ULong)x;
do do
@ -94,10 +97,11 @@
return root; return root;
} }
#endif /* OLD_CALCS */ #endif /* OLD_CALCS */
#ifdef LONG64
#ifdef LONG64
/*************************************************************************/ /*************************************************************************/
/* */ /* */
@ -106,7 +110,7 @@
/* */ /* */
/* <Description> */ /* <Description> */
/* A very simple function used to perform the computation `(a*b)/c' */ /* A very simple function used to perform the computation `(a*b)/c' */
/* with maximum accuracy (it uses a 64-bit intermediate integer */ /* with maximal accuracy (it uses a 64-bit intermediate integer */
/* whenever necessary). */ /* whenever necessary). */
/* */ /* */
/* This function isn't necessarily as fast as some processor specific */ /* This function isn't necessarily as fast as some processor specific */
@ -119,12 +123,12 @@
/* */ /* */
/* <Return> */ /* <Return> */
/* The result of `(a*b)/c'. This function never traps when trying to */ /* 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'. */ /* on the signs of `a' and `b'. */
/* */ /* */
FT_EXPORT_FUNC(FT_Long) FT_MulDiv( FT_Long a, FT_EXPORT_FUNC( FT_Long ) FT_MulDiv( FT_Long a,
FT_Long b, FT_Long b,
FT_Long c ) FT_Long c )
{ {
FT_Int s; FT_Int s;
@ -145,7 +149,7 @@
/* */ /* */
/* <Description> */ /* <Description> */
/* A very simple function used to perform the computation */ /* A very simple function used to perform the computation */
/* `(a*b)/0x10000' with maximum 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. */ /* used to multiply a given value by a 16.16 fixed float factor. */
/* */ /* */
/* <Input> */ /* <Input> */
@ -167,8 +171,8 @@
/* _second_ argument of this function; this can make a great */ /* _second_ argument of this function; this can make a great */
/* difference. */ /* difference. */
/* */ /* */
FT_EXPORT_FUNC(FT_Long) FT_MulFix( FT_Long a, FT_EXPORT_FUNC( FT_Long ) FT_MulFix( FT_Long a,
FT_Long b ) FT_Long b )
{ {
FT_Int s; FT_Int s;
@ -188,7 +192,7 @@
/* */ /* */
/* <Description> */ /* <Description> */
/* A very simple function used to perform the computation */ /* A very simple function used to perform the computation */
/* `(a*0x10000)/b' with maximum accuracy. Most of the time, this is */ /* `(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. */ /* used to divide a given value by a 16.16 fixed float factor. */
/* */ /* */
/* <Input> */ /* <Input> */
@ -204,8 +208,8 @@
/* 32 bits, then the division is computed directly. Otherwise, we */ /* 32 bits, then the division is computed directly. Otherwise, we */
/* use a specialized version of the old FT_MulDiv64(). */ /* use a specialized version of the old FT_MulDiv64(). */
/* */ /* */
FT_EXPORT_FUNC(FT_Long) FT_DivFix( FT_Long a, FT_EXPORT_FUNC( FT_Long ) FT_DivFix( FT_Long a,
FT_Long b ) FT_Long b )
{ {
FT_Int32 s; FT_Int32 s;
FT_Word32 q; FT_Word32 q;
@ -216,8 +220,7 @@
if ( b == 0 ) if ( b == 0 )
/* check for divide by 0 */ /* check for divide by 0 */
q = 0x7FFFFFFF; q = 0x7FFFFFFFL;
else else
/* compute result directly */ /* compute result directly */
q = ((FT_Int64)a << 16) / b; q = ((FT_Int64)a << 16) / b;
@ -227,41 +230,45 @@
#ifdef FT_CONFIG_OPTION_OLD_CALCS #ifdef FT_CONFIG_OPTION_OLD_CALCS
/* a helper function for FT_Sqrt64() */
static
int ft_order64( FT_Int64 z )
{
int j = 0;
while ( z )
{
z = (unsigned INT64)z >> 1;
j++;
}
return j - 1;
}
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Function> */ /* <Function> */
/* FT_Sqrt64 */ /* FT_Sqrt64 */
/* */ /* */
/* <Description> */ /* <Description> */
/* Computes the square root of a 64-bits value ! Yeah, that sounds */ /* Computes the square root of a 64-bit value. That sounds stupid, */
/* stupid, but it's needed to obtain maximum accuracy in the */ /* but it is needed to obtain maximal accuracy in the TrueType */
/* TrueType bytecode interpreter.. */ /* bytecode interpreter. */
/* */ /* */
/* <Input> */ /* <Input> */
/* l :: 64-bits integer */ /* l :: 64-bit integer */
/* */ /* */
/* <Return> */ /* <Return> */
/* The 32-bit square-root. */ /* The 32-bit square-root. */
/* */ /* */
FT_EXPORT_FUNC( FT_Int32 ) FT_Sqrt64( FT_Int64 l )
static
int ft_order64( FT_Int64 z )
{
int j = 0;
while ( z )
{
z = (unsigned INT64)z >> 1;
j++;
}
return j - 1;
}
FT_EXPORT_FUNC(FT_Int32) FT_Sqrt64( FT_Int64 l )
{ {
FT_Int64 r, s; FT_Int64 r, s;
if ( l <= 0 ) return 0; if ( l <= 0 ) return 0;
if ( l == 1 ) return 1; if ( l == 1 ) return 1;
@ -276,7 +283,8 @@
return r; return r;
} }
#endif
#endif /* FT_CONFIG_OPTION_OLD_CALCS */
#else /* LONG64 */ #else /* LONG64 */
@ -289,7 +297,7 @@
/* */ /* */
/* <Description> */ /* <Description> */
/* A very simple function used to perform the computation `(a*b)/c' */ /* A very simple function used to perform the computation `(a*b)/c' */
/* with maximum accuracy (it uses a 64-bit intermediate integer */ /* with maximal accuracy (it uses a 64-bit intermediate integer */
/* whenever necessary). */ /* whenever necessary). */
/* */ /* */
/* This function isn't necessarily as fast as some processor specific */ /* This function isn't necessarily as fast as some processor specific */
@ -302,7 +310,7 @@
/* */ /* */
/* <Return> */ /* <Return> */
/* The result of `(a*b)/c'. This function never traps when trying to */ /* 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'. */ /* on the signs of `a' and `b'. */
/* */ /* */
/* <Note> */ /* <Note> */
@ -322,9 +330,9 @@
/* */ /* */
/* and 2*0x157F0 = 176096. */ /* and 2*0x157F0 = 176096. */
/* */ /* */
FT_EXPORT_FUNC(FT_Long) FT_MulDiv( FT_Long a, FT_EXPORT_FUNC( FT_Long ) FT_MulDiv( FT_Long a,
FT_Long b, FT_Long b,
FT_Long c ) FT_Long c )
{ {
long s; long s;
@ -363,7 +371,7 @@
/* */ /* */
/* <Description> */ /* <Description> */
/* A very simple function used to perform the computation */ /* A very simple function used to perform the computation */
/* `(a*b)/0x10000' with maximum 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. */ /* used to multiply a given value by a 16.16 fixed float factor. */
/* */ /* */
/* <Input> */ /* <Input> */
@ -387,12 +395,13 @@
/* idea is to use bounds like 2048 and 1048576 (=floor((2^31-1)/2048) */ /* idea is to use bounds like 2048 and 1048576 (=floor((2^31-1)/2048) */
/* for `a' and `b', respectively. */ /* for `a' and `b', respectively. */
/* */ /* */
FT_EXPORT_FUNC(FT_Long) FT_MulFix( FT_Long a, FT_EXPORT_FUNC( FT_Long ) FT_MulFix( FT_Long a,
FT_Long b ) FT_Long b )
{ {
FT_Long s; FT_Long s;
FT_ULong ua, ub; FT_ULong ua, ub;
if ( a == 0 || b == 0x10000L ) if ( a == 0 || b == 0x10000L )
return a; return a;
@ -425,8 +434,8 @@
/* */ /* */
/* <Description> */ /* <Description> */
/* A very simple function used to perform the computation */ /* A very simple function used to perform the computation */
/* `(a*0x10000)/b' with maximum accuracy. Most of the time, this is */ /* `(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. */ /* used to divide a given value by a 16.16 fixed float factor. */
/* */ /* */
/* <Input> */ /* <Input> */
/* a :: The first multiplier. */ /* a :: The first multiplier. */
@ -441,8 +450,8 @@
/* 32 bits, then the division is computed directly. Otherwise, we */ /* 32 bits, then the division is computed directly. Otherwise, we */
/* use a specialized version of the old FT_MulDiv64(). */ /* use a specialized version of the old FT_MulDiv64(). */
/* */ /* */
FT_EXPORT_FUNC(FT_Long) FT_DivFix( FT_Long a, FT_EXPORT_FUNC( FT_Long ) FT_DivFix( FT_Long a,
FT_Long b ) FT_Long b )
{ {
FT_Int32 s; FT_Int32 s;
FT_Word32 q; FT_Word32 q;
@ -453,8 +462,7 @@
if ( b == 0 ) if ( b == 0 )
/* check for divide by 0 */ /* check for divide by 0 */
q = 0x7FFFFFFF; q = 0x7FFFFFFFL;
else if ( (a >> 16) == 0 ) else if ( (a >> 16) == 0 )
{ {
/* compute result directly */ /* compute result directly */
@ -502,12 +510,13 @@
/* <Note> */ /* <Note> */
/* Will be wrapped by the ADD_64() macro. */ /* Will be wrapped by the ADD_64() macro. */
/* */ /* */
FT_EXPORT_FUNC(void) FT_Add64( FT_Int64* x, FT_EXPORT_FUNC( void ) FT_Add64( FT_Int64* x,
FT_Int64* y, FT_Int64* y,
FT_Int64* z ) FT_Int64* z )
{ {
register FT_Word32 lo, hi; register FT_Word32 lo, hi;
lo = x->lo + y->lo; lo = x->lo + y->lo;
hi = x->hi + y->hi + ( lo < x->lo ); hi = x->hi + y->hi + ( lo < x->lo );
@ -522,7 +531,7 @@
/* FT_MulTo64 */ /* FT_MulTo64 */
/* */ /* */
/* <Description> */ /* <Description> */
/* Multiplies two Int32 integers. Returns a Int64 integer. */ /* Multiplies two Int32 integers. Returns an Int64 integer. */
/* */ /* */
/* <Input> */ /* <Input> */
/* x :: The first multiplier. */ /* x :: The first multiplier. */
@ -534,9 +543,9 @@
/* <Note> */ /* <Note> */
/* Will be wrapped by the MUL_64() macro. */ /* Will be wrapped by the MUL_64() macro. */
/* */ /* */
FT_EXPORT_FUNC(void) FT_MulTo64( FT_Int32 x, FT_EXPORT_FUNC( void ) FT_MulTo64( FT_Int32 x,
FT_Int32 y, FT_Int32 y,
FT_Int64* z ) FT_Int64* z )
{ {
FT_Int32 s; FT_Int32 s;
@ -599,8 +608,8 @@
/* <Note> */ /* <Note> */
/* Will be wrapped by the DIV_64() macro. */ /* Will be wrapped by the DIV_64() macro. */
/* */ /* */
FT_EXPORT_FUNC(FT_Int32) FT_Div64by32( FT_Int64* x, FT_EXPORT_FUNC( FT_Int32 ) FT_Div64by32( FT_Int64* x,
FT_Int32 y ) FT_Int32 y )
{ {
FT_Int32 s; FT_Int32 s;
FT_Word32 q, r, i, lo; FT_Word32 q, r, i, lo;
@ -649,8 +658,13 @@
#ifdef FT_CONFIG_OPTION_OLD_CALCS #ifdef FT_CONFIG_OPTION_OLD_CALCS
/* two helper functions for FT_Sqrt64() */
static static
void FT_Sub64( FT_Int64* x, FT_Int64* y, FT_Int64* z ) void FT_Sub64( FT_Int64* x,
FT_Int64* y,
FT_Int64* z )
{ {
register FT_Word32 lo, hi; register FT_Word32 lo, hi;
@ -662,53 +676,54 @@
z->hi = hi; z->hi = hi;
} }
static
int ft_order64( FT_Int64* z )
{
FT_Word32 i;
int j;
i = z->lo;
j = 0;
if ( z->hi )
{
i = z->hi;
j = 32;
}
while ( i > 0 )
{
i >>= 1;
j++;
}
return j - 1;
}
/*************************************************************************/ /*************************************************************************/
/* */ /* */
/* <Function> */ /* <Function> */
/* FT_Sqrt64 */ /* FT_Sqrt64 */
/* */ /* */
/* <Description> */ /* <Description> */
/* Computes the square root of a 64-bits value ! Yeah, that sounds */ /* Computes the square root of a 64-bits value. That sounds stupid, */
/* stupid, but it's needed to obtain maximum accuracy in the */ /* but it is needed to obtain maximal accuracy in the TrueType */
/* TrueType bytecode interpreter.. */ /* bytecode interpreter. */
/* */ /* */
/* <Input> */ /* <Input> */
/* z :: pointer to 64-bits integer */ /* z :: A pointer to a 64-bit integer. */
/* */ /* */
/* <Return> */ /* <Return> */
/* The 32-bit square-root. */ /* The 32-bit square-root. */
/* */ /* */
FT_EXPORT_FUNC( FT_Int32 ) FT_Sqrt64( FT_Int64* l )
static
int ft_order64( FT_Int64* z )
{
FT_Word32 i;
int j;
i = z->lo;
j = 0;
if ( z->hi )
{
i = z->hi;
j = 32;
}
while ( i > 0 )
{
i >>= 1;
j++;
}
return j-1;
}
FT_EXPORT_FUNC(FT_Int32) FT_Sqrt64( FT_Int64* l )
{ {
FT_Int64 l2; FT_Int64 l2;
FT_Int32 r, s; FT_Int32 r, s;
if ( (FT_Int32)l->hi < 0 || if ( (FT_Int32)l->hi < 0 ||
(l->hi == 0 && l->lo == 0) ) return 0; (l->hi == 0 && l->lo == 0) )
return 0;
s = ft_order64( l ); s = ft_order64( l );
if ( s == 0 ) return 1; if ( s == 0 ) return 1;