* include/freetype/internal/ftobjs.h (FT_Face_InternalRec): Remove unused `max_points' and `max_contours'. * src/cid/cidobjs.c (cid_face_init), src/type1/t1objs.c (T1_Face_Init), src/type42/t42objs.c (T42_Face_Init): Update. * include/freetype/internal/tttypes.h (TT_FaceRec): Remove unused `max_components'. * src/truetype/ttinterp.h (TT_ExecContextRec): Remove unused `loadSize' and `loadStack'. * src/truetype/ttinterp.c (TT_Done_Context, TT_Load_Context), src/sfnt/ttload.c (tt_face_load_maxp): Update. * src/cff/cffobjs.h (cff_size_select), src/sfnt/sfdriver.c (sfnt_interface), src/truetype/ttdriver.c (tt_size_request): Fix compiler errors/warnings when TT_CONFIG_OPTION_EMBEDDED_BITMAPS is not defined. * src/sfnt/ttmtx.c (tt_face_load_hmtx, tt_face_get_metrics): Fix possible segment faults for the non-FT_OPTIMIZE_MEMORY'ed versions. (finally!) For most OpenType tables, `tt_face_load_xxxx' simply loads the table and `face->root' is set later in `sfnt_load_face'. Here, we try to make this work for _all_ tables. * src/sfnt/ttsbit.c, src/sfnt/ttsbit0.c, src/sfnt/ttload.c, src/sfnt/ttmtx.c: all `tt_face_load_xxxx' should load the table and then exit. Error handling or setting face->root is done later in `sfnt_load_face'. Pretty trace messages. * src/sfnt/sfobjs.c (sfnt_load_face): Work harder. Mac bitmap-only fonts are not scalable. Check that `face->header.Units_Per_EM' is not zero. (LOAD_, LOADM_): Pretty trace messages. * src/sfnt/ttsbit0.c (tt_face_load_strike_metrics): Read metrics from `eblc'. * src/sfnt/ttcmap.c (tt_face_build_cmaps), src/sfnt/ttpost.c (load_format_20, load_format_25, tt_face_get_ps_name): Use face->max_profile.numGlyphs, instead of face->root.num_glyphs.
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 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155
diff --git a/ChangeLog b/ChangeLog
index 5a0ccee..abd3fe3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,51 @@
+2006-02-15 Chia-I Wu <b90201047@ntu.edu.tw>
+
+ * include/freetype/internal/ftobjs.h (FT_Face_InternalRec): Remove
+ unused `max_points' and `max_contours'.
+
+ * src/cid/cidobjs.c (cid_face_init), src/type1/t1objs.c
+ (T1_Face_Init), src/type42/t42objs.c (T42_Face_Init): Update.
+
+ * include/freetype/internal/tttypes.h (TT_FaceRec): Remove unused
+ `max_components'.
+
+ * src/truetype/ttinterp.h (TT_ExecContextRec): Remove unused
+ `loadSize' and `loadStack'.
+
+ * src/truetype/ttinterp.c (TT_Done_Context, TT_Load_Context),
+ src/sfnt/ttload.c (tt_face_load_maxp): Update.
+
+ * src/cff/cffobjs.h (cff_size_select), src/sfnt/sfdriver.c
+ (sfnt_interface), src/truetype/ttdriver.c (tt_size_request): Fix
+ compiler errors/warnings when TT_CONFIG_OPTION_EMBEDDED_BITMAPS is not
+ defined.
+
+ * src/sfnt/ttmtx.c (tt_face_load_hmtx, tt_face_get_metrics): Fix
+ possible segment faults for the non-FT_OPTIMIZE_MEMORY'ed versions.
+ (finally!)
+
+ For most OpenType tables, `tt_face_load_xxxx' simply loads the table
+ and `face->root' is set later in `sfnt_load_face'. Here, we try to
+ make this work for _all_ tables.
+
+ * src/sfnt/ttsbit.c, src/sfnt/ttsbit0.c, src/sfnt/ttload.c,
+ src/sfnt/ttmtx.c: all `tt_face_load_xxxx' should load the table and
+ then exit. Error handling or setting face->root is done later in
+ `sfnt_load_face'.
+ Pretty trace messages.
+
+ * src/sfnt/sfobjs.c (sfnt_load_face): Work harder.
+ Mac bitmap-only fonts are not scalable.
+ Check that `face->header.Units_Per_EM' is not zero.
+ (LOAD_, LOADM_): Pretty trace messages.
+
+ * src/sfnt/ttsbit0.c (tt_face_load_strike_metrics): Read metrics from
+ `eblc'.
+
+ * src/sfnt/ttcmap.c (tt_face_build_cmaps), src/sfnt/ttpost.c
+ (load_format_20, load_format_25, tt_face_get_ps_name): Use
+ face->max_profile.numGlyphs, instead of face->root.num_glyphs.
+
2006-02-14 Werner Lemberg <wl@gnu.org>
* include/freetype/ftoutln.h (FT_Outline_Embolden): Mention in
diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h
index f07e23d..4da9789 100644
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -213,9 +213,6 @@ FT_BEGIN_HEADER
/* */
typedef struct FT_Face_InternalRec_
{
- FT_UShort max_points;
- FT_Short max_contours;
-
FT_Matrix transform_matrix;
FT_Vector transform_delta;
FT_Int transform_flags;
diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h
index 3d951c7..4b6b88d 100644
--- a/include/freetype/internal/tttypes.h
+++ b/include/freetype/internal/tttypes.h
@@ -1102,10 +1102,6 @@ FT_BEGIN_HEADER
/* table. We thus define additional fields */
/* below to hold the computed maxima. */
/* */
- /* max_components :: The maximum number of glyph components */
- /* required to load any composite glyph from */
- /* this font. Used to size the load stack. */
- /* */
/* vertical_info :: A boolean which is set when the font file */
/* contains vertical metrics. If not, the */
/* value of the `vertical' field is */
@@ -1277,7 +1273,6 @@ FT_BEGIN_HEADER
#endif
TT_MaxProfile max_profile;
- FT_ULong max_components;
FT_Bool vertical_info;
TT_VertHeader vertical; /* TT Vertical header, if present */
diff --git a/src/cff/cffobjs.h b/src/cff/cffobjs.h
index 3377520..cc4ab64 100644
--- a/src/cff/cffobjs.h
+++ b/src/cff/cffobjs.h
@@ -116,10 +116,14 @@ FT_BEGIN_HEADER
cff_size_request( FT_Size size,
FT_Size_Request req );
+#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
+
FT_LOCAL( FT_Error )
cff_size_select( FT_Size size,
FT_ULong index );
+#endif
+
FT_LOCAL( void )
cff_slot_done( FT_GlyphSlot slot );
diff --git a/src/cid/cidobjs.c b/src/cid/cidobjs.c
index 16ddc47..7d318a3 100644
--- a/src/cid/cidobjs.c
+++ b/src/cid/cidobjs.c
@@ -429,9 +429,6 @@
cidface->underline_position = (FT_Short)info->underline_position;
cidface->underline_thickness = (FT_Short)info->underline_thickness;
-
- cidface->internal->max_points = 0;
- cidface->internal->max_contours = 0;
}
Exit:
diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c
index df142a5..829a57e 100644
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -434,6 +434,7 @@
0,
0,
0,
+ 0,
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c
index 6c0b7fa..b79685d 100644
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -481,9 +481,36 @@
}
-#undef LOAD_
-#define LOAD_( x ) ( ( error = sfnt->load_##x( face, stream ) ) \
- != SFNT_Err_Ok )
+#define LOAD_( x ) \
+ do { \
+ FT_TRACE2(( "`" #x "' " )); \
+ FT_TRACE3(( "-->\n" )); \
+ \
+ error = sfnt->load_##x( face, stream ); \
+ \
+ FT_TRACE2(( "%s\n", ( !error ) \
+ ? "loaded" \
+ : ( error == SFNT_Err_Table_Missing ) \
+ ? "missing" \
+ : "failed to load" )); \
+ FT_TRACE3(( "\n" )); \
+ } while ( 0 )
+
+#define LOADM_( x, vertical ) \
+ do { \
+ FT_TRACE2(( "`%s" #x "' ", \
+ vertical ? "vertical " : "" )); \
+ FT_TRACE3(( "-->\n" )); \
+ \
+ error = sfnt->load_##x( face, stream, vertical ); \
+ \
+ FT_TRACE2(( "%s\n", ( !error ) \
+ ? "loaded" \
+ : ( error == SFNT_Err_Table_Missing ) \
+ ? "missing" \
+ : "failed to load" )); \
+ FT_TRACE3(( "\n" )); \
+ } while ( 0 )
FT_LOCAL_DEF( FT_Error )
@@ -521,6 +548,8 @@
/* it doesn't contain outlines. */
/* */
+ FT_TRACE2(( "sfnt_load_face: %08p\n\n", face ));
+
/* do we have outlines in there? */
#ifdef FT_CONFIG_OPTION_INCREMENTAL
has_outline = FT_BOOL( face->root.internal->incremental_interface != 0 ||
@@ -533,40 +562,50 @@
is_apple_sbit = 0;
-#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
-
/* if this font doesn't contain outlines, we try to load */
/* a `bhed' table */
- if ( !has_outline )
- is_apple_sbit = FT_BOOL( !LOAD_( bhed ) );
-
-#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
+ if ( !has_outline && sfnt->load_bhed )
+ {
+ LOAD_( bhed );
+ is_apple_sbit = !error;
+ }
/* load the font header (`head' table) if this isn't an Apple */
/* sbit font file */
- if ( !is_apple_sbit && LOAD_( head ) )
+ if ( !is_apple_sbit )
+ {
+ LOAD_( head );
+ if ( error )
+ goto Exit;
+ }
+
+ if ( face->header.Units_Per_EM == 0 )
+ {
+ error = SFNT_Err_Invalid_Table;
+
goto Exit;
+ }
/* the following tables are often not present in embedded TrueType */
/* fonts within PDF documents, so don't check for them. */
- (void)LOAD_( maxp );
- (void)LOAD_( cmap );
+ LOAD_( maxp );
+ LOAD_( cmap );
/* the following tables are optional in PCL fonts -- */
/* don't check for errors */
- (void)LOAD_( name );
- psnames_error = LOAD_( post );
+ LOAD_( name );
+ LOAD_( post );
+ psnames_error = error;
/* do not load the metrics headers and tables if this is an Apple */
/* sbit font file */
if ( !is_apple_sbit )
{
/* load the `hhea' and `hmtx' tables */
- error = sfnt->load_hhea( face, stream, 0 );
+ LOADM_( hhea, 0 );
if ( !error )
{
- error = sfnt->load_hmtx( face, stream, 0 );
-
+ LOADM_( hmtx, 0 );
if ( error == SFNT_Err_Table_Missing )
{
error = SFNT_Err_Hmtx_Table_Missing;
@@ -590,6 +629,7 @@
if ( face->format_tag == TTAG_true )
{
FT_TRACE2(( "This is an SFNT Mac font.\n" ));
+ has_outline = 0;
error = SFNT_Err_Ok;
}
else
@@ -600,10 +640,10 @@
goto Exit;
/* try to load the `vhea' and `vmtx' tables */
- error = sfnt->load_hhea( face, stream, 1 );
+ LOADM_( hhea, 1 );
if ( !error )
{
- error = sfnt->load_hmtx( face, stream, 1 );
+ LOADM_( hmtx, 1 );
if ( !error )
face->vertical_info = 1;
}
@@ -611,35 +651,50 @@
if ( error && error != SFNT_Err_Table_Missing )
goto Exit;
- if ( LOAD_( os2 ) )
- goto Exit;
+ LOAD_( os2 );
+ if ( error )
+ {
+ if ( error != SFNT_Err_Table_Missing )
+ goto Exit;
+
+ face->os2.version = 0xFFFFU;
+ }
+
}
/* the optional tables */
-#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
-
/* embedded bitmap support. */
- if ( sfnt->load_eblc && LOAD_( eblc ) )
+ if ( sfnt->load_eblc )
{
- /* return an error if this font file has no outlines */
- if ( error == SFNT_Err_Table_Missing && has_outline )
- error = SFNT_Err_Ok;
- else
- goto Exit;
+ LOAD_( eblc );
+ if ( error )
+ {
+ /* return an error if this font file has no outlines */
+ if ( error == SFNT_Err_Table_Missing && has_outline )
+ error = SFNT_Err_Ok;
+ else
+ goto Exit;
+ }
}
-#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
+ LOAD_( pclt );
+ if ( error )
+ {
+ if ( error != SFNT_Err_Table_Missing )
+ goto Exit;
- if ( LOAD_( pclt ) )
- goto Exit;
+ face->pclt.Version = 0;
+ }
/* consider the kerning and gasp tables as optional */
- (void)LOAD_( gasp );
- (void)LOAD_( kern );
+ LOAD_( gasp );
+ LOAD_( kern );
error = SFNT_Err_Ok;
+ face->root.num_glyphs = face->max_profile.numGlyphs;
+
face->root.family_name = tt_face_get_name( face,
TT_NAME_ID_PREFERRED_FAMILY );
if ( !face->root.family_name )
@@ -847,18 +902,80 @@
root->underline_position = face->postscript.underlinePosition;
root->underline_thickness = face->postscript.underlineThickness;
+ }
+
+#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
+
+ /*
+ * Now allocate the root array of FT_Bitmap_Size records and
+ * populate them. Unfortunately, it isn't possible to indicate bit
+ * depths in the FT_Bitmap_Size record. This is a design error.
+ */
+ {
+ FT_UInt i, count;
+
+
+#ifdef FT_OPTIMIZE_MEMORY
+ count = face->sbit_num_strikes;
+#else
+ count = (FT_UInt)face->num_sbit_strikes;
+#endif
+
+ if ( count > 0 )
+ {
+ FT_Memory memory = face->root.stream->memory;
+ FT_UShort em_size = face->header.Units_Per_EM;
+ FT_Short avgwidth = face->os2.xAvgCharWidth;
+ FT_Size_Metrics metrics;
+
- /* root->max_points -- already set up */
- /* root->max_contours -- already set up */
+ if ( em_size == 0 || face->os2.version == 0xFFFFU )
+ {
+ avgwidth = 0;
+ em_size = 1;
+ }
+
+ if ( FT_NEW_ARRAY( root->available_sizes, count ) )
+ goto Exit;
+
+ for ( i = 0; i < count; i++ )
+ {
+ FT_Bitmap_Size* bsize = root->available_sizes + i;
+
+
+ error = sfnt->load_strike_metrics( face, i, &metrics );
+ if ( error )
+ goto Exit;
+
+ bsize->height = metrics.height >> 6;
+ bsize->width = (FT_Short)(
+ ( avgwidth * metrics.x_ppem + em_size / 2 ) / em_size );
+
+ bsize->x_ppem = metrics.x_ppem << 6;
+ bsize->y_ppem = metrics.y_ppem << 6;
+
+ /* assume 72dpi */
+ bsize->size = metrics.y_ppem << 6;
+ }
+
+ root->face_flags |= FT_FACE_FLAG_FIXED_SIZES;
+ root->num_fixed_sizes = (FT_Int)count;
+ }
}
+
+#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
+
}
Exit:
+ FT_TRACE2(( "sfnt_load_face: done\n" ));
+
return error;
}
#undef LOAD_
+#undef LOADM_
FT_LOCAL_DEF( void )
diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c
index 9deb483..6f08794 100644
--- a/src/sfnt/ttcmap.c
+++ b/src/sfnt/ttcmap.c
@@ -2291,7 +2291,7 @@
ft_validator_init( FT_VALIDATOR( &valid ), cmap, limit,
FT_VALIDATE_DEFAULT );
- valid.num_glyphs = (FT_UInt)face->root.num_glyphs;
+ valid.num_glyphs = (FT_UInt)face->max_profile.numGlyphs;
if ( ft_setjmp( FT_VALIDATOR( &valid )->jump_buffer ) == 0 )
{
diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c
index db0e6bb..c81f80d 100644
--- a/src/sfnt/ttload.c
+++ b/src/sfnt/ttload.c
@@ -60,7 +60,7 @@
TT_Table limit;
- FT_TRACE3(( "tt_face_lookup_table: %08p, `%c%c%c%c' -- ",
+ FT_TRACE4(( "tt_face_lookup_table: %08p, `%c%c%c%c' -- ",
face,
(FT_Char)( tag >> 24 ),
(FT_Char)( tag >> 16 ),
@@ -76,12 +76,12 @@
/* tables the same as missing tables. */
if ( entry->Tag == tag && entry->Length != 0 )
{
- FT_TRACE3(( "found table.\n" ));
+ FT_TRACE4(( "found table.\n" ));
return entry;
}
}
- FT_TRACE3(( "could not find table!\n" ));
+ FT_TRACE4(( "could not find table!\n" ));
return 0;
}
@@ -493,29 +493,17 @@
};
- FT_TRACE2(( "tt_face_load_generic_header: "
- "%08p, looking up font table `%c%c%c%c'.\n",
- face,
- (FT_Char)( tag >> 24 ),
- (FT_Char)( tag >> 16 ),
- (FT_Char)( tag >> 8 ),
- (FT_Char)( tag ) ));
-
error = face->goto_table( face, tag, stream, 0 );
if ( error )
- {
- FT_TRACE2(( "tt_face_load_generic_header: Font table is missing!\n" ));
goto Exit;
- }
header = &face->header;
if ( FT_STREAM_READ_FIELDS( header_fields, header ) )
goto Exit;
- FT_TRACE2(( " Units per EM: %8u\n", header->Units_Per_EM ));
- FT_TRACE2(( " IndexToLoc: %8d\n", header->Index_To_Loc_Format ));
- FT_TRACE2(( "tt_face_load_generic_header: Font table loaded.\n" ));
+ FT_TRACE3(( "Units per EM: %4u\n", header->Units_Per_EM ));
+ FT_TRACE3(( "IndexToLoc: %4d\n", header->Index_To_Loc_Format ));
Exit:
return error;
@@ -596,8 +584,6 @@
};
- FT_TRACE2(( "Load_TT_MaxProfile: %08p\n", face ));
-
error = face->goto_table( face, TTAG_maxp, stream, 0 );
if ( error )
goto Exit;
@@ -605,8 +591,6 @@
if ( FT_STREAM_READ_FIELDS( maxp_fields, maxProfile ) )
goto Exit;
- face->root.num_glyphs = maxProfile->numGlyphs;
-
maxProfile->maxPoints = 0;
maxProfile->maxContours = 0;
maxProfile->maxCompositePoints = 0;
@@ -634,30 +618,9 @@
if ( maxProfile->maxFunctionDefs == 0 )
maxProfile->maxFunctionDefs = 64;
-
- face->root.internal->max_points =
- (FT_UShort)FT_MAX( maxProfile->maxCompositePoints,
- maxProfile->maxPoints );
-
- face->root.internal->max_contours =
- (FT_Short)FT_MAX( maxProfile->maxCompositeContours,
- maxProfile->maxContours );
-
- face->max_components = (FT_ULong)maxProfile->maxComponentElements +
- maxProfile->maxComponentDepth;
-
- /* XXX: some fonts have maxComponents set to 0; we will */
- /* then use 16 of them by default. */
- if ( face->max_components == 0 )
- face->max_components = 16;
-
- /* We also increase maxPoints and maxContours in order to support */
- /* some broken fonts. */
- face->root.internal->max_points += (FT_UShort)8;
- face->root.internal->max_contours += (FT_Short) 4;
}
- FT_TRACE2(( "MAXP loaded.\n" ));
+ FT_TRACE3(( "numGlyphs: %u\n", maxProfile->numGlyphs ));
Exit:
return error;
@@ -722,16 +685,9 @@
table = &face->name_table;
table->stream = stream;
- FT_TRACE2(( "Names " ));
-
error = face->goto_table( face, TTAG_name, stream, &table_len );
if ( error )
- {
- /* The name table is required so indicate failure. */
- FT_TRACE2(( "is missing!\n" ));
- error = SFNT_Err_Name_Table_Missing;
goto Exit;
- }
table_pos = FT_STREAM_POS();
@@ -751,7 +707,7 @@
if ( storage_start > storage_limit )
{
- FT_ERROR(( "tt_face_load_names: invalid `name' table\n" ));
+ FT_ERROR(( "invalid `name' table\n" ));
error = SFNT_Err_Name_Table_Missing;
goto Exit;
}
@@ -798,8 +754,6 @@
FT_FRAME_EXIT();
- FT_TRACE2(( "loaded\n" ));
-
/* everything went well, update face->num_names */
face->num_names = (FT_UShort) table->numNameRecords;
@@ -873,19 +827,10 @@
error = face->goto_table( face, TTAG_cmap, stream, &face->cmap_size );
if ( error )
- {
- FT_TRACE2(( "No `cmap' table in font !\n" ));
- error = SFNT_Err_CMap_Table_Missing;
goto Exit;
- }
- if ( !FT_FRAME_EXTRACT( face->cmap_size, face->cmap_table ) )
- FT_TRACE2(( "`cmap' table loaded\n" ));
- else
- {
- FT_ERROR(( "`cmap' table is too short!\n" ));
+ if ( FT_FRAME_EXTRACT( face->cmap_size, face->cmap_table ) )
face->cmap_size = 0;
- }
Exit:
return error;
@@ -988,19 +933,12 @@
};
- FT_TRACE2(( "OS/2 Table " ));
-
/* We now support old Mac fonts where the OS/2 table doesn't */
/* exist. Simply put, we set the `version' field to 0xFFFF */
/* and test this value each time we need to access the table. */
error = face->goto_table( face, TTAG_OS2, stream, 0 );
if ( error )
- {
- FT_TRACE2(( "is missing!\n" ));
- face->os2.version = 0xFFFFU;
- error = SFNT_Err_Ok;
goto Exit;
- }
os2 = &face->os2;
@@ -1029,7 +967,11 @@
}
}
- FT_TRACE2(( "loaded\n" ));
+ FT_TRACE3(( "sTypoAscender: %4d\n", os2->sTypoAscender ));
+ FT_TRACE3(( "sTypoDescender: %4d\n", os2->sTypoDescender ));
+ FT_TRACE3(( "usWinAscent: %4u\n", os2->usWinAscent ));
+ FT_TRACE3(( "usWinDescent: %4u\n", os2->usWinDescent ));
+ FT_TRACE3(( "fsSelection: 0x%2x\n", os2->fsSelection ));
Exit:
return error;
@@ -1078,18 +1020,19 @@
};
- FT_TRACE2(( "PostScript " ));
-
error = face->goto_table( face, TTAG_post, stream, 0 );
if ( error )
- return SFNT_Err_Post_Table_Missing;
+ return error;
if ( FT_STREAM_READ_FIELDS( post_fields, post ) )
return error;
/* we don't load the glyph names, we do that in another */
/* module (ttpost). */
- FT_TRACE2(( "loaded\n" ));
+
+ FT_TRACE3(( "FormatType: 0x%x\n", post->FormatType ));
+ FT_TRACE3(( "isFixedPitch: %s\n", post->isFixedPitch
+ ? " yes" : " no" ));
return SFNT_Err_Ok;
}
@@ -1142,22 +1085,14 @@
TT_PCLT* pclt = &face->pclt;
- FT_TRACE2(( "PCLT " ));
-
/* optional table */
error = face->goto_table( face, TTAG_PCLT, stream, 0 );
if ( error )
- {
- FT_TRACE2(( "missing (optional)\n" ));
- pclt->Version = 0;
- return SFNT_Err_Ok;
- }
+ goto Exit;
if ( FT_STREAM_READ_FIELDS( pclt_fields, pclt ) )
goto Exit;
- FT_TRACE2(( "loaded\n" ));
-
Exit:
return error;
}
@@ -1190,12 +1125,10 @@
TT_GaspRange gaspranges;
- FT_TRACE2(( "tt_face_load_gasp: %08p\n", face ));
-
/* the gasp table is optional */
error = face->goto_table( face, TTAG_gasp, stream, 0 );
if ( error )
- return SFNT_Err_Ok;
+ goto Exit;
if ( FT_FRAME_ENTER( 4L ) )
goto Exit;
@@ -1206,7 +1139,7 @@
FT_FRAME_EXIT();
num_ranges = face->gasp.numRanges;
- FT_TRACE3(( "number of ranges = %d\n", num_ranges ));
+ FT_TRACE3(( "numRanges: %u\n", num_ranges ));
if ( FT_QNEW_ARRAY( gaspranges, num_ranges ) ||
FT_FRAME_ENTER( num_ranges * 4L ) )
@@ -1219,14 +1152,13 @@
gaspranges[j].maxPPEM = FT_GET_USHORT();
gaspranges[j].gaspFlag = FT_GET_USHORT();
- FT_TRACE3(( " [max:%d flag:%d]",
- gaspranges[j].maxPPEM,
- gaspranges[j].gaspFlag ));
+ FT_TRACE3(( "gaspRange %d: rangeMaxPPEM %5d, rangeGaspBehavior 0x%x\n",
+ j,
+ gaspranges[j].maxPPEM,
+ gaspranges[j].gaspFlag ));
}
- FT_TRACE3(( "\n" ));
FT_FRAME_EXIT();
- FT_TRACE2(( "GASP loaded\n" ));
Exit:
return error;
diff --git a/src/sfnt/ttmtx.c b/src/sfnt/ttmtx.c
index 9928f30..141574c 100644
--- a/src/sfnt/ttmtx.c
+++ b/src/sfnt/ttmtx.c
@@ -66,8 +66,6 @@
FT_ULong* ptable_size;
- FT_TRACE2(( "%cmtx ", vertical ? 'v' : 'h' ));
-
if ( vertical )
{
error = face->goto_table( face, TTAG_vmtx, stream, &table_size );
@@ -92,14 +90,7 @@
*ptable_size = table_size;
- return SFNT_Err_Ok;
-
Fail:
- if ( error == SFNT_Err_Table_Missing )
- FT_TRACE2(( "missing\n" ));
- else
- FT_TRACE2(( "failed\n" ));
-
return error;
}
@@ -120,47 +111,34 @@
TT_ShortMetrics** shorts;
- FT_TRACE2(( "%cmtx ", vertical ? 'v' : 'h' ));
-
if ( vertical )
{
error = face->goto_table( face, TTAG_vmtx, stream, &table_len );
if ( error )
- {
- /* Set number_Of_VMetrics to 0! */
- face->vertical.number_Of_VMetrics = 0;
-
goto Fail;
- }
num_longs = face->vertical.number_Of_VMetrics;
if ( num_longs > table_len / 4 )
- {
num_longs = table_len / 4;
- face->vertical.number_Of_VMetrics = num_longs;
- }
- longs = (TT_LongMetrics *) &face->vertical.long_metrics;
+ face->vertical.number_Of_VMetrics = 0;
+
+ longs = (TT_LongMetrics *)&face->vertical.long_metrics;
shorts = (TT_ShortMetrics**)&face->vertical.short_metrics;
}
else
{
error = face->goto_table( face, TTAG_hmtx, stream, &table_len );
if ( error )
- {
- face->horizontal.number_Of_HMetrics = 0;
-
goto Fail;
- }
num_longs = face->horizontal.number_Of_HMetrics;
if ( num_longs > table_len / 4 )
- {
num_longs = table_len / 4;
- face->horizontal.number_Of_HMetrics = num_longs;
- }
- longs = (TT_LongMetrics *) &face->horizontal.long_metrics;
+ face->horizontal.number_Of_HMetrics = 0;
+
+ longs = (TT_LongMetrics *)&face->horizontal.long_metrics;
shorts = (TT_ShortMetrics**)&face->horizontal.short_metrics;
}
@@ -171,8 +149,7 @@
if ( num_shorts < 0 )
{
- FT_ERROR(( "%cmtx: more metrics than glyphs!\n",
- vertical ? 'v' : 'h' ));
+ FT_ERROR(( "%cmtx has more metrics than glyphs.\n" ));
/* Adobe simply ignores this problem. So we shall do the same. */
#if 0
@@ -229,16 +206,12 @@
FT_FRAME_EXIT();
- FT_TRACE2(( "loaded\n" ));
-
- return SFNT_Err_Ok;
-
- Fail:
- if ( error == SFNT_Err_Table_Missing )
- FT_TRACE2(( "missing\n" ));
+ if ( vertical )
+ face->vertical.number_Of_VMetrics = num_longs;
else
- FT_TRACE2(( "failed\n" ));
+ face->horizontal.number_Of_HMetrics = num_longs;
+ Fail:
return error;
}
@@ -298,8 +271,6 @@
};
- FT_TRACE2(( "%chea ", vertical ? 'v' : 'h' ));
-
if ( vertical )
{
error = face->goto_table( face, TTAG_vhea, stream, 0 );
@@ -320,19 +291,14 @@
if ( FT_STREAM_READ_FIELDS( metrics_header_fields, header ) )
goto Fail;
+ FT_TRACE3(( "Ascender: %5d\n", header->Ascender ));
+ FT_TRACE3(( "Descenter: %5d\n", header->Descender ));
+ FT_TRACE3(( "number_Of_Metrics: %5u\n", header->number_Of_HMetrics ));
+
header->long_metrics = NULL;
header->short_metrics = NULL;
- FT_TRACE2(( "loaded\n" ));
-
- return SFNT_Err_Ok;
-
Fail:
- if ( error == SFNT_Err_Table_Missing )
- FT_TRACE2(( "missing\n" ));
- else
- FT_TRACE2(( "failed\n" ));
-
return error;
}
@@ -438,7 +404,8 @@
FT_UShort k = header->number_Of_HMetrics;
- if ( k == 0 || gindex >= (FT_UInt)face->max_profile.numGlyphs )
+ if ( k == 0 || !header->long_metrics ||
+ gindex >= (FT_UInt)face->max_profile.numGlyphs )
{
*abearing = *aadvance = 0;
return SFNT_Err_Ok;
diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c
index 3d526db..573b1f0 100644
--- a/src/sfnt/ttpost.c
+++ b/src/sfnt/ttpost.c
@@ -175,7 +175,7 @@
/* There already exist fonts which have more than 32768 glyph names */
/* in this table, so the test for this threshold has been dropped. */
- if ( num_glyphs > face->root.num_glyphs )
+ if ( num_glyphs > face->max_profile.numGlyphs )
{
error = SFNT_Err_Invalid_File_Format;
goto Exit;
@@ -286,7 +286,7 @@
goto Exit;
/* check the number of glyphs */
- if ( num_glyphs > face->root.num_glyphs || num_glyphs > 258 )
+ if ( num_glyphs > face->max_profile.numGlyphs || num_glyphs > 258 )
{
error = SFNT_Err_Invalid_File_Format;
goto Exit;
@@ -448,7 +448,7 @@
if ( !face )
return SFNT_Err_Invalid_Face_Handle;
- if ( idx >= (FT_UInt)face->root.num_glyphs )
+ if ( idx >= (FT_UInt)face->max_profile.numGlyphs )
return SFNT_Err_Invalid_Glyph_Index;
#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c
index 407c1bd..9e7a91e 100644
--- a/src/sfnt/ttsbit.c
+++ b/src/sfnt/ttsbit.c
@@ -584,40 +584,6 @@
}
}
- /* now set up the root fields to indicate the strikes */
- if ( face->num_sbit_strikes )
- {
- FT_ULong n;
- FT_Face root = FT_FACE( face );
-
-
- if ( FT_NEW_ARRAY( root->available_sizes, face->num_sbit_strikes ) )
- goto Exit;
-
- for ( n = 0 ; n < face->num_sbit_strikes ; n++ )
- {
- FT_Bitmap_Size* bsize = root->available_sizes + n;
- TT_SBit_Strike strike = face->sbit_strikes + n;
- FT_UShort fupem = face->header.Units_Per_EM;
- FT_Short avg = face->os2.xAvgCharWidth;
-
-
- /* XXX: Is this correct? */
- bsize->height = strike->hori.ascender - strike->hori.descender;
- bsize->width =
- (FT_Short)( ( avg * strike->y_ppem + fupem / 2 ) / fupem );
-
- /* assume 72dpi */
- bsize->size = strike->y_ppem << 6;
-
- bsize->x_ppem = strike->x_ppem << 6;
- bsize->y_ppem = strike->y_ppem << 6;
- }
-
- root->face_flags |= FT_FACE_FLAG_FIXED_SIZES;
- root->num_fixed_sizes = (FT_Int)face->num_sbit_strikes;
- }
-
Exit:
return error;
}
diff --git a/src/sfnt/ttsbit0.c b/src/sfnt/ttsbit0.c
index 12d5d7a..1ade208 100644
--- a/src/sfnt/ttsbit0.c
+++ b/src/sfnt/ttsbit0.c
@@ -94,7 +94,7 @@
FT_ULong num_strikes, table_size;
FT_Byte* p;
FT_Byte* p_limit;
- FT_UInt nn, count;
+ FT_UInt count;
face->sbit_num_strikes = 0;
@@ -142,50 +142,7 @@
face->sbit_num_strikes = count;
- /*
- * Now allocate the root array of FT_Bitmap_Size records and
- * populate them. Unfortunately, it isn't possible to indicate bit
- * depths in the FT_Bitmap_Size record. This is a design error.
- */
- {
- FT_Memory memory = face->root.stream->memory;
- FT_UInt em_size = (FT_UInt)face->header.Units_Per_EM;
- FT_Short avgwidth = face->os2.xAvgCharWidth;
-
-
- if ( FT_NEW_ARRAY( face->root.available_sizes, count ) )
- goto Fail;
-
- for ( nn = 0; nn < count; nn++ )
- {
- FT_Bitmap_Size* bsize = face->root.available_sizes + nn;
- FT_UInt x_ppem, y_ppem;
- FT_Char ascender, descender;
-
-
- ascender = (FT_Char)p[16];
- descender = (FT_Char)p[17];
- x_ppem = p[44];
- y_ppem = p[45];
-
- bsize->x_ppem = (FT_Pos)( x_ppem << 6 );
- bsize->y_ppem = (FT_Pos)( y_ppem << 6 );
-
- /* XXX: Is this correct? */
- bsize->height = (FT_Short)( ascender - descender );
- bsize->width = (FT_Short)( ( avgwidth * y_ppem + em_size / 2 ) /
- em_size );
-
- /* assume 72dpi */
- bsize->size = bsize->y_ppem;
-
- p += 48;
- }
-
- face->root.face_flags |= FT_FACE_FLAG_FIXED_SIZES;
- face->root.num_fixed_sizes = count;
- }
-
+ FT_TRACE3(( "sbit_num_strikes: %u\n", count ));
Exit:
return error;
@@ -222,22 +179,20 @@
FT_ULong strike_index,
FT_Size_Metrics* metrics )
{
- FT_Bitmap_Size* bsize;
FT_Byte* strike;
if ( strike_index >= (FT_ULong)face->sbit_num_strikes )
return SFNT_Err_Invalid_Argument;
- bsize = ( (FT_Face)face )->available_sizes + strike_index;
strike = face->sbit_table + 8 + strike_index * 48;
- metrics->x_ppem = (FT_UShort)( bsize->x_ppem >> 6 );
- metrics->y_ppem = (FT_UShort)( bsize->y_ppem >> 6 );
- metrics->height = (FT_UShort)( bsize->height << 6 );
+ metrics->x_ppem = (FT_UShort)strike[44];
+ metrics->y_ppem = (FT_UShort)strike[45];
metrics->ascender = (FT_Char)strike[16] << 6; /* hori.ascender */
metrics->descender = (FT_Char)strike[17] << 6; /* hori.descender */
+ metrics->height = metrics->ascender - metrics->descender;
/* XXX: Is this correct? */
metrics->max_advance = ( (FT_Char)strike[22] + /* min_origin_SB */
diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c
index 58f2711..037480b 100644
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -175,7 +175,6 @@
tt_size_request( FT_Size size,
FT_Size_Request req )
{
- TT_Face ttface = (TT_Face)size->face;
TT_Size ttsize = (TT_Size)size;
FT_Error error = TT_Err_Ok;
@@ -184,6 +183,7 @@
if ( FT_HAS_FIXED_SIZES( size->face ) )
{
+ TT_Face ttface = (TT_Face)size->face;
SFNT_Service sfnt = ttface->sfnt;
FT_ULong index;
diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
index a6b55b9..df252aa 100644
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -394,10 +394,6 @@
FT_Memory memory = exec->memory;
- /* free composite load stack */
- FT_FREE( exec->loadStack );
- exec->loadSize = 0;
-
/* points zone */
exec->maxPoints = 0;
exec->maxContours = 0;
@@ -462,11 +458,9 @@
exec->maxContours = 0;
exec->stackSize = 0;
- exec->loadSize = 0;
exec->glyphSize = 0;
exec->stack = NULL;
- exec->loadStack = NULL;
exec->glyphIns = NULL;
exec->face = NULL;
@@ -594,14 +588,6 @@
exec->twilight = size->twilight;
}
- error = Update_Max( exec->memory,
- &exec->loadSize,
- sizeof ( TT_SubGlyphRec ),
- (void**)&exec->loadStack,
- exec->face->max_components + 1 );
- if ( error )
- return error;
-
/* XXX: We reserve a little more elements on the stack to deal safely */
/* with broken fonts like arialbs, courbs, timesbs, etc. */
tmp = exec->stackSize;
diff --git a/src/truetype/ttinterp.h b/src/truetype/ttinterp.h
index 86f1ade..d8be892 100644
--- a/src/truetype/ttinterp.h
+++ b/src/truetype/ttinterp.h
@@ -216,9 +216,6 @@ FT_BEGIN_HEADER
TT_Set_CVT_Func func_write_cvt; /* write a cvt entry (in pixels) */
TT_Set_CVT_Func func_move_cvt; /* incr a cvt entry (in pixels) */
- FT_ULong loadSize;
- TT_SubGlyph_Stack loadStack; /* loading subglyph stack */
-
FT_Bool grayscale; /* are we hinting for grayscale? */
} TT_ExecContextRec;
diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c
index c7636ef..74b925a 100644
--- a/src/type1/t1objs.c
+++ b/src/type1/t1objs.c
@@ -439,9 +439,6 @@
root->underline_position = (FT_Short)info->underline_position;
root->underline_thickness = (FT_Short)info->underline_thickness;
-
- root->internal->max_points = 0;
- root->internal->max_contours = 0;
}
{
diff --git a/src/type42/t42objs.c b/src/type42/t42objs.c
index a67f858..30d9dcc 100644
--- a/src/type42/t42objs.c
+++ b/src/type42/t42objs.c
@@ -302,9 +302,6 @@
root->underline_position = (FT_Short)info->underline_position;
root->underline_thickness = (FT_Short)info->underline_thickness;
- root->internal->max_points = 0;
- root->internal->max_contours = 0;
-
/* compute style flags */
root->style_flags = 0;
if ( info->italic_angle )