* src/pshinter/pshalgo3.c (psh3_hint_table_record, psh3_hint_table_init, psh3_hint_table_activate_mask): Fix error message. 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 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
diff --git a/ChangeLog b/ChangeLog
index c4c212c..51558fa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,10 @@
without effect.
* src/truetype/ttdriver (Get_Char_Index, Get_Next_Char): Removed.
+ * src/pshinter/pshalgo3.c (psh3_hint_table_record,
+ psh3_hint_table_init, psh3_hint_table_activate_mask): Fix error
+ message.
+
2002-07-24 Graham Asher <graham.asher@btinternet.com>
* src/truetype/ttobjs.c: Fix for bug reported by Sven Neumann
diff --git a/src/cff/cffcmap.c b/src/cff/cffcmap.c
index 9cced30..d84db10 100644
--- a/src/cff/cffcmap.c
+++ b/src/cff/cffcmap.c
@@ -1,10 +1,29 @@
+/***************************************************************************/
+/* */
+/* cffcmap.c */
+/* */
+/* CFF character mapping table (cmap) support (body). */
+/* */
+/* Copyright 2002 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
+/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
+/* this file you indicate that you have read the license and */
+/* understand and accept it fully. */
+/* */
+/***************************************************************************/
+
+
#include "cffcmap.h"
#include "cffload.h"
+
/*************************************************************************/
/*************************************************************************/
/***** *****/
- /***** CFF STANDARD (AND EXPERT) ENCODING CMAPS *****/
+ /***** CFF STANDARD (AND EXPERT) ENCODING CMAPS *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
@@ -38,8 +57,9 @@
{
FT_UInt result = 0;
+
if ( char_code < cmap->count )
- result = cmap->gids[ char_code ];
+ result = cmap->gids[char_code];
return result;
}
@@ -47,23 +67,25 @@
FT_CALLBACK_DEF( FT_UInt )
cff_cmap_encoding_char_next( CFF_CMapStd cmap,
- FT_UInt32 *pchar_code )
+ FT_UInt32 *pchar_code )
{
FT_UInt result = 0;
FT_UInt32 char_code = *pchar_code;
+
*pchar_code = 0;
if ( char_code < cmap->count )
{
- FT_UInt code = (FT_UInt)(char_code+1);
+ FT_UInt code = (FT_UInt)(char_code + 1);
+
for (;;)
{
if ( code >= cmap->count )
break;
- result = cmap->gids[ code ];
+ result = cmap->gids[code];
if ( result != 0 )
{
*pchar_code = code;
@@ -77,7 +99,6 @@
}
-
FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec
cff_cmap_encoding_class_rec =
{
@@ -198,9 +219,10 @@
FT_CALLBACK_DEF( void )
cff_cmap_unicode_done( CFF_CMapUnicode cmap )
{
- FT_Face face = FT_CMAP_FACE(cmap);
- FT_Memory memory = FT_FACE_MEMORY(face);
+ FT_Face face = FT_CMAP_FACE( cmap );
+ FT_Memory memory = FT_FACE_MEMORY( face );
+
FT_FREE( cmap->pairs );
cmap->num_pairs = 0;
}
@@ -208,11 +230,11 @@
FT_CALLBACK_DEF( FT_UInt )
cff_cmap_unicode_char_index( CFF_CMapUnicode cmap,
- FT_UInt32 char_code )
+ FT_UInt32 char_code )
{
- FT_UInt min = 0;
- FT_UInt max = cmap->num_pairs;
- FT_UInt mid;
+ FT_UInt min = 0;
+ FT_UInt max = cmap->num_pairs;
+ FT_UInt mid;
CFF_CMapUniPair pair;
@@ -235,7 +257,7 @@
FT_CALLBACK_DEF( FT_UInt )
cff_cmap_unicode_char_next( CFF_CMapUnicode cmap,
- FT_UInt32 *pchar_code )
+ FT_UInt32 *pchar_code )
{
FT_UInt result = 0;
FT_UInt32 char_code = *pchar_code + 1;
@@ -243,9 +265,9 @@
Restart:
{
- FT_UInt min = 0;
- FT_UInt max = cmap->num_pairs;
- FT_UInt mid;
+ FT_UInt min = 0;
+ FT_UInt max = cmap->num_pairs;
+ FT_UInt mid;
CFF_CMapUniPair pair;
@@ -299,3 +321,5 @@
(FT_CMap_CharNextFunc) cff_cmap_unicode_char_next
};
+
+/* END */
diff --git a/src/cff/cffcmap.h b/src/cff/cffcmap.h
index 2c72c95..e136d29 100644
--- a/src/cff/cffcmap.h
+++ b/src/cff/cffcmap.h
@@ -1,10 +1,29 @@
-#ifndef __CFF_CMAP_H__
-#define __CFF_CMAP_H__
+/***************************************************************************/
+/* */
+/* cffcmap.h */
+/* */
+/* CFF character mapping table (cmap) support (specification). */
+/* */
+/* Copyright 2002 by */
+/* David Turner, Robert Wilhelm, and Werner Lemberg. */
+/* */
+/* This file is part of the FreeType project, and may only be used, */
+/* modified, and distributed under the terms of the FreeType project */
+/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
+/* this file you indicate that you have read the license and */
+/* understand and accept it fully. */
+/* */
+/***************************************************************************/
+
+
+#ifndef __CFFCMAP_H__
+#define __CFFCMAP_H__
#include "cffobjs.h"
FT_BEGIN_HEADER
+
/*************************************************************************/
/*************************************************************************/
/***** *****/
@@ -18,9 +37,9 @@ FT_BEGIN_HEADER
typedef struct CFF_CMapStdRec_
{
- FT_CMapRec cmap;
- FT_UInt count;
- FT_UShort* gids; /* up to 256 elements */
+ FT_CMapRec cmap;
+ FT_UInt count;
+ FT_UShort* gids; /* up to 256 elements */
} CFF_CMapStdRec;
@@ -63,4 +82,7 @@ FT_BEGIN_HEADER
FT_END_HEADER
-#endif /* __CFF_CMAP_H__ */
+#endif /* __CFFCMAP_H__ */
+
+
+/* END */
diff --git a/src/pshinter/pshalgo3.c b/src/pshinter/pshalgo3.c
index 35b8ad0..ed849ae 100644
--- a/src/pshinter/pshalgo3.c
+++ b/src/pshinter/pshalgo3.c
@@ -21,9 +21,11 @@
#include FT_INTERNAL_DEBUG_H
#include "pshalgo3.h"
+
#undef FT_COMPONENT
#define FT_COMPONENT trace_pshalgo2
+
#ifdef DEBUG_HINTER
extern PSH3_Hint_Table ps3_debug_hint_table = 0;
extern PSH3_HintFunc ps3_debug_hint_func = 0;
@@ -31,12 +33,10 @@
#endif
-
#undef SNAP_STEMS
#undef ONLY_ALIGN_Y
-
/*************************************************************************/
/*************************************************************************/
/***** *****/
@@ -76,7 +76,7 @@
static void
psh3_hint_table_deactivate( PSH3_Hint_Table table )
{
- FT_UInt count = table->max_hints;
+ FT_UInt count = table->max_hints;
PSH3_Hint hint = table->hints;
@@ -98,7 +98,7 @@
if ( idx >= table->max_hints )
{
- FT_ERROR(( "%s.activate: invalid hint index %d\n", idx ));
+ FT_ERROR(( "psh3_hint_table_record: invalid hint index %d\n", idx ));
return;
}
@@ -132,8 +132,7 @@
if ( table->num_hints < table->max_hints )
table->sort_global[table->num_hints++] = hint;
else
- FT_ERROR(( "%s.activate: too many sorted hints! BUG!\n",
- "ps.fitter" ));
+ FT_ERROR(( "psh3_hint_table_record: too many sorted hints! BUG!\n" ));
}
@@ -221,10 +220,10 @@
/* now, do a linear parse in case some hints were left alone */
if ( table->num_hints != table->max_hints )
{
- FT_UInt Index, Count;
+ FT_UInt Index, Count;
- FT_ERROR(( "%s.init: missing/incorrect hint masks!\n" ));
+ FT_ERROR(( "psh3_hint_table_init: missing/incorrect hint masks!\n" ));
Count = table->max_hints;
for ( Index = 0; Index < Count; Index++ )
psh3_hint_table_record( table, Index );
@@ -270,12 +269,13 @@
PSH3_Hint* sort = table->sort;
PSH3_Hint hint2;
+
for ( count2 = count; count2 > 0; count2--, sort++ )
{
hint2 = sort[0];
if ( psh3_hint_overlap( hint, hint2 ) )
- FT_ERROR(( "%s.activate_mask: found overlapping hints\n",
- "psf.hint" ));
+ FT_ERROR(( "psh3_hint_table_activate_mask:"
+ " found overlapping hints\n" ))
}
#else
count2 = 0;
@@ -287,8 +287,8 @@
if ( count < table->max_hints )
table->sort[count++] = hint;
else
- FT_ERROR(( "%s.activate_mask: too many active hints\n",
- "psf.hint" ));
+ FT_ERROR(( "psh3_hint_tableactivate_mask:"
+ " too many active hints\n" ));
}
}
}
@@ -334,6 +334,7 @@
/*************************************************************************/
#ifdef DEBUG_HINTER
+
static void
ps3_simple_scale( PSH3_Hint_Table table,
FT_Fixed scale,
@@ -355,23 +356,22 @@
ps3_debug_hint_func( hint, dimension );
}
}
-#endif
+
+#endif /* DEBUG_HINTER */
+
static FT_Fixed
- psh3_hint_snap_stem_side_delta ( FT_Fixed pos,
- FT_Fixed len )
+ psh3_hint_snap_stem_side_delta( FT_Fixed pos,
+ FT_Fixed len )
{
- FT_Fixed delta1 = ( ( pos + 32 ) & -64 ) - pos;
- FT_Fixed delta2 = ( ( pos + len + 32 ) & -64 ) - pos - len;
+ FT_Fixed delta1 = ( ( pos + 32 ) & -64 ) - pos;
+ FT_Fixed delta2 = ( ( pos + len + 32 ) & -64 ) - pos - len;
+
if ( ABS( delta1 ) <= ABS( delta2 ) )
- {
return delta1;
- }
else
- {
return delta2;
- }
}
@@ -386,7 +386,7 @@
FT_Fixed delta = dim->scale_delta;
- if ( !psh3_hint_is_fitted(hint) )
+ if ( !psh3_hint_is_fitted( hint ) )
{
FT_Pos pos = FT_MulFix( hint->org_pos, scale ) + delta;
FT_Pos len = FT_MulFix( hint->org_len, scale );
@@ -405,7 +405,7 @@
psh3_hint_set_fitted( hint );
return;
- }
+ }
/* perform stem snapping when requested */
if ( ( hint_flags & FT_HINT_NO_INTEGER_STEM ) == 0 )
@@ -469,9 +469,9 @@
if ( !psh3_hint_is_fitted( parent ) )
psh3_hint_align( parent, globals, dimension, hint_flags );
- par_org_center = parent->org_pos + ( parent->org_len / 2);
- par_cur_center = parent->cur_pos + ( parent->cur_len / 2);
- cur_org_center = hint->org_pos + ( hint->org_len / 2);
+ par_org_center = parent->org_pos + ( parent->org_len / 2 );
+ par_cur_center = parent->cur_pos + ( parent->cur_len / 2 );
+ cur_org_center = hint->org_pos + ( hint->org_len / 2 );
cur_delta = FT_MulFix( cur_org_center - par_org_center, scale );
pos = par_cur_center + cur_delta - ( len >> 1 );
@@ -516,15 +516,15 @@
* C) |--------------------------------|
*
* Position A) (split the excess stem equally) should be better
- * for stems of width N + f where f < 0.5
+ * for stems of width N + f where f < 0.5.
*
* Position B) (split the deficiency equally) should be better
- * for stems of width N + f where f > 0.5
+ * for stems of width N + f where f > 0.5.
*
* It turns out though that minimizing the total number of touched
* pixels is also important, so position C), with one edge
* aligned with a pixel boundary is actually preferable
- * to A). There are also more possible positions for C) than
+ * to A). There are also more possible positions for C) than
* for A) or B), so there will be less distortion of the overall
* character shape.
*/
@@ -535,6 +535,7 @@
FT_Fixed delta_a, delta_b;
+
if ( ( len / 64 ) & 1 )
{
delta_a = ( center & -64 ) + 32 - center;
@@ -551,13 +552,12 @@
* C) always; for large amounts, B) always; inbetween,
* pick whichever one involves less stem movement.
*/
- if (frac_len < 32)
- {
+ if ( frac_len < 32 )
pos += psh3_hint_snap_stem_side_delta ( pos, len );
- }
- else if (frac_len < 48)
+ else if ( frac_len < 48 )
{
- FT_Fixed side_delta = psh3_hint_snap_stem_side_delta ( pos, len );
+ FT_Fixed side_delta =
+ psh3_hint_snap_stem_side_delta( pos, len );
if ( ABS( side_delta ) < ABS( delta_b ) )
pos += side_delta;
@@ -565,9 +565,7 @@
pos += delta_b;
}
else
- {
pos += delta_b;
- }
}
hint->cur_pos = pos;
}
@@ -594,6 +592,7 @@
FT_UInt count;
#ifdef DEBUG_HINTER
+
PSH_Dimension dim = &globals->dimension[dimension];
FT_Fixed scale = dim->scale_mult;
FT_Fixed delta = dim->scale_delta;
@@ -610,7 +609,8 @@
ps3_simple_scale( table, scale, delta, dimension );
return;
}
-#endif
+
+#endif /* DEBUG_HINTER*/
hint = table->hints;
count = table->max_hints;
@@ -628,8 +628,8 @@
/*************************************************************************/
/*************************************************************************/
-#define PSH3_ZONE_MIN -3200000
-#define PSH3_ZONE_MAX +3200000
+#define PSH3_ZONE_MIN -3200000L
+#define PSH3_ZONE_MAX +3200000L
#define xxDEBUG_ZONES
@@ -642,17 +642,17 @@
psh3_print_zone( PSH3_Zone zone )
{
printf( "zone [scale,delta,min,max] = [%.3f,%.3f,%d,%d]\n",
- zone->scale/65536.0,
- zone->delta/64.0,
+ zone->scale / 65536.0,
+ zone->delta / 64.0,
zone->min,
zone->max );
}
#else
-#define psh3_print_zone( x ) do { } while ( 0 )
+#define psh3_print_zone( x ) do { } while ( 0 )
-#endif
+#endif /* DEBUG_ZONES */
/*************************************************************************/
@@ -911,6 +911,7 @@
point->org_x = vec->x;
point->org_y = vec->y;
#endif
+
}
}
@@ -937,6 +938,7 @@
tags[n] |= (char)( ( dimension == 0 ) ? 32 : 64 );
#ifdef DEBUG_HINTER
+
if ( dimension == 0 )
{
point->cur_x = point->cur_u;
@@ -947,7 +949,9 @@
point->cur_y = point->cur_u;
point->flags_y = point->flags;
}
+
#endif
+
point++;
}
}
@@ -991,6 +995,7 @@
}
#if 1
+
if ( point->org_u >= hint->org_pos &&
point->org_u <= hint->org_pos + hint->org_len &&
psh3_point_is_extremum( point ) )
@@ -999,7 +1004,9 @@
point->hint = hint;
break;
}
+
#endif
+
}
}
@@ -1016,7 +1023,8 @@
PS_Mask mask = table->hint_masks->masks;
FT_UInt num_masks = table->hint_masks->num_masks;
FT_UInt first = 0;
- FT_Int major_dir = dimension == 0 ? PSH3_DIR_UP : PSH3_DIR_RIGHT;
+ FT_Int major_dir = dimension == 0 ? PSH3_DIR_UP
+ : PSH3_DIR_RIGHT;
/* process secondary hints to "selected" points */
@@ -1081,8 +1089,8 @@
psh3_glyph_interpolate_strong_points( PSH3_Glyph glyph,
FT_Int dimension )
{
- PSH_Dimension dim = &glyph->globals->dimension[dimension];
- FT_Fixed scale = dim->scale_mult;
+ PSH_Dimension dim = &glyph->globals->dimension[dimension];
+ FT_Fixed scale = dim->scale_mult;
{
@@ -1126,9 +1134,11 @@
psh3_glyph_interpolate_normal_points( PSH3_Glyph glyph,
FT_Int dimension )
{
+
#if 1
- PSH_Dimension dim = &glyph->globals->dimension[dimension];
- FT_Fixed scale = dim->scale_mult;
+
+ PSH_Dimension dim = &glyph->globals->dimension[dimension];
+ FT_Fixed scale = dim->scale_mult;
/* first technique: a point is strong if it is a local extrema */
@@ -1172,7 +1182,7 @@
{
if ( psh3_point_is_strong( cur ) )
{
- FT_Pos diff = cur->org_u - u;;
+ FT_Pos diff = cur->org_u - u;;
if ( diff <= 0 )
@@ -1230,7 +1240,9 @@
}
}
}
-#endif
+
+#endif /* 1 */
+
}
@@ -1239,18 +1251,18 @@
psh3_glyph_interpolate_other_points( PSH3_Glyph glyph,
FT_Int dimension )
{
- PSH_Dimension dim = &glyph->globals->dimension[dimension];
- FT_Fixed scale = dim->scale_mult;
- FT_Fixed delta = dim->scale_delta;
- PSH3_Contour contour = glyph->contours;
- FT_UInt num_contours = glyph->num_contours;
+ PSH_Dimension dim = &glyph->globals->dimension[dimension];
+ FT_Fixed scale = dim->scale_mult;
+ FT_Fixed delta = dim->scale_delta;
+ PSH3_Contour contour = glyph->contours;
+ FT_UInt num_contours = glyph->num_contours;
for ( ; num_contours > 0; num_contours--, contour++ )
{
- PSH3_Point start = contour->start;
- PSH3_Point first, next, point;
- FT_UInt fit_count;
+ PSH3_Point start = contour->start;
+ PSH3_Point first, next, point;
+ FT_UInt fit_count;
/* count the number of strong points in this contour */
@@ -1399,6 +1411,7 @@
#ifdef DEBUG_HINTER
+
memory = globals->memory;
if ( ps3_debug_glyph )
@@ -1411,7 +1424,8 @@
return error;
ps3_debug_glyph = glyph;
-#endif
+
+#endif /* DEBUG_HINTER */
error = psh3_glyph_init( glyph, outline, ps_hints, globals );
if ( error )
@@ -1439,9 +1453,11 @@
}
Exit:
+
#ifndef DEBUG_HINTER
psh3_glyph_done( glyph );
#endif
+
return error;
}
diff --git a/src/pshinter/pshalgo3.h b/src/pshinter/pshalgo3.h
index 6ad6371..913e298 100644
--- a/src/pshinter/pshalgo3.h
+++ b/src/pshinter/pshalgo3.h
@@ -4,7 +4,7 @@
/* */
/* PostScript hinting algorithm 3 (specification). */
/* */
-/* Copyright 2001 by */
+/* Copyright 2001, 2002 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */