Formatting. Fixed some errors which prevented compiling.
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 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710
diff --git a/include/freetype/ftoutln.h b/include/freetype/ftoutln.h
index d8f13d3..04a9ece 100644
--- a/include/freetype/ftoutln.h
+++ b/include/freetype/ftoutln.h
@@ -16,9 +16,18 @@
/* */
/***************************************************************************/
+
#ifndef FTOUTLN_H
#define FTOUTLN_H
+
+#include <freetype/freetype.h>
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+
/*************************************************************************/
/* */
/* <Function> */
@@ -307,6 +316,12 @@
FT_Raster_Params* params );
+#ifdef __cplusplus
+ }
+#endif
#endif /* FTOUTLN_H */
+
+
+/* END */
diff --git a/src/base/ftglyph.c b/src/base/ftglyph.c
index d6a81ce..592efa3 100644
--- a/src/base/ftglyph.c
+++ b/src/base/ftglyph.c
@@ -561,7 +561,7 @@
/* <Note> */
/* The 2x2 transformation matrix is also applied to the glyph's */
/* advance vector. */
- /*
+ /* */
FT_EXPORT_FUNC( FT_Error ) FT_Glyph_Transform( FT_Glyph glyph,
FT_Matrix* matrix,
FT_Vector* delta )
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index 9f72cee..df6c1ef 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -23,7 +23,6 @@
#include <freetype/tttags.h>
#include <freetype/ftoutln.h>
-
#include <ttgload.h>
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
@@ -146,10 +145,10 @@
}
-#define cur_to_org( n, zone ) \
+#define cur_to_org( n, zone ) \
MEM_Copy( (zone)->org, (zone)->cur, n * sizeof ( FT_Vector ) )
-#define org_to_cur( n, zone ) \
+#define org_to_cur( n, zone ) \
MEM_Copy( (zone)->cur, (zone)->org, n * sizeof ( FT_Vector ) )
@@ -165,6 +164,7 @@
{
FT_UInt k;
+
if ( delta_x )
for ( k = 0; k < n; k++ )
coords[k].x += delta_x;
@@ -175,10 +175,11 @@
}
- static void tt_prepare_zone( TT_GlyphZone* zone,
- FT_GlyphLoad* load,
- FT_UInt start_point,
- FT_UInt start_contour )
+ static
+ void tt_prepare_zone( TT_GlyphZone* zone,
+ FT_GlyphLoad* load,
+ FT_UInt start_point,
+ FT_UInt start_contour )
{
zone->n_points = load->outline.n_points - start_point;
zone->n_contours = load->outline.n_contours - start_contour;
@@ -286,7 +287,6 @@
outline = &gloader->current.outline;
}
-
/* reading the bytecode instructions */
slot->control_len = 0;
slot->control_data = 0;
@@ -481,6 +481,7 @@
subglyph->transform.yy = yy;
num_subglyphs++;
+
} while ( subglyph->flags & MORE_COMPONENTS );
gloader->current.num_subglyphs = num_subglyphs;
@@ -575,6 +576,7 @@
FT_Fixed x_scale = load->size->metrics.x_scale;
FT_Fixed y_scale = load->size->metrics.y_scale;
+
/* first scale the glyph points */
for ( ; vec < limit; vec++ )
{
@@ -726,6 +728,7 @@
loader->exec->glyphSize = 0;
#endif
+
error = FT_Err_Ok;
goto Exit;
}
@@ -777,6 +780,7 @@
goto Fail;
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
+
{
TT_Size size = (TT_Size)loader->size;
@@ -838,7 +842,6 @@
goto Exit;
}
-
/*********************************************************************/
/*********************************************************************/
/*********************************************************************/
@@ -963,7 +966,7 @@
/*******************************************************************/
/*******************************************************************/
- /* we have finished loading all sub-glyphs, now, look for */
+ /* we have finished loading all sub-glyphs; now, look for */
/* instructions for this composite! */
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
@@ -986,7 +989,7 @@
goto Fail;
FT_TRACE5(( " Instructions size = %d\n", n_ins ));
- /* in some fonts ?? */
+ /* in some fonts? */
if ( n_ins == 0xFFFF )
n_ins = 0;
@@ -1131,11 +1134,11 @@
FT_Pos advance = loader->advance;
- /* the flag FT_LOAD_NO_ADVANCE_CHECK was introduced to */
- /* correctly support DynaLab fonts, which have an incorrect */
- /* `advance_Width_Max' field! It is used, to my knowledge, */
- /* exclusively in the X-TrueType font server. */
- /* */
+ /* the flag FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH was introduced to */
+ /* correctly support DynaLab fonts, which have an incorrect */
+ /* `advance_Width_Max' field! It is used, to my knowledge, */
+ /* exclusively in the X-TrueType font server. */
+ /* */
if ( face->postscript.isFixedPitch &&
( loader->load_flags & FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ) == 0 )
advance = face->horizontal.advance_Width_Max;
@@ -1373,7 +1376,7 @@
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
- /* seek to the beginning of the glyph table. For Type 43 fonts */
+ /* seek to the beginning of the glyph table. For Type 42 fonts */
/* the table might be accessed from a Postscript stream or something */
/* else... */
diff --git a/src/truetype/ttgload.h b/src/truetype/ttgload.h
index d703921..cebead7 100644
--- a/src/truetype/ttgload.h
+++ b/src/truetype/ttgload.h
@@ -36,7 +36,6 @@
FT_Short* bearing,
FT_UShort* advance );
-
LOCAL_DEF
void TT_Init_Glyph_Loading( TT_Face face );
diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
index d81a33f..b890b64 100644
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -443,12 +443,9 @@
FT_Error error;
- FT_TRACE1(( "TT.Create_Create: new object at 0x%08p, parent = 0x%08p\n",
+ FT_TRACE1(( "Init_Context: new object at 0x%08p, parent = 0x%08p\n",
exec, face ));
- /* XXX: We don't reserve arrays anymore, this is done automatically */
- /* during a call to Context_Load(). */
-
exec->memory = memory;
exec->callSize = 32;
@@ -474,8 +471,8 @@
return TT_Err_Ok;
Fail_Memory:
- FT_ERROR(( "TT.Context_Create: not enough memory for 0x%08lx\n",
- (long)exec ));
+ FT_ERROR(( "Init_Context: not enough memory for 0x%08lx\n",
+ (FT_Long)exec ));
TT_Destroy_Context( exec, memory );
return error;
@@ -528,7 +525,6 @@
}
-
/*************************************************************************/
/* */
/* <Function> */
@@ -796,7 +792,7 @@
if ( !driver->context )
{
- FT_Error error;
+ FT_Error error;
/* allocate object */
@@ -1203,7 +1199,7 @@
const FT_Vector Null_Vector = {0,0};
-#undef PACK
+#undef PACK
#undef NULL_Vector
@@ -1237,15 +1233,22 @@
else
{
FT_Long x, y;
+
+
#ifdef FT_CONFIG_OPTION_OLD_CALCS
+
x = TT_MULDIV( CUR.GS.projVector.x, CUR.tt_metrics.x_ratio, 0x4000 );
y = TT_MULDIV( CUR.GS.projVector.y, CUR.tt_metrics.y_ratio, 0x4000 );
CUR.tt_metrics.ratio = Norm( x, y );
+
#else
+
x = TT_MULDIV( CUR.GS.projVector.x, CUR.tt_metrics.x_ratio, 0x8000 );
y = TT_MULDIV( CUR.GS.projVector.y, CUR.tt_metrics.y_ratio, 0x8000 );
CUR.tt_metrics.ratio = FT_Sqrt32( x * x + y * y ) << 1;
+
#endif /* FT_CONFIG_OPTION_OLD_CALCS */
+
}
return CUR.tt_metrics.ratio;
@@ -1287,6 +1290,7 @@
CUR.cvt[index] = value;
}
+
static
void Write_CVT_Stretched( EXEC_OP_ FT_ULong index,
FT_F26Dot6 value )
@@ -1420,14 +1424,20 @@
if ( v != 0 )
{
+
#ifdef NO_APPLE_PATENT
+
if ( ABS( CUR.F_dot_P ) > APPLE_THRESHOLD )
zone->cur[point].x += distance;
+
#else
+
zone->cur[point].x += TT_MULDIV( distance,
v * 0x10000L,
CUR.F_dot_P );
+
#endif
+
zone->tags[point] |= FT_Curve_Tag_Touch_X;
}
@@ -1435,14 +1445,20 @@
if ( v != 0 )
{
+
#ifdef NO_APPLE_PATENT
+
if ( ABS( CUR.F_dot_P ) > APPLE_THRESHOLD )
zone->cur[point].y += distance;
+
#else
+
zone->cur[point].y += TT_MULDIV( distance,
v * 0x10000L,
CUR.F_dot_P );
+
#endif
+
zone->tags[point] |= FT_Curve_Tag_Touch_Y;
}
}
@@ -1457,6 +1473,7 @@
/* */
/*************************************************************************/
+
static
void Direct_Move_X( EXEC_OP_ TT_GlyphZone* zone,
FT_UShort point,
@@ -1465,7 +1482,7 @@
UNUSED_EXEC;
zone->cur[point].x += distance;
- zone->tags[point] |= FT_Curve_Tag_Touch_X;
+ zone->tags[point] |= FT_Curve_Tag_Touch_X;
}
@@ -1477,7 +1494,7 @@
UNUSED_EXEC;
zone->cur[point].y += distance;
- zone->tags[point] |= FT_Curve_Tag_Touch_Y;
+ zone->tags[point] |= FT_Curve_Tag_Touch_Y;
}
@@ -2209,7 +2226,7 @@
if ( W == 0 )
{
- /* XXX: UNDOCUMENTED! It seems that it's possible to try */
+ /* XXX: UNDOCUMENTED! It seems that it is possible to try */
/* to normalize the vector (0,0). Return immediately. */
return SUCCESS;
}
@@ -2664,7 +2681,7 @@
/* */
/* It seems that the value that is read here is */
/* expressed in 16.16 format rather than in font */
- /* units.. */
+ /* units. */
/* */
#define DO_SSW \
CUR.GS.single_width_value = (FT_F26Dot6)( args[0] >> 10 );
@@ -3847,7 +3864,7 @@
static
void Ins_AA( INS_ARG )
{
- /* Intentional - no longer supported */
+ /* intentionally no longer supported */
}
@@ -3986,7 +4003,7 @@
/* */
/* MANAGING THE FLOW OF CONTROL */
/* */
- /* Instructions appear in the specification's order. */
+ /* Instructions appear in the specification's order. */
/* */
/*************************************************************************/
@@ -4100,7 +4117,7 @@
/* */
/* DEFINING AND USING FUNCTIONS AND INSTRUCTIONS */
/* */
- /* Instructions appear in the specification's order. */
+ /* Instructions appear in the specification's order. */
/* */
/*************************************************************************/
@@ -4436,7 +4453,7 @@
/* */
/* PUSHING DATA ONTO THE INTERPRETER STACK */
/* */
- /* Instructions appear in the specification's order. */
+ /* Instructions appear in the specification's order. */
/* */
/*************************************************************************/
@@ -4960,7 +4977,7 @@
static
void Ins_SCANTYPE( INS_ARG )
{
- /* For compatibility with future enhancements, */
+ /* for compatibility with future enhancements, */
/* we must ignore new modes */
if ( args[0] >= 0 && args[0] <= 5 )
@@ -4977,7 +4994,7 @@
/* */
/* MANAGING OUTLINES */
/* */
- /* Instructions appear in the specification's order. */
+ /* Instructions appear in the specification's order. */
/* */
/*************************************************************************/
@@ -4993,9 +5010,9 @@
{
FT_UShort point;
-
UNUSED_ARG;
+
if ( CUR.top < CUR.GS.loop )
{
CUR.error = TT_Err_Too_Few_Arguments;
@@ -5282,7 +5299,7 @@
FT_F26Dot6 dx,
dy;
- FT_UShort last_point, i;
+ FT_UShort last_point, i;
if ( BOUNDS( args[0], 2 ) )
@@ -5918,7 +5935,7 @@
return;
}
- /* XXX: there are some glyphs in some braindead but popular */
+ /* XXX: There are some glyphs in some braindead but popular */
/* fonts out there (e.g. [aeu]grave in monotype.ttf) */
/* calling IP[] with bad values of rp[12]. */
/* Do something sane when this odd thing happens. */
@@ -6020,7 +6037,7 @@
/* Local variables for Ins_IUP: */
- struct LOC_Ins_IUP
+ struct LOC_Ins_IUP
{
FT_Vector* orgs; /* original and current coordinate */
FT_Vector* curs; /* arrays */
diff --git a/src/truetype/ttinterp.h b/src/truetype/ttinterp.h
index 2b0fd01..72f0225 100644
--- a/src/truetype/ttinterp.h
+++ b/src/truetype/ttinterp.h
@@ -181,10 +181,11 @@
FT_F26Dot6 phase; /* `SuperRounding' */
FT_F26Dot6 threshold;
- /* this seems to be unused */
#if 0
+ /* this seems to be unused */
FT_Int cur_ppem; /* ppem along the current proj vector */
#endif
+
FT_Bool instruction_trap; /* If `True', the interpreter will */
/* exit after each instruction */
diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c
index f047bf1..c2d35da 100644
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -41,8 +41,8 @@
/* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
/* messages during execution. */
/* */
-#undef FT_COMPONENT
-#define FT_COMPONENT trace_ttobjs
+#undef FT_COMPONENT
+#define FT_COMPONENT trace_ttobjs
/*************************************************************************/
@@ -62,10 +62,12 @@
/* <Input> */
/* zone :: A pointer to the target glyph zone. */
/* */
- LOCAL_FUNC void TT_Done_GlyphZone( TT_GlyphZone* zone )
+ LOCAL_FUNC
+ void TT_Done_GlyphZone( TT_GlyphZone* zone )
{
FT_Memory memory = zone->memory;
+
FREE( zone->contours );
FREE( zone->tags );
FREE( zone->cur );
@@ -97,12 +99,14 @@
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
- LOCAL_FUNC FT_Error TT_New_GlyphZone( FT_Memory memory,
- FT_UShort maxPoints,
- FT_Short maxContours,
- TT_GlyphZone* zone )
+ LOCAL_FUNC
+ FT_Error TT_New_GlyphZone( FT_Memory memory,
+ FT_UShort maxPoints,
+ FT_Short maxContours,
+ TT_GlyphZone* zone )
{
- FT_Error error;
+ FT_Error error;
+
if ( maxPoints > 0 )
maxPoints += 2;
@@ -156,6 +160,7 @@
FT_Library library;
SFNT_Interface* sfnt;
+
library = face->root.driver->root.library;
sfnt = (SFNT_Interface*)FT_Get_Module_Interface( library, "sfnt" );
if ( !sfnt )
@@ -222,6 +227,7 @@
SFNT_Interface* sfnt = face->sfnt;
+
/* for `extended TrueType formats' (i.e. compressed versions) */
if ( face->extra.finalizer )
face->extra.finalizer( face->extra.data );
@@ -269,7 +275,8 @@
LOCAL_DEF
FT_Error TT_Init_Size( TT_Size size )
{
- FT_Error error = 0;
+ FT_Error error = TT_Err_Ok;
+
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
@@ -546,23 +553,20 @@
}
/* Compute root ascender, descender, test height, and max_advance */
- metrics->ascender = ( FT_MulFix( face->root.ascender,
- metrics->y_scale ) + 32 ) & -64;
-
- metrics->descender = ( FT_MulFix( face->root.descender,
- metrics->y_scale ) + 32 ) & -64;
-
- metrics->height = ( FT_MulFix( face->root.height,
- metrics->y_scale ) + 32 ) & -64;
-
+ metrics->ascender = ( FT_MulFix( face->root.ascender,
+ metrics->y_scale ) + 32 ) & -64;
+ metrics->descender = ( FT_MulFix( face->root.descender,
+ metrics->y_scale ) + 32 ) & -64;
+ metrics->height = ( FT_MulFix( face->root.height,
+ metrics->y_scale ) + 32 ) & -64;
metrics->max_advance = ( FT_MulFix( face->root.max_advance_width,
- metrics->x_scale ) + 32 ) & -64;
+ metrics->x_scale ) + 32 ) & -64;
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
{
- TT_ExecContext exec;
- FT_UInt i, j;
+ TT_ExecContext exec;
+ FT_UInt i, j;
/* Scale the cvt values to the new ppem. */
@@ -613,7 +617,7 @@
{
error = TT_Goto_CodeRange( exec, tt_coderange_cvt, 0 );
if ( error )
- goto Fin;
+ goto End;
if ( !size->debug )
error = face->interpreter( exec );
@@ -624,7 +628,7 @@
size->GS = exec->GS;
/* save default graphics state */
- Fin:
+ End:
TT_Save_Context( exec, size );
if ( !size->debug )
@@ -641,7 +645,6 @@
}
-
/*************************************************************************/
/* */
/* <Function> */
@@ -659,7 +662,7 @@
LOCAL_FUNC
FT_Error TT_Init_Driver( TT_Driver driver )
{
- FT_Error error;
+ FT_Error error;
/* set `extra' in glyph loader */
@@ -693,7 +696,9 @@
/* destroy extensions registry if needed */
#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
+
TT_Done_Extensions( driver );
+
#endif
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
@@ -706,6 +711,7 @@
}
#endif
+
}
diff --git a/src/truetype/ttobjs.h b/src/truetype/ttobjs.h
index ed189a6..3e55de3 100644
--- a/src/truetype/ttobjs.h
+++ b/src/truetype/ttobjs.h
@@ -106,6 +106,7 @@
} TT_GraphicsState;
+
LOCAL_DEF void TT_Done_GlyphZone( TT_GlyphZone* zone );
LOCAL_DEF FT_Error TT_New_GlyphZone( FT_Memory memory,
@@ -113,6 +114,7 @@
FT_Short maxContours,
TT_GlyphZone* zone );
+
/*************************************************************************/
/* */
/* EXECUTION SUBTABLES */
@@ -166,7 +168,6 @@
} TT_DefRecord, *TT_DefArray;
-
/*************************************************************************/
/* */
/* Subglyph transformation record. */
@@ -297,10 +298,10 @@
} TT_Size_Metrics;
- /***********************************************************************/
- /* */
- /* TrueType size class. */
- /* */
+ /*************************************************************************/
+ /* */
+ /* TrueType size class. */
+ /* */
typedef struct TT_SizeRec_
{
FT_SizeRec root;
@@ -346,10 +347,10 @@
} TT_SizeRec;
- /***********************************************************************/
- /* */
- /* TrueType driver class. */
- /* */
+ /*************************************************************************/
+ /* */
+ /* TrueType driver class. */
+ /* */
typedef struct TT_DriverRec_
{
FT_DriverRec root;
@@ -400,6 +401,7 @@
LOCAL_DEF
void TT_Done_Driver( TT_Driver driver );
+
#ifdef __cplusplus
}
#endif