More preparation for tracing. Formatting.
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 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603
diff --git a/include/freetype/internal/ftdebug.h b/include/freetype/internal/ftdebug.h
index 1a827bf..23d2a15 100644
--- a/include/freetype/internal/ftdebug.h
+++ b/include/freetype/internal/ftdebug.h
@@ -41,19 +41,27 @@
#ifdef FT_DEBUG_LEVEL_TRACE
+ /* note that not all levels are used currently */
+
typedef enum FT_Trace_
{
/* the first level must always be `trace_any' */
trace_any = 0,
- /* we start with an enum for each common component */
- trace_io, /* i/o monitoring -- see ftsystem.c */
- trace_memory, /* memory manager -- see ftobjs.c */
- trace_stream, /* stream manager -- see ftstream.c */
- trace_calc, /* computations -- see ftcalc.c */
- trace_raster, /* raster -- see ftraster.c */
- trace_list, /* list manager -- see ftlist.c */
- trace_objs, /* base objects -- see ftobjs.c */
+ /* we start with an enum for each base component */
+ trace_aaraster, /* anti-aliasing raster (ftgrays.c) */
+ trace_calc, /* calculations (ftcalc.c) */
+ trace_extend, /* extension manager (ftextend.c) */
+ trace_glyph, /* glyph manager (ftglyph.c) */
+ trace_io, /* i/o monitoring (ftsystem.c) */
+ trace_init, /* initialization (ftinit.c) */
+ trace_list, /* list manager (ftlist.c) */
+ trace_memory, /* memory manager (ftobjs.c) */
+ trace_mm, /* MM interface (ftmm.c) */
+ trace_objs, /* base objects (ftobjs.c) */
+ trace_outline, /* outline management (ftoutln.c) */
+ trace_raster, /* raster (ftraster.c) */
+ trace_stream, /* stream manager (ftstream.c) */
/* then define an enum for each TrueType driver component */
trace_ttobjs,
@@ -64,7 +72,7 @@
trace_ttextend,
trace_ttdriver,
- /* define an enum for each Type1 driver component */
+ /* define an enum for each Type 1 driver component */
trace_t1objs,
trace_t1load,
trace_t1gload,
@@ -72,8 +80,6 @@
trace_t1driver,
/* other trace levels */
- trace_init,
- trace_extend,
/* the last level must always be `trace_max' */
trace_max
@@ -88,37 +94,37 @@
/* */
/* IMPORTANT! */
/* */
- /* Each component must define the macro FT_COMPONENT to a valid */
- /* Trace_Component value before using any TRACE macro. */
+ /* Each component must define the macro FT_COMPONENT to a valid FT_Trace */
+ /* value before using any TRACE macro. */
/* */
/*************************************************************************/
-#define FT_TRACE( level, varformat ) \
- do \
- { \
- if ( ft_trace_levels[FT_COMPONENT] >= level ) \
- FT_XCAT( FT_Message, varformat ); \
+#define FT_TRACE( level, varformat ) \
+ do \
+ { \
+ if ( ft_trace_levels[FT_COMPONENT] >= level ) \
+ FT_XCAT( FT_Message, varformat ); \
} while ( 0 )
- FT_EXPORT_DEF(void) FT_SetTraceLevel( FT_Trace component,
- char level );
+ FT_EXPORT_DEF( void ) FT_SetTraceLevel( FT_Trace component,
+ char level );
#elif defined( FT_DEBUG_LEVEL_ERROR )
-#define FT_TRACE( level, varformat ) while ( 0 ) { } /* nothing */
+#define FT_TRACE( level, varformat ) do ; while ( 0 ) /* nothing */
#else /* release mode */
-#define FT_Assert( condition ) while ( 0 ) { } /* nothing */
+#define FT_Assert( condition ) do ; while ( 0 ) /* nothing */
-#define FT_TRACE( level, varformat ) while ( 0 ) { } /* nothing */
-#define FT_ERROR( varformat ) while ( 0 ) { } /* nothing */
+#define FT_TRACE( level, varformat ) do ; while ( 0 ) /* nothing */
+#define FT_ERROR( varformat ) do ; while ( 0 ) /* nothing */
#endif /* FT_DEBUG_LEVEL_TRACE, FT_DEBUG_LEVEL_ERROR */
@@ -133,11 +139,13 @@
/* */
/*************************************************************************/
+
#if defined( FT_DEBUG_LEVEL_TRACE ) || defined( FT_DEBUG_LEVEL_ERROR )
#include "stdio.h" /* for vprintf() */
+
#define FT_Assert( condition ) \
do \
{ \
@@ -147,19 +155,24 @@
} while ( 0 )
/* print a message */
- FT_EXPORT_DEF(void) FT_Message( const char* fmt, ... );
+ FT_EXPORT_DEF( void ) FT_Message( const char* fmt, ... );
/* print a message and exit */
- FT_EXPORT_DEF(void) FT_Panic ( const char* fmt, ... );
+ FT_EXPORT_DEF( void ) FT_Panic ( const char* fmt, ... );
-#define FT_ERROR(varformat) do { FT_XCAT( FT_Message, varformat ); } while(0)
+#define FT_ERROR( varformat ) FT_XCAT( FT_Message, varformat )
#endif /* FT_DEBUG_LEVEL_TRACE || FT_DEBUG_LEVEL_ERROR */
-/* you need two opening resp. closing parentheses!
- Example: FT_TRACE0(( "Value is %i", foo )) */
+ /*************************************************************************/
+ /* */
+ /* You need two opening resp. closing parentheses! */
+ /* */
+ /* Example: FT_TRACE0(( "Value is %i", foo )) */
+ /* */
+ /*************************************************************************/
#define FT_TRACE0( varformat ) FT_TRACE( 0, varformat )
#define FT_TRACE1( varformat ) FT_TRACE( 1, varformat )
diff --git a/src/base/ftcalc.c b/src/base/ftcalc.c
index b370a8a..39cf6ac 100644
--- a/src/base/ftcalc.c
+++ b/src/base/ftcalc.c
@@ -36,6 +36,16 @@
#include <freetype/internal/ftobjs.h> /* for ABS() */
+ /*************************************************************************/
+ /* */
+ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
+ /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
+ /* messages during execution. */
+ /* */
+#undef FT_COMPONENT
+#define FT_COMPONENT trace_calc
+
+
#ifdef FT_CONFIG_OPTION_OLD_CALCS
static const FT_Long ft_square_roots[63] =
diff --git a/src/base/ftglyph.c b/src/base/ftglyph.c
index 3f55748..6bbad90 100644
--- a/src/base/ftglyph.c
+++ b/src/base/ftglyph.c
@@ -32,6 +32,16 @@
#include <freetype/internal/ftobjs.h>
+ /*************************************************************************/
+ /* */
+ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
+ /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
+ /* messages during execution. */
+ /* */
+#undef FT_COMPONENT
+#define FT_COMPONENT trace_glyph
+
+
static
void ft_prepare_glyph( FT_Glyph glyph,
FT_Face face,
@@ -522,8 +532,8 @@
case ft_glyph_type_bitmap:
{
FT_BitmapGlyph bit = (FT_BitmapGlyph)glyph;
-
-
+
+
box->xMin = bit->left;
box->xMax = box->xMin + bit->bitmap.width;
box->yMax = bit->top;
diff --git a/src/base/ftgrays.c b/src/base/ftgrays.c
index 151ccec..44b240b 100644
--- a/src/base/ftgrays.c
+++ b/src/base/ftgrays.c
@@ -31,7 +31,7 @@
/* */
/* cc -c -D_STANDALONE_ ftgrays.c */
/* */
- /* The renderer can be initialised with a call to */
+ /* The renderer can be initialized with a call to */
/* `ft_grays_raster.grays_raster_new'; an anti-aliased bitmap can be */
/* generated with a call to `ft_grays_raster.grays_raster_render'. */
/* */
@@ -83,10 +83,23 @@
#include <string.h> /* for memcpy() */
+
+ /*************************************************************************/
+ /* */
+ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
+ /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
+ /* messages during execution. */
+ /* */
+#undef FT_COMPONENT
+#define FT_COMPONENT trace_aaraster
+
+
#define ErrRaster_Invalid_Outline -1
+
#ifdef _STANDALONE_
+
#include "ftimage.h"
#include "ftgrays.h"
@@ -94,16 +107,31 @@
/* Its purpose is simply to reduce compiler warnings. Note also that */
/* simply defining it as `(void)x' doesn't avoid warnings with certain */
/* ANSI compilers (e.g. LCC). */
-#define UNUSED( x ) (x) = (x)
+#define UNUSED( x ) (x) = (x)
+
+ /* Disable the tracing mechanism for simplicity -- developers can */
+ /* activate it easily by redefining these two macros. */
+#ifndef FT_ERROR
+#define FT_ERROR( x ) do ; while ( 0 ) /* nothing */
+#endif
+
+#ifndef FT_TRACE
+#define FT_TRACE( x ) do ; while ( 0 ) /* nothing */
+#endif
+
#else /* _STANDALONE_ */
+
#include <freetype/ftgrays.h>
-#include <freetype/internal/ftobjs.h> /* for UNUSED() */
-#include <freetype/freetype.h> /* to link to FT_Outline_Decompose() */
+#include <freetype/internal/ftobjs.h> /* for UNUSED() */
+#include <freetype/internal/ftdebug.h> /* for FT_TRACE() and FT_ERROR() */
+#include <freetype/freetype.h> /* for FT_Outline_Decompose() */
+
#endif /* _STANDALONE_ */
+
/* define this to dump debugging information */
#define xxxDEBUG_GRAYS
@@ -111,6 +139,7 @@
#ifndef FT_STATIC_RASTER
+
#define RAS_ARG PRaster raster
#define RAS_ARG_ PRaster raster,
@@ -119,8 +148,10 @@
#define ras (*raster)
+
#else /* FT_STATIC_RASTER */
+
#define RAS_ARG /* empty */
#define RAS_ARG_ /* empty */
#define RAS_VAR /* empty */
@@ -128,8 +159,10 @@
static TRaster ras;
+
#endif /* FT_STATIC_RASTER */
+
/* must be at least 6 bits! */
#define PIXEL_BITS 8
@@ -1841,7 +1874,7 @@
UNUSED( memory );
-
+
*araster = (FT_Raster)&the_raster;
memset( &the_raster, 0, sizeof ( the_raster ) );
diff --git a/src/base/ftlist.c b/src/base/ftlist.c
index d6dd9c2..3842fcb 100644
--- a/src/base/ftlist.c
+++ b/src/base/ftlist.c
@@ -30,6 +30,16 @@
/*************************************************************************/
/* */
+ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
+ /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
+ /* messages during execution. */
+ /* */
+#undef FT_COMPONENT
+#define FT_COMPONENT trace_list
+
+
+ /*************************************************************************/
+ /* */
/* <Function> */
/* FT_List_Find */
/* */
diff --git a/src/base/ftmm.c b/src/base/ftmm.c
index 66fa35d..78317a7 100644
--- a/src/base/ftmm.c
+++ b/src/base/ftmm.c
@@ -19,6 +19,17 @@
#include <freetype/ftmm.h>
#include <freetype/internal/ftobjs.h>
+
+ /*************************************************************************/
+ /* */
+ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
+ /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
+ /* messages during execution. */
+ /* */
+#undef FT_COMPONENT
+#define FT_COMPONENT trace_mm
+
+
FT_EXPORT_FUNC( FT_Error ) FT_Get_Multi_Master( FT_Face face,
FT_Multi_Master* master )
{
@@ -27,7 +38,7 @@
if ( !face )
return FT_Err_Invalid_Face_Handle;
-
+
error = FT_Err_Invalid_Argument;
if ( FT_HAS_MULTIPLE_MASTERS( face ) )
@@ -41,9 +52,9 @@
if ( func )
error = func( face, master );
}
-
+
return error;
- }
+ }
FT_EXPORT_FUNC( FT_Error ) FT_Set_MM_Design_Coordinates(
@@ -53,7 +64,7 @@
{
FT_Error error;
-
+
if ( !face )
return FT_Err_Invalid_Face_Handle;
@@ -70,19 +81,19 @@
if ( func )
error = func( face, num_coords, coords );
}
-
+
return error;
- }
+ }
FT_EXPORT_FUNC( FT_Error ) FT_Set_MM_Blend_Coordinates(
FT_Face face,
FT_UInt num_coords,
FT_Fixed* coords )
- {
+ {
FT_Error error;
-
+
if ( !face )
return FT_Err_Invalid_Face_Handle;
@@ -98,7 +109,7 @@
if ( func )
error = func( face, num_coords, coords );
}
-
+
return error;
}
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index beaa845..7090448 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -312,6 +312,11 @@
/*************************************************************************/
/*************************************************************************/
+
+#undef FT_COMPONENT
+#define FT_COMPONENT trace_objs
+
+
/* destructor for sizes list */
static
void destroy_size( FT_Memory memory,
@@ -1798,7 +1803,7 @@
pixel_width = pixel_height;
else if ( pixel_height == 0 )
pixel_height = pixel_width;
-
+
if ( pixel_width < 1 ) pixel_width = 1;
if ( pixel_height < 1 ) pixel_height = 1;
@@ -1978,7 +1983,7 @@
if ( glyph_index >= face->num_glyphs )
return FT_Err_Invalid_Argument;
-
+
driver = face->driver;
/* when the flag NO_RECURSE is set, we disable hinting and scaling */
diff --git a/src/base/ftoutln.c b/src/base/ftoutln.c
index 600efa4..53cc301 100644
--- a/src/base/ftoutln.c
+++ b/src/base/ftoutln.c
@@ -27,6 +27,17 @@
#include <freetype/config/ftconfig.h>
#include <freetype/internal/ftobjs.h>
+
+ /*************************************************************************/
+ /* */
+ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
+ /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
+ /* messages during execution. */
+ /* */
+#undef FT_COMPONENT
+#define FT_COMPONENT trace_outline
+
+
static
const FT_Outline null_outline = { 0, 0, 0, 0, 0, 0 };
diff --git a/src/base/ftraster.c b/src/base/ftraster.c
index 8f6f981..063f1d4 100644
--- a/src/base/ftraster.c
+++ b/src/base/ftraster.c
@@ -128,11 +128,45 @@
/*************************************************************************/
/*************************************************************************/
-/* required by the tracing mode */
+ /*************************************************************************/
+ /* */
+ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
+ /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
+ /* messages during execution. */
+ /* */
#undef FT_COMPONENT
#define FT_COMPONENT trace_raster
-#include <freetype/internal/ftdebug.h>
+
+#ifdef _STANDALONE_
+
+
+ /* This macro is used to indicate that a function parameter is unused. */
+ /* Its purpose is simply to reduce compiler warnings. Note also that */
+ /* simply defining it as `(void)x' doesn't avoid warnings with certain */
+ /* ANSI compilers (e.g. LCC). */
+#define UNUSED( x ) (x) = (x)
+
+ /* Disable the tracing mechanism for simplicity -- developers can */
+ /* activate it easily by redefining these two macros. */
+#ifndef FT_ERROR
+#define FT_ERROR( x ) do ; while ( 0 ) /* nothing */
+#endif
+
+#ifndef FT_TRACE
+#define FT_TRACE( x ) do ; while ( 0 ) /* nothing */
+#endif
+
+
+#else /* _STANDALONE_ */
+
+
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftdebug.h> /* for FT_TRACE() and FT_ERROR() */
+
+
+#endif /* _STANDALONE_ */
+
#define Raster_Err_None 0
#define Raster_Err_Not_Ini -1
@@ -583,7 +617,7 @@
if ( h > 0 )
{
FT_TRACE1(( "Ending profile %lx, start = %ld, height = %ld\n",
- (long)ras.cProfile, ras.cProfile->start, h ));
+ (long)ras.cProfile, ras.cProfile->start, h ));
oldProfile = ras.cProfile;
ras.cProfile->height = h;
@@ -1557,7 +1591,7 @@
v_last.x = SCALED( points[last].x );
v_last.y = SCALED( points[last].y );
- if ( flipped )
+ if ( flipped )
{
SWAP_( v_start.x, v_start.y );
SWAP_( v_last.x, v_last.y );
@@ -3087,6 +3121,7 @@
#ifdef _STANDALONE_
+
static
int ft_black_new( void* memory,
FT_Raster *araster )
@@ -3109,9 +3144,9 @@
raster->init = 0;
}
+
#else /* _STANDALONE_ */
-#include <freetype/internal/ftobjs.h>
static
int ft_black_new( FT_Memory memory,
@@ -3141,6 +3176,7 @@
FREE( raster );
}
+
#endif /* _STANDALONE_ */
diff --git a/src/base/ftstream.c b/src/base/ftstream.c
index 6f57347..dd33ec7 100644
--- a/src/base/ftstream.c
+++ b/src/base/ftstream.c
@@ -154,19 +154,19 @@
{
FT_Error error;
-
+
error = FT_Access_Frame( stream, count );
if ( !error )
{
*pbytes = (FT_Byte*)stream->cursor;
-
+
/* equivalent to FT_Forget_Frame(), with no memory block release */
stream->cursor = 0;
stream->limit = 0;
}
return error;
- }
+ }
BASE_FUNC( void ) FT_Release_Frame( FT_Stream stream,