Formatting, fixing descriptions.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index 4700830..ca99034 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -458,9 +458,9 @@
/* glyph from the font. Thus, bbox.yMax can */
/* be seen as the `maximal ascender', */
/* 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 */
- /* with the maximum _advance_width_). Only */
+ /* with the maximal _advance_width_). Only */
/* relevant for scalable formats. */
/* */
/* units_per_EM :: The number of font units per EM square for */
@@ -496,13 +496,13 @@
/* `external leading'. Only relevant for */
/* 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 */
/* used to make word wrapping computations */
/* faster. Only relevant for scalable */
/* 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 */
/* relevant for vertical layouts, and should */
/* be set to the `height' for fonts that do */
@@ -536,14 +536,14 @@
/* */
/* 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 */
/* face. If this value cannot be known in */
/* advance, or if the face isn't scalable, */
/* this should be set to 0. Only relevant for */
/* 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 */
/* this face. If this value cannot be known */
/* in advance, or if the face isn't scalable, */
@@ -1730,7 +1730,7 @@
/* */
/* <Description> */
/* 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). */
/* */
/* This function isn't necessarily as fast as some processor specific */
@@ -1758,7 +1758,7 @@
/* */
/* <Description> */
/* 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. */
/* */
/* <Input> */
@@ -1791,7 +1791,7 @@
/* */
/* <Description> */
/* 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. */
/* */
/* <Input> */
@@ -1921,9 +1921,9 @@
/* outline will NOT necessarily be FREED when */
/* 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> */
/* outline :: A handle to the new outline. NULL in case of */
diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c
index 33b9665..ddc6946 100644
--- a/src/base/ftcalc.c
+++ b/src/base/ftcalc.c
@@ -30,6 +30,7 @@
/* */
/*************************************************************************/
+
#include <freetype/internal/ftcalc.h>
#include <freetype/internal/ftdebug.h>
#include <freetype/internal/ftobjs.h> /* for ABS() */
@@ -53,7 +54,9 @@
536870912, 759250125, 1073741824, 1518500250,
2147483647
};
+
#else
+
/*************************************************************************/
/* */
/* <Function> */
@@ -69,13 +72,13 @@
/* <Return> */
/* 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;
root = 0;
- mask = 0x40000000;
+ mask = 0x40000000L;
val = (FT_ULong)x;
do
@@ -94,10 +97,11 @@
return root;
}
+
#endif /* OLD_CALCS */
-#ifdef LONG64
+#ifdef LONG64
/*************************************************************************/
/* */
@@ -106,7 +110,7 @@
/* */
/* <Description> */
/* 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). */
/* */
/* This function isn't necessarily as fast as some processor specific */
@@ -119,12 +123,12 @@
/* */
/* <Return> */
/* The result of `(a*b)/c'. This function never traps when trying to */
- /* divide by zero, it simply returns `MaxInt' or `MinInt' depending */
+ /* divide by zero; it simply returns `MaxInt' or `MinInt' depending */
/* on the signs of `a' and `b'. */
/* */
- FT_EXPORT_FUNC(FT_Long) FT_MulDiv( FT_Long a,
- FT_Long b,
- FT_Long c )
+ FT_EXPORT_FUNC( FT_Long ) FT_MulDiv( FT_Long a,
+ FT_Long b,
+ FT_Long c )
{
FT_Int s;
@@ -145,7 +149,7 @@
/* */
/* <Description> */
/* 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. */
/* */
/* <Input> */
@@ -167,8 +171,8 @@
/* _second_ argument of this function; this can make a great */
/* difference. */
/* */
- FT_EXPORT_FUNC(FT_Long) FT_MulFix( FT_Long a,
- FT_Long b )
+ FT_EXPORT_FUNC( FT_Long ) FT_MulFix( FT_Long a,
+ FT_Long b )
{
FT_Int s;
@@ -188,7 +192,7 @@
/* */
/* <Description> */
/* 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. */
/* */
/* <Input> */
@@ -204,8 +208,8 @@
/* 32 bits, then the division is computed directly. Otherwise, we */
/* use a specialized version of the old FT_MulDiv64(). */
/* */
- FT_EXPORT_FUNC(FT_Long) FT_DivFix( FT_Long a,
- FT_Long b )
+ FT_EXPORT_FUNC( FT_Long ) FT_DivFix( FT_Long a,
+ FT_Long b )
{
FT_Int32 s;
FT_Word32 q;
@@ -216,8 +220,7 @@
if ( b == 0 )
/* check for divide by 0 */
- q = 0x7FFFFFFF;
-
+ q = 0x7FFFFFFFL;
else
/* compute result directly */
q = ((FT_Int64)a << 16) / b;
@@ -227,41 +230,45 @@
#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> */
/* FT_Sqrt64 */
/* */
/* <Description> */
- /* Computes the square root of a 64-bits value ! Yeah, that sounds */
- /* stupid, but it's needed to obtain maximum accuracy in the */
- /* TrueType bytecode interpreter.. */
+ /* 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. */
/* */
/* <Input> */
- /* l :: 64-bits integer */
+ /* l :: 64-bit integer */
/* */
/* <Return> */
/* The 32-bit square-root. */
/* */
-
- 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_EXPORT_FUNC( FT_Int32 ) FT_Sqrt64( FT_Int64 l )
{
FT_Int64 r, s;
+
if ( l <= 0 ) return 0;
if ( l == 1 ) return 1;
@@ -276,7 +283,8 @@
return r;
}
-#endif
+
+#endif /* FT_CONFIG_OPTION_OLD_CALCS */
#else /* LONG64 */
@@ -289,7 +297,7 @@
/* */
/* <Description> */
/* 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). */
/* */
/* This function isn't necessarily as fast as some processor specific */
@@ -302,7 +310,7 @@
/* */
/* <Return> */
/* The result of `(a*b)/c'. This function never traps when trying to */
- /* divide by zero, it simply returns `MaxInt' or `MinInt' depending */
+ /* divide by zero; it simply returns `MaxInt' or `MinInt' depending */
/* on the signs of `a' and `b'. */
/* */
/* <Note> */
@@ -322,9 +330,9 @@
/* */
/* and 2*0x157F0 = 176096. */
/* */
- FT_EXPORT_FUNC(FT_Long) FT_MulDiv( FT_Long a,
- FT_Long b,
- FT_Long c )
+ FT_EXPORT_FUNC( FT_Long ) FT_MulDiv( FT_Long a,
+ FT_Long b,
+ FT_Long c )
{
long s;
@@ -363,7 +371,7 @@
/* */
/* <Description> */
/* 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. */
/* */
/* <Input> */
@@ -387,12 +395,13 @@
/* idea is to use bounds like 2048 and 1048576 (=floor((2^31-1)/2048) */
/* for `a' and `b', respectively. */
/* */
- FT_EXPORT_FUNC(FT_Long) FT_MulFix( FT_Long a,
- FT_Long b )
+ FT_EXPORT_FUNC( FT_Long ) FT_MulFix( FT_Long a,
+ FT_Long b )
{
FT_Long s;
FT_ULong ua, ub;
+
if ( a == 0 || b == 0x10000L )
return a;
@@ -425,8 +434,8 @@
/* */
/* <Description> */
/* A very simple function used to perform the computation */
- /* `(a*0x10000)/b' with maximum accuracy. Most of the time, this is */
- /* used to divide a given value by a 16.16 fixed float factor. */
+ /* `(a*0x10000)/b' with maximal accuracy. Most of the time, this is */
+ /* used to divide a given value by a 16.16 fixed float factor. */
/* */
/* <Input> */
/* a :: The first multiplier. */
@@ -441,8 +450,8 @@
/* 32 bits, then the division is computed directly. Otherwise, we */
/* use a specialized version of the old FT_MulDiv64(). */
/* */
- FT_EXPORT_FUNC(FT_Long) FT_DivFix( FT_Long a,
- FT_Long b )
+ FT_EXPORT_FUNC( FT_Long ) FT_DivFix( FT_Long a,
+ FT_Long b )
{
FT_Int32 s;
FT_Word32 q;
@@ -453,8 +462,7 @@
if ( b == 0 )
/* check for divide by 0 */
- q = 0x7FFFFFFF;
-
+ q = 0x7FFFFFFFL;
else if ( (a >> 16) == 0 )
{
/* compute result directly */
@@ -502,12 +510,13 @@
/* <Note> */
/* Will be wrapped by the ADD_64() macro. */
/* */
- FT_EXPORT_FUNC(void) FT_Add64( FT_Int64* x,
- FT_Int64* y,
- FT_Int64* z )
+ FT_EXPORT_FUNC( void ) FT_Add64( FT_Int64* x,
+ FT_Int64* y,
+ FT_Int64* z )
{
register FT_Word32 lo, hi;
+
lo = x->lo + y->lo;
hi = x->hi + y->hi + ( lo < x->lo );
@@ -522,7 +531,7 @@
/* FT_MulTo64 */
/* */
/* <Description> */
- /* Multiplies two Int32 integers. Returns a Int64 integer. */
+ /* Multiplies two Int32 integers. Returns an Int64 integer. */
/* */
/* <Input> */
/* x :: The first multiplier. */
@@ -534,9 +543,9 @@
/* <Note> */
/* Will be wrapped by the MUL_64() macro. */
/* */
- FT_EXPORT_FUNC(void) FT_MulTo64( FT_Int32 x,
- FT_Int32 y,
- FT_Int64* z )
+ FT_EXPORT_FUNC( void ) FT_MulTo64( FT_Int32 x,
+ FT_Int32 y,
+ FT_Int64* z )
{
FT_Int32 s;
@@ -599,8 +608,8 @@
/* <Note> */
/* Will be wrapped by the DIV_64() macro. */
/* */
- FT_EXPORT_FUNC(FT_Int32) FT_Div64by32( FT_Int64* x,
- FT_Int32 y )
+ FT_EXPORT_FUNC( FT_Int32 ) FT_Div64by32( FT_Int64* x,
+ FT_Int32 y )
{
FT_Int32 s;
FT_Word32 q, r, i, lo;
@@ -649,8 +658,13 @@
#ifdef FT_CONFIG_OPTION_OLD_CALCS
+
+ /* two helper functions for FT_Sqrt64() */
+
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;
@@ -662,53 +676,54 @@
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> */
/* FT_Sqrt64 */
/* */
/* <Description> */
- /* Computes the square root of a 64-bits value ! Yeah, that sounds */
- /* stupid, but it's needed to obtain maximum accuracy in the */
- /* TrueType bytecode interpreter.. */
+ /* 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. */
/* */
/* <Input> */
- /* z :: pointer to 64-bits integer */
+ /* z :: A pointer to a 64-bit integer. */
/* */
/* <Return> */
/* The 32-bit square-root. */
/* */
-
- 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_EXPORT_FUNC( FT_Int32 ) FT_Sqrt64( FT_Int64* l )
{
FT_Int64 l2;
FT_Int32 r, s;
- if ( (FT_Int32)l->hi < 0 ||
- (l->hi == 0 && l->lo == 0) ) return 0;
+ if ( (FT_Int32)l->hi < 0 ||
+ (l->hi == 0 && l->lo == 0) )
+ return 0;
s = ft_order64( l );
if ( s == 0 ) return 1;