various cleanups to reduce compiler warnings + support for CID-keyed fonts in the CFF driver (still some unexpected bugs though..)
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 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332
diff --git a/CHANGES b/CHANGES
index d19b854..659f0b4 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,39 @@
LATEST CHANGES
+ - added support for CID-keyed fonts to the CFF driver. There are still
+ some unexplained bugs though... ???
+
+
+ - cleaned up source code in order to avoid two functions with the
+ same name. Also changed the names of the files in "type1z" from
+ "t1XXXX" to "z1XXXX" in order to avoid any conflicts.
+
+ "make multi" now works well :-)
+
+
+
+ - CHANGES TO THE RENDERER MODULES
+
+ the monochrome and smooth renderers are now in two distinct directories,
+ namely "src/raster1" and "src/smooth". Note that the old "src/renderer"
+ is now gone..
+
+ I ditched the 5-gray-levels renderers. Basically, it involved a simple
+ #define toggle in 'src/raster1/ftraster.c'
+
+ FT_Render_Glyph, FT_Outline_Render & FT_Outline_Get_Bitmap now select
+ the best renderer available, depending on render mode. If the current
+ renderer for a given glyph image format isn't capable of supporting
+ the render mode, another one will be found in the library's list.
+
+ This means that client applications do not need to switch or set the
+ renderers themselves (as in the latest change), they'll get what they
+ want automatically... At last..
+
+ Changed the demo programs accordingly..
+
+
+
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
diff --git a/config/win32/w32-dev.mk b/config/win32/w32-dev.mk
index daa6a8a..294d63a 100644
--- a/config/win32/w32-dev.mk
+++ b/config/win32/w32-dev.mk
@@ -98,7 +98,7 @@ T := -o # Don't remove this comment line! We need the space after `-o'.
# ANSI compliance.
#
ifndef CFLAGS
- CFLAGS := -c -g -O0 -Wall
+ CFLAGS := -c -g -O0 -Wall -W
endif
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
diff --git a/demos/src/ftmulti.c b/demos/src/ftmulti.c
index 5a5b20e..34fce60 100644
--- a/demos/src/ftmulti.c
+++ b/demos/src/ftmulti.c
@@ -13,7 +13,6 @@
/****************************************************************************/
#include <freetype/freetype.h>
-#include <freetype/ftrender.h>
#include <freetype/ftmm.h>
#include "common.h"
@@ -74,10 +73,6 @@
int render_mode = 1;
int use_grays = 1;
- /* the standard raster's interface */
- FT_Renderer std_renderer;
- FT_Renderer smooth_renderer;
-
FT_Multi_Master multimaster;
FT_Long design_pos[T1_MAX_MM_AXIS];
@@ -432,7 +427,6 @@
grWriteln(" h : toggle outline hinting" );
grWriteln(" b : toggle embedded bitmaps" );
grWriteln(" l : toggle low precision rendering" );
- grWriteln(" g : toggle between `smooth' and `standard' anti-aliaser" );
grWriteln(" space : toggle rendering mode" );
grLn();
grWriteln(" Up : increase pointsize by 1 unit" );
@@ -457,15 +451,6 @@
}
- static
- void reset_raster( void )
- {
- if ( antialias && use_grays && smooth_renderer )
- FT_Set_Renderer( library, smooth_renderer, 0, 0 );
- else
- FT_Set_Renderer( library, std_renderer, 0, 0 );
- }
-
static
int Process_Event( grEvent* event )
@@ -489,7 +474,6 @@
antialias = !antialias;
new_header = antialias ? "anti-aliasing is now on"
: "anti-aliasing is now off";
- reset_raster();
return 1;
case grKEY( 'b' ):
@@ -502,13 +486,6 @@
case grKEY( 'p' ):
return (int)event->key;
- case grKEY( 'g' ):
- use_grays = !use_grays;
- new_header = use_grays ? "now using the smooth anti-aliaser"
- : "now using the standard anti-aliaser";
- reset_raster();
- break;
-
case grKEY( 'l' ):
low_prec = !low_prec;
new_header = low_prec ? "rendering precision is now forced to low"
@@ -714,13 +691,6 @@
if ( error )
PanicZ( "Could not initialize FreeType library" );
- /* retrieve the standard raster's interface */
- std_renderer = (FT_Renderer)FT_Get_Module( library, "standard renderer" );
- if (!std_renderer)
- PanicZ( "Could not retrieve standard renderer" );
-
- smooth_renderer = (FT_Renderer)FT_Get_Module( library, "smooth renderer" );
-
NewFile:
ptsize = orig_ptsize;
hinted = 1;
diff --git a/demos/src/ftstring.c b/demos/src/ftstring.c
index 6b0558d..3478f5c 100644
--- a/demos/src/ftstring.c
+++ b/demos/src/ftstring.c
@@ -11,7 +11,6 @@
/****************************************************************************/
#include <freetype/freetype.h>
-#include <freetype/ftrender.h>
#include <freetype/ftglyph.h>
#include "common.h"
@@ -60,11 +59,6 @@
static int graph_init = 0;
static int render_mode = 1;
- static int use_grays = 1;
-
- /* the standard raster's interface */
- FT_Renderer std_renderer;
- FT_Renderer smooth_renderer;
static FT_Matrix trans_matrix;
static int transform = 0;
@@ -449,7 +443,6 @@
grWriteln(" a : toggle anti-aliasing" );
grWriteln(" h : toggle outline hinting" );
grWriteln(" k : toggle kerning" );
- grWriteln(" g : toggle between 'smooth' and 'standard' anti-aliaser" );
grLn();
grWriteln(" Up : increase pointsize by 1 unit" );
grWriteln(" Down : decrease pointsize by 1 unit" );
@@ -468,15 +461,6 @@
}
- static void reset_raster( void )
- {
- if ( antialias && use_grays && smooth_renderer )
- FT_Set_Renderer( library, smooth_renderer, 0, 0 );
- else
- FT_Set_Renderer( library, std_renderer, 0, 0 );
- }
-
-
static int Process_Event( grEvent* event )
{
int i;
@@ -499,7 +483,6 @@
new_header = ( antialias
? "anti-aliasing is now on"
: "anti-aliasing is now off" );
- reset_raster();
return 1;
case grKEY('b'):
@@ -513,14 +496,6 @@
case grKEY('p'):
return (int)event->key;
- case grKEY('g'):
- use_grays = !use_grays;
- new_header = ( use_grays
- ? "now using the smooth anti-aliaser"
- : "now using the standard anti-aliaser" );
- reset_raster();
- break;
-
case grKEY('h'):
hinted = !hinted;
new_header = ( hinted
@@ -668,13 +643,6 @@
error = FT_Init_FreeType( &library );
if (error) PanicZ( "Could not initialise FreeType library" );
- /* retrieve the standard raster's interface */
- std_renderer = (FT_Renderer)FT_Get_Module( library, "standard renderer" );
- if (!std_renderer)
- PanicZ( "Could not retrieve standard renderer" );
-
- smooth_renderer = (FT_Renderer)FT_Get_Module( library, "smooth renderer" );
-
NewFile:
ptsize = orig_ptsize;
hinted = 1;
diff --git a/demos/src/ftview.c b/demos/src/ftview.c
index 43f4dfe..8b1e8bf 100644
--- a/demos/src/ftview.c
+++ b/demos/src/ftview.c
@@ -17,7 +17,6 @@
#include <freetype/freetype.h>
-#include <freetype/ftrender.h>
/* the following header shouldn't be used in normal programs */
#include <freetype/internal/ftdebug.h>
@@ -64,7 +63,7 @@
int ptsize; /* current point size */
int hinted = 1; /* is glyph hinting active? */
- int antialias = 0; /* is anti-aliasing active? */
+ int antialias = 1; /* is anti-aliasing active? */
int use_sbits = 1; /* do we use embedded bitmaps? */
int low_prec = 0; /* force low precision */
int Num; /* current first glyph index */
@@ -78,14 +77,9 @@
int graph_init = 0;
int render_mode = 1;
- int use_grays = 1;
int debug = 0;
int trace_level = 0;
- /* the standard raster's interface */
- FT_Renderer std_renderer;
- FT_Renderer smooth_renderer;
-
#define RASTER_BUFF_SIZE 32768
char raster_buff[RASTER_BUFF_SIZE];
@@ -152,79 +146,44 @@
#define CEIL( x ) ( ( (x) + 63 ) & -64 )
#define TRUNC( x ) ( (x) >> 6 )
- static
- char bit_buffer[MAX_BUFFER];
-
/* Render a single glyph with the `grays' component */
static
FT_Error Render_Glyph( int x_offset,
int y_offset )
{
- /* first, render the glyph into an intermediate buffer */
- FT_Bitmap bit2;
- grBitmap bit3;
- int width, height, pitch, size;
- int left, right, top, bottom;
- int x_top, y_top;
-
-
- left = FLOOR( glyph->metrics.horiBearingX );
- right = CEIL( glyph->metrics.horiBearingX + glyph->metrics.width );
- width = TRUNC( right - left );
-
- top = CEIL( glyph->metrics.horiBearingY );
- bottom = FLOOR( glyph->metrics.horiBearingY - glyph->metrics.height );
- height = TRUNC( top - bottom );
-
- if ( glyph->format == ft_glyph_format_outline )
+ grBitmap bit3;
+ FT_Pos x_top, y_top;
+
+ /* first, render the glyph image into a bitmap */
+ if (glyph->format != ft_glyph_format_bitmap)
{
- pitch = antialias ? ( width + 3 ) & -4
- : ( width + 7 ) >> 3;
- size = pitch * height;
-
- if ( size > MAX_BUFFER )
- return FT_Err_Out_Of_Memory;
-
- bit2.width = width;
- bit2.rows = height;
- bit2.pitch = pitch;
- bit2.pixel_mode = antialias ? ft_pixel_mode_grays : ft_pixel_mode_mono;
- bit2.buffer = bit_buffer;
-
- bit3.rows = bit2.rows;
- bit3.width = bit2.width;
- bit3.pitch = bit2.pitch;
- bit3.mode = antialias ? bit.mode : gr_pixel_mode_mono;
- bit3.buffer = bit_buffer;
- bit3.grays = 256;
-
- FT_Outline_Translate( &glyph->outline, -left, -bottom );
- memset( bit_buffer, 0, size );
-
- if ( low_prec )
- glyph->outline.flags &= ~ft_outline_high_precision;
-
- error = FT_Outline_Get_Bitmap( library, &glyph->outline, &bit2 );
+ error = FT_Render_Glyph( glyph, antialias ? 1 : 0 );
+ if (error) return error;
+
}
- else
+
+ /* now blit it to our display screen */
+ bit3.rows = glyph->bitmap.rows;
+ bit3.width = glyph->bitmap.width;
+ bit3.pitch = glyph->bitmap.pitch;
+ bit3.buffer = glyph->bitmap.buffer;
+
+ switch (glyph->bitmap.pixel_mode)
{
- bit3.rows = glyph->bitmap.rows;
- bit3.width = glyph->bitmap.width;
- bit3.pitch = glyph->bitmap.pitch;
- bit3.mode = gr_pixel_mode_mono;
- bit3.buffer = glyph->bitmap.buffer;
- bit3.grays = 0;
+ case ft_pixel_mode_mono:
+ bit3.mode = gr_pixel_mode_mono;
+ bit3.grays = 0;
+ break;
+
+ case ft_pixel_mode_grays:
+ bit3.mode = gr_pixel_mode_gray;
+ bit3.grays = glyph->bitmap.num_grays;
}
/* Then, blit the image to the target surface */
- x_top = x_offset + TRUNC( left );
- y_top = y_offset - TRUNC( top );
-
-#if 0
- if ( bit.pitch < 0 )
- y_top = bit.rows - y_top;
-#endif
+ x_top = x_offset + glyph->bitmap_left;
+ y_top = y_offset - glyph->bitmap_top;
grBlitGlyphToBitmap( &bit, &bit3, x_top, y_top, fore_color );
@@ -431,7 +390,6 @@
grWriteln(" h : toggle outline hinting" );
grWriteln(" b : toggle embedded bitmaps" );
grWriteln(" l : toggle low precision rendering" );
- grWriteln(" g : toggle between `smooth' and `standard' anti-aliaser" );
grWriteln(" space : toggle rendering mode" );
grLn();
grWriteln(" Up : increase pointsize by 1 unit" );
@@ -456,15 +414,6 @@
}
- static
- void reset_raster( void )
- {
- if ( antialias && use_grays && smooth_renderer )
- FT_Set_Renderer( library, smooth_renderer, 0, 0 );
- else
- FT_Set_Renderer( library, std_renderer, 0, 0 );
- }
-
static
int Process_Event( grEvent* event )
@@ -482,7 +431,6 @@
antialias = !antialias;
new_header = antialias ? "anti-aliasing is now on"
: "anti-aliasing is now off";
- reset_raster();
return 1;
case grKEY( 'b' ):
@@ -496,14 +444,6 @@
case grKEY( 'p' ):
return (int)event->key;
- case grKEY( 'g' ):
- use_grays = !use_grays;
- new_header = use_grays
- ? "now using the smooth anti-aliaser"
- : "now using the standard anti-aliaser";
- reset_raster();
- break;
-
case grKEY( 'l' ):
low_prec = !low_prec;
new_header = low_prec
@@ -672,13 +612,6 @@
if ( error )
PanicZ( "Could not initialize FreeType library" );
- /* retrieve the standard raster's interface */
- std_renderer = (FT_Renderer)FT_Get_Module( library, "standard renderer" );
- if (!std_renderer)
- PanicZ( "Could not retrieve standard renderer" );
-
- smooth_renderer = (FT_Renderer)FT_Get_Module( library, "smooth renderer" );
-
NewFile:
ptsize = orig_ptsize;
hinted = 1;
diff --git a/include/freetype/config/ftmodule.h b/include/freetype/config/ftmodule.h
index 1fb091a..69ef5f7 100644
--- a/include/freetype/config/ftmodule.h
+++ b/include/freetype/config/ftmodule.h
@@ -1,9 +1,9 @@
FT_USE_MODULE(cff_driver_class)
FT_USE_MODULE(t1cid_driver_class)
FT_USE_MODULE(psnames_module_class)
-FT_USE_MODULE(ft_standard_renderer_class)
-FT_USE_MODULE(ft_smooth_renderer_class)
+FT_USE_MODULE(ft_raster1_renderer_class)
FT_USE_MODULE(sfnt_module_class)
+FT_USE_MODULE(ft_smooth_renderer_class)
FT_USE_MODULE(tt_driver_class)
FT_USE_MODULE(t1_driver_class)
FT_USE_MODULE(t1z_driver_class)
diff --git a/include/freetype/fterrors.h b/include/freetype/fterrors.h
index de3f945..3c7c760 100644
--- a/include/freetype/fterrors.h
+++ b/include/freetype/fterrors.h
@@ -55,6 +55,7 @@ FT_ERROR_START_LIST
FT_ERRORDEF( FT_Err_Unimplemented_Feature, 0x0020, "unimplemented feature" )
FT_ERRORDEF( FT_Err_Invalid_Glyph_Format, 0x0021, "invalid glyph image format" )
+ FT_ERRORDEF( FT_Err_Cannot_Render_Glyph, 0x0022, "cannot render this glyph format" )
FT_ERRORDEF( FT_Err_Invalid_Library_Handle, 0x0030, "invalid library handle" )
FT_ERRORDEF( FT_Err_Invalid_Driver_Handle, 0x0031, "invalid module handle" )
diff --git a/include/freetype/ftrender.h b/include/freetype/ftrender.h
index c0169f6..f7d6295 100644
--- a/include/freetype/ftrender.h
+++ b/include/freetype/ftrender.h
@@ -49,7 +49,8 @@
typedef FT_Error (*FTRenderer_render)( FT_Renderer renderer,
FT_GlyphSlot slot,
- FT_UInt mode );
+ FT_UInt mode,
+ FT_Vector* origin );
typedef FT_Error (*FTRenderer_transform)( FT_Renderer renderer,
FT_GlyphSlot slot,
diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h
index 5c4e824..a15bab4 100644
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -384,14 +384,14 @@
FT_Generic generic;
- FT_Int num_modules;
+ FT_UInt num_modules;
FT_Module modules[ FT_MAX_MODULES ]; /* module objects */
FT_ListRec renderers; /* list of renderers */
FT_Renderer cur_renderer; /* current outline renderer */
void* raster_pool; /* scan-line conversion render pool */
- long raster_pool_size; /* size of render pool in bytes */
+ unsigned long raster_pool_size; /* size of render pool in bytes */
FT_DebugHook_Func debug_hooks[4];
@@ -411,6 +411,14 @@
FT_DebugHook_Func debug_hook );
+ BASE_DEF(FT_Renderer) FT_Lookup_Renderer( FT_Library library,
+ FT_Glyph_Format format,
+ FT_ListNode *node );
+
+ BASE_DEF(FT_Error) FT_Render_Glyph_Internal( FT_Library library,
+ FT_GlyphSlot slot,
+ FT_UInt render_mode );
+
#ifndef FT_CONFIG_OPTION_NO_DEFAULT_SYSTEM
diff --git a/include/freetype/internal/t2types.h b/include/freetype/internal/t2types.h
index 7922355..2b01589 100644
--- a/include/freetype/internal/t2types.h
+++ b/include/freetype/internal/t2types.h
@@ -62,7 +62,7 @@
} CFF_Index;
- typedef struct CFF_Top_Dict_
+ typedef struct CFF_Font_Dict_
{
FT_UInt version;
FT_UInt notice;
@@ -90,6 +90,7 @@
FT_UInt base_font_name;
FT_UInt postscript;
+ /* these should only be used for the top-level font dict */
FT_UInt cid_registry;
FT_UInt cid_ordering;
FT_ULong cid_supplement;
@@ -103,7 +104,9 @@
FT_ULong cid_fd_select_offset;
FT_UInt cid_font_name;
- } CFF_Top_Dict;
+ } CFF_Font_Dict;
+
+
typedef struct CFF_Private_
{
@@ -138,12 +141,49 @@
FT_Pos nominal_width;
} CFF_Private;
+
+
+ typedef struct CFF_FD_Select_
+ {
+ FT_Byte format;
+ FT_UInt range_count;
+
+ /* that's the table, taken from the file 'as is' */
+ FT_Byte* data;
+ FT_UInt data_size;
+
+ /* small cache for format 3 only */
+ FT_UInt cache_first;
+ FT_UInt cache_count;
+ FT_Byte cache_fd;
+
+ } CFF_FD_Select;
+
+
+
+ /* a SubFont packs a font dict and a private dict together. They're */
+ /* needed to support CID-keyde CFF fonts.. */
+ typedef struct CFF_SubFont_
+ {
+ CFF_Font_Dict font_dict;
+ CFF_Private private_dict;
+
+ CFF_Index local_subrs_index;
+ FT_UInt num_local_subrs;
+ FT_Byte** local_subrs;
+
+ } CFF_SubFont;
+
+
+ /* maximum number of sub-fonts in a CID-keyed file */
+ #define CFF_MAX_CID_FONTS 16
typedef struct CFF_Font_
{
FT_Stream stream;
FT_Memory memory;
FT_UInt num_faces;
+ FT_UInt num_glyphs;
FT_Byte version_major;
FT_Byte version_minor;
@@ -164,13 +204,14 @@
CFF_Index local_subrs_index;
FT_String* font_name;
- CFF_Top_Dict top_dict;
- CFF_Private private_dict;
-
FT_UInt num_global_subrs;
- FT_UInt num_local_subrs;
FT_Byte** global_subrs;
- FT_Byte** local_subrs;
+
+ CFF_SubFont top_font;
+ FT_UInt num_subfonts;
+ CFF_SubFont* subfonts[ CFF_MAX_CID_FONTS ];
+
+ CFF_FD_Select fd_select;
} CFF_Font;
diff --git a/src/cff/t2gload.c b/src/cff/t2gload.c
index 0503326..8a71951 100644
--- a/src/cff/t2gload.c
+++ b/src/cff/t2gload.c
@@ -345,18 +345,37 @@
T2_Init_Builder( &decoder->builder, face, size, slot );
/* initialize Type2 decoder */
- decoder->num_locals = cff->num_local_subrs;
decoder->num_globals = cff->num_global_subrs;
- decoder->locals = cff->local_subrs;
decoder->globals = cff->global_subrs;
- decoder->locals_bias = t2_compute_bias( decoder->num_locals );
decoder->globals_bias = t2_compute_bias( decoder->num_globals );
-
- decoder->glyph_width = cff->private_dict.default_width;
- decoder->nominal_width = cff->private_dict.nominal_width;
}
+ /* this function is used to select the locals subrs array */
+ LOCAL_DEF
+ void T2_Prepare_Decoder( T2_Decoder* decoder,
+ FT_UInt glyph_index )
+ {
+ CFF_Font* cff = (CFF_Font*)decoder->builder.face->extra.data;
+ CFF_SubFont* sub = &cff->top_font;
+
+ /* manage CID fonts */
+ if (cff->num_subfonts >= 1)
+ {
+ FT_Byte fd_index = CFF_Get_FD( &cff->fd_select, glyph_index );
+ sub = cff->subfonts[fd_index];
+ }
+
+ decoder->num_locals = sub->num_local_subrs;
+ decoder->locals = sub->local_subrs;
+ decoder->locals_bias = t2_compute_bias( decoder->num_locals );
+
+ decoder->glyph_width = sub->private_dict.default_width;
+ decoder->nominal_width = sub->private_dict.nominal_width;
+ }
+
+
+
/* check that there is enough room for `count' more points */
static
FT_Error check_points( T2_Builder* builder,
@@ -509,7 +528,6 @@
FT_Fixed seed;
FT_Fixed* stack;
-
/* set default width */
decoder->num_hints = 0;
decoder->read_width = 1;
@@ -1572,6 +1590,7 @@
&charstring, &charstring_len );
if ( !error )
{
+ T2_Prepare_Decoder( &decoder, glyph_index );
error = T2_Parse_CharStrings( &decoder, charstring, charstring_len );
T2_Forget_Element( &cff->charstrings_index, &charstring );
@@ -1648,6 +1667,7 @@
&charstring, &charstring_len );
if ( !error )
{
+ T2_Prepare_Decoder( &decoder, glyph_index );
error = T2_Parse_CharStrings( &decoder, charstring, charstring_len );
T2_Forget_Element( &cff->charstrings_index, &charstring );
diff --git a/src/cff/t2gload.h b/src/cff/t2gload.h
index ef61576..605ba5e 100644
--- a/src/cff/t2gload.h
+++ b/src/cff/t2gload.h
@@ -166,6 +166,9 @@
T2_Size size,
T2_GlyphSlot slot );
+ LOCAL_DEF
+ void T2_Prepare_Decoder( T2_Decoder* decoder,
+ FT_UInt glyph_index );
#if 0 /* unused until we support pure CFF fonts */
diff --git a/src/cff/t2load.c b/src/cff/t2load.c
index 6d16f60..8758cc2 100644
--- a/src/cff/t2load.c
+++ b/src/cff/t2load.c
@@ -318,6 +318,239 @@
#endif /* 0 */
+ /**********************************************************************/
+ /**********************************************************************/
+ /*** ***/
+ /*** FD Select table support ***/
+ /*** ***/
+ /*** ***/
+ /**********************************************************************/
+ /**********************************************************************/
+
+ static
+ void CFF_Done_FD_Select( CFF_FD_Select* select,
+ FT_Stream stream )
+ {
+ if (select->data)
+ RELEASE_Frame( select->data );
+
+ select->data_size = 0;
+ select->format = 0;
+ select->range_count = 0;
+ }
+
+
+ static
+ FT_Error CFF_Load_FD_Select( CFF_FD_Select* select,
+ FT_UInt num_glyphs,
+ FT_Stream stream,
+ FT_ULong offset )
+ {
+ FT_Error error;
+ FT_Byte format;
+ FT_UInt num_ranges;
+
+ /* read format */
+ if ( FILE_Seek(offset) || READ_Byte(format) )
+ goto Exit;
+
+ select->format = format;
+ switch (format)
+ {
+ case 0: /* format 0, that's simple */
+ {
+ select->data_size = num_glyphs;
+ goto Load_Data;
+ }
+
+
+ case 3: /* format 3, a tad more complex */
+ {
+ if ( READ_UShort(num_ranges) )
+ goto Exit;
+
+ select->data_size = num_ranges*3+2;
+
+ Load_Data:
+ if ( EXTRACT_Frame( select->data_size, select->data ) )
+ goto Exit;
+ }
+ break;
+
+
+ default: /* humm.. that's wrong */
+ error = FT_Err_Invalid_File_Format;
+ }
+ Exit:
+ return error;
+ }
+
+
+ LOCAL_FUNC
+ FT_Byte CFF_Get_FD( CFF_FD_Select* select,
+ FT_UInt glyph_index )
+ {
+ FT_Byte fd = 0;
+
+ switch (select->format)
+ {
+ case 0:
+ fd = select->data[glyph_index];
+ break;
+
+ case 3:
+ /* first, compare to cache */
+ if ((FT_UInt)(glyph_index-select->cache_first) < select->cache_count)
+ {
+ fd = select->cache_fd;
+ break;
+ }
+
+ /* then, lookup the ranges array */
+ {
+ FT_Byte* p = select->data;
+ FT_Byte* p_limit = p + select->data_size;
+ FT_Byte fd2;
+ FT_UInt first, limit;
+
+ first = NEXT_UShort(p);
+ do
+ {
+ if (glyph_index < first)
+ break;
+
+ fd2 = *p++;
+ limit = NEXT_UShort(p);
+
+ if (glyph_index < limit)
+ {
+ fd = fd2;
+
+ /* update cache */
+ select->cache_first = first;
+ select->cache_count = limit-first;
+ select->cache_fd = fd2;
+ break;
+ }
+ first = limit;
+ }
+ while (p < p_limit);
+ }
+ break;
+
+ default:
+ ;
+ }
+ return fd;
+ }
+
+
+ /**********************************************************************/
+ /**********************************************************************/
+ /*** ***/
+ /*** CFF font support ***/
+ /*** ***/
+ /*** ***/
+ /**********************************************************************/
+ /**********************************************************************/
+
+ static
+ FT_Error CFF_Load_SubFont( CFF_SubFont* font,
+ CFF_Index* index,
+ FT_UInt font_index,
+ FT_Stream stream,
+ FT_ULong base_offset )
+ {
+ FT_Error error;
+ T2_Parser parser;
+ FT_Byte* dict;
+ FT_ULong dict_len;
+ CFF_Font_Dict* top = &font->font_dict;
+ CFF_Private* priv = &font->private_dict;
+
+ T2_Parser_Init( &parser, T2CODE_TOPDICT, &font->font_dict );
+
+ /* set defaults */
+ MEM_Set( top, 0, sizeof ( *top ) );
+
+ top->underline_position = -100;
+ top->underline_thickness = 50;
+ top->charstring_type = 2;
+ top->font_matrix.xx = 0x10000L;
+ top->font_matrix.yy = 0x10000L;
+ top->cid_count = 8720;
+
+ error = T2_Access_Element( index, font_index, &dict, &dict_len ) ||
+ T2_Parser_Run( &parser, dict, dict + dict_len );
+
+ T2_Forget_Element( index, &dict );
+
+ if ( error )
+ goto Exit;
+
+ /* if it's a CID font, we stop there */
+ if ( top->cid_registry )
+ goto Exit;
+
+ /* parse the private dictionary, if any */
+ if ( top->private_offset && top->private_size)
+ {
+ /* set defaults */
+ MEM_Set( priv, 0, sizeof(*priv) );
+
+ priv->blue_shift = 7;
+ priv->blue_fuzz = 1;
+ priv->lenIV = -1;
+ priv->expansion_factor = (FT_Fixed)0.06 * 0x10000L;
+ priv->blue_scale = (FT_Fixed)0.039625 * 0x10000L;
+
+ T2_Parser_Init( &parser, T2CODE_PRIVATE, priv );
+
+ if ( FILE_Seek( base_offset + font->font_dict.private_offset ) ||
+ ACCESS_Frame( font->font_dict.private_size ) )
+ goto Exit;
+
+ error = T2_Parser_Run( &parser,
+ (FT_Byte*)stream->cursor,
+ (FT_Byte*)stream->limit );
+ FORGET_Frame();
+ if ( error )
+ goto Exit;
+ }
+
+ /* read the local subrs, if any */
+ if ( priv->local_subrs_offset )
+ {
+ if ( FILE_Seek( base_offset + top->private_offset +
+ priv->local_subrs_offset ) )
+ goto Exit;
+
+ error = t2_new_cff_index( &font->local_subrs_index, stream, 1 );
+ if ( error )
+ goto Exit;
+
+ font->num_local_subrs = font->local_subrs_index.count;
+ error = t2_explicit_cff_index( &font->local_subrs_index,
+ &font->local_subrs );
+ }
+
+ Exit:
+ return error;
+ }
+
+
+ static
+ void CFF_Done_SubFont( FT_Memory memory,
+ CFF_SubFont* subfont )
+ {
+ if (subfont)
+ {
+ t2_done_cff_index( &subfont->local_subrs_index );
+ FREE( subfont->local_subrs );
+ }
+ }
+
+
LOCAL_FUNC
FT_Error T2_Load_CFF_Font( FT_Stream stream,
@@ -334,14 +567,16 @@
FT_FRAME_END
};
- FT_Error error;
- FT_Memory memory = stream->memory;
- FT_ULong base_offset;
+ FT_Error error;
+ FT_Memory memory = stream->memory;
+ FT_ULong base_offset;
+ CFF_Font_Dict* dict;
MEM_Set( font, 0, sizeof ( *font ) );
font->stream = stream;
font->memory = memory;
+ dict = &font->top_font.font_dict;
base_offset = FILE_Pos();
/* read CFF font header */
@@ -353,7 +588,7 @@
font->header_size < 4 ||
font->absolute_offsize > 4 )
{
- FT_ERROR(( "incorrect CFF font header!\n" ));
+ FT_TRACE2(( "[not a CFF font header!]\n" ));
error = FT_Err_Unknown_File_Format;
goto Exit;
}
@@ -363,7 +598,7 @@
/* read the name, top dict, string and global subrs index */
error = t2_new_cff_index( &font->name_index, stream, 0 ) ||
- t2_new_cff_index( &font->top_dict_index, stream, 0 ) ||
+ t2_new_cff_index( &font->font_dict_index, stream, 0 ) ||
t2_new_cff_index( &font->string_index, stream, 0 ) ||
t2_new_cff_index( &font->global_subrs_index, stream, 1 );
if ( error )
@@ -371,7 +606,7 @@
/* well, we don't really forget the `disabled' fonts... */
font->num_faces = font->name_index.count;
- if ( face_index >= font->num_faces )
+ if ( face_index >= (FT_Int)font->num_faces )
{
FT_ERROR(( "T2_Load_CFF_Font: incorrect face index = %d\n",
face_index ));
@@ -379,110 +614,95 @@
}
/* in case of a font format check, simply exit now */
- if ( face_index >= 0 )
- {
- T2_Parser parser;
- FT_Byte* dict;
- FT_ULong dict_len;
- CFF_Index* index = &font->top_dict_index;
- CFF_Top_Dict* top = &font->top_dict;
-
-
- /* parse the top-level font dictionary */
- T2_Parser_Init( &parser, T2CODE_TOPDICT, &font->top_dict );
-
- /* set defaults */
- memset( top, 0, sizeof ( *top ) );
-
- top->underline_position = -100;
- top->underline_thickness = 50;
- top->charstring_type = 2;
- top->font_matrix.xx = 0x10000L;
- top->font_matrix.yy = 0x10000L;
- top->cid_count = 8720;
-
- error = T2_Access_Element( index, face_index, &dict, &dict_len ) ||
- T2_Parser_Run( &parser, dict, dict + dict_len );
+ if (face_index < 0)
+ goto Exit;
+
+ /* now, parse the top-level font dictionary */
+ error = CFF_Load_SubFont( &font->top_font,
+ &font->font_dict_index,
+ face_index,
+ stream,
+ base_offset );
+ if (error)
+ goto Exit;
- T2_Forget_Element( &font->top_dict_index, &dict );
+ /* now, check for a CID font */
+ if ( dict->cid_registry )
+ {
+ CFF_Index fd_index;
+ CFF_SubFont* sub;
+ FT_UInt index;
- if ( error )
+ /* this is a CID-keyed font, we must now allocate a table of */
+ /* sub-fonts, then load each of them separately.. */
+ if ( FILE_Seek( base_offset + dict->cid_fd_array_offset ) )
goto Exit;
-
- /* parse the private dictionary, if any */
- if (font->top_dict.private_offset && font->top_dict.private_size)
+
+ error = t2_new_cff_index( &fd_index, stream, 0 );
+ if (error) goto Exit;
+
+ if (fd_index.count > CFF_MAX_CID_FONTS)
{
- CFF_Private* priv = &font->private_dict;
-
-
- /* set defaults */
- priv->blue_shift = 7;
- priv->blue_fuzz = 1;
- priv->lenIV = -1;
- priv->expansion_factor = (FT_Fixed)0.06 * 0x10000L;
- priv->blue_scale = (FT_Fixed)0.039625 * 0x10000L;
-
- T2_Parser_Init( &parser, T2CODE_PRIVATE, priv );
-
- if ( FILE_Seek( base_offset + font->top_dict.private_offset ) ||
- ACCESS_Frame( font->top_dict.private_size ) )
- goto Exit;
-
- error = T2_Parser_Run( &parser,
- (FT_Byte*)stream->cursor,
- (FT_Byte*)stream->limit );
- FORGET_Frame();
- if ( error )
- goto Exit;
+ FT_ERROR(( "T2_Load_CFF_Font: FD array too large in CID font\n" ));
+ goto Fail_CID;
}
-
- /* read the charstrings index now */
- if ( font->top_dict.charstrings_offset == 0 )
+
+ /* allocate & read each font dict independently */
+ font->num_subfonts = fd_index.count;
+ if ( ALLOC_ARRAY( sub, fd_index.count, CFF_SubFont ) )
+ goto Fail_CID;
+
+ /* setup pointer table */
+ for ( index = 0; index < fd_index.count; index++ )
+ font->subfonts[index] = sub + index;
+
+ /* now load each sub font independently */
+ for ( index = 0; index < fd_index.count; index++ )
{
- FT_ERROR(( "T2_Load_CFF_Font: no charstrings offset!\n" ));
- error = FT_Err_Unknown_File_Format;
- goto Exit;
+ sub = font->subfonts[index];
+ error = CFF_Load_SubFont( sub, &fd_index, index, stream, base_offset );
+ if (error) goto Fail_CID;
}
- if ( FILE_Seek( base_offset + font->top_dict.charstrings_offset ) )
- goto Exit;
+ /* now load the FD Select array */
+ error = CFF_Load_FD_Select( &font->fd_select,
+ dict->cid_count,
+ stream,
+ base_offset + dict->cid_fd_select_offset );
- error = t2_new_cff_index( &font->charstrings_index, stream, 0 );
- if ( error )
+ Fail_CID:
+ t2_done_cff_index( &fd_index );
+
+ if (error)
goto Exit;
+ }
+ else
+ font->num_subfonts = 0;
- /* read the local subrs, if any */
-
- if ( font->private_dict.local_subrs_offset )
- {
- if ( FILE_Seek( base_offset + font->top_dict.private_offset +
- font->private_dict.local_subrs_offset ) )
- goto Exit;
-
- error = t2_new_cff_index( &font->local_subrs_index, stream, 1 );
- if ( error )
- goto Exit;
- }
-
- /* explicit the global and local subrs */
+ /* read the charstrings index now */
+ if ( dict->charstrings_offset == 0 )
+ {
+ FT_ERROR(( "T2_Load_CFF_Font: no charstrings offset!\n" ));
+ error = FT_Err_Unknown_File_Format;
+ goto Exit;
+ }
- if ( font->private_dict.local_subrs_offset )
- font->num_local_subrs = font->local_subrs_index.count;
- else
- font->num_local_subrs = 0;
+ if ( FILE_Seek( base_offset + dict->charstrings_offset ) )
+ goto Exit;
- font->num_global_subrs = font->global_subrs_index.count;
+ error = t2_new_cff_index( &font->charstrings_index, stream, 0 );
+ if ( error )
+ goto Exit;
- error = t2_explicit_cff_index( &font->global_subrs_index,
- &font->global_subrs ) ;
+ /* explicit the global subrs */
+ font->num_global_subrs = font->global_subrs_index.count;
+ font->num_glyphs = font->charstrings_index.count;
- if ( font->private_dict.local_subrs_offset )
- error |= t2_explicit_cff_index( &font->local_subrs_index,
- &font->local_subrs ) ;
+ error = t2_explicit_cff_index( &font->global_subrs_index,
+ &font->global_subrs ) ;
- if ( error )
- goto Exit;
- }
+ if ( error )
+ goto Exit;
/* get the font name */
font->font_name = T2_Get_Name( &font->name_index, face_index );
@@ -492,19 +712,28 @@
}
+
+
LOCAL_FUNC
void T2_Done_CFF_Font( CFF_Font* font )
{
FT_Memory memory = font->memory;
-
+ FT_UInt index;
t2_done_cff_index( &font->global_subrs_index );
t2_done_cff_index( &font->string_index );
- t2_done_cff_index( &font->top_dict_index );
+ t2_done_cff_index( &font->font_dict_index );
t2_done_cff_index( &font->name_index );
t2_done_cff_index( &font->charstrings_index );
-
- FREE( font->local_subrs );
+
+ /* release font dictionaries */
+ for ( index = 0; index < font->num_subfonts; index++ )
+ CFF_Done_SubFont( memory, font->subfonts[index] );
+
+ CFF_Done_SubFont( memory, &font->top_font );
+
+ CFF_Done_FD_Select( &font->fd_select, font->stream );
+
FREE( font->global_subrs );
FREE( font->font_name );
}
diff --git a/src/cff/t2load.h b/src/cff/t2load.h
index 05244e0..0cf64e0 100644
--- a/src/cff/t2load.h
+++ b/src/cff/t2load.h
@@ -56,6 +56,10 @@
LOCAL_DEF
void T2_Done_CFF_Font( CFF_Font* font );
+ LOCAL_DEF
+ FT_Byte CFF_Get_FD( CFF_FD_Select* select,
+ FT_UInt glyph_index );
+
#ifdef __cplusplus
}
diff --git a/src/cff/t2objs.c b/src/cff/t2objs.c
index 36b9c13..5c0b0a8 100644
--- a/src/cff/t2objs.c
+++ b/src/cff/t2objs.c
@@ -198,6 +198,7 @@
#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
return TT_Init_Extensions( driver );
#else
+ UNUSED(driver);
return T2_Err_Ok;
#endif
}
@@ -220,6 +221,8 @@
/* destroy extensions registry if needed */
#ifdef TT_CONFIG_OPTION_EXTEND_ENGINE
TT_Done_Extensions( driver );
+#else
+ UNUSED(driver);
#endif
}
diff --git a/src/cff/t2parse.c b/src/cff/t2parse.c
index cab4d72..1b9207f 100644
--- a/src/cff/t2parse.c
+++ b/src/cff/t2parse.c
@@ -279,7 +279,7 @@
static
FT_Error parse_font_matrix( T2_Parser* parser )
{
- CFF_Top_Dict* dict = (CFF_Top_Dict*)parser->object;
+ CFF_Font_Dict* dict = (CFF_Font_Dict*)parser->object;
FT_Matrix* matrix = &dict->font_matrix;
FT_Byte** data = parser->stack;
FT_Error error;
@@ -303,7 +303,7 @@
static
FT_Error parse_font_bbox( T2_Parser* parser )
{
- CFF_Top_Dict* dict = (CFF_Top_Dict*)parser->object;
+ CFF_Font_Dict* dict = (CFF_Font_Dict*)parser->object;
FT_BBox* bbox = &dict->font_bbox;
FT_Byte** data = parser->stack;
FT_Error error;
@@ -327,7 +327,7 @@
static
FT_Error parse_private_dict( T2_Parser* parser )
{
- CFF_Top_Dict* dict = (CFF_Top_Dict*)parser->object;
+ CFF_Font_Dict* dict = (CFF_Font_Dict*)parser->object;
FT_Byte** data = parser->stack;
FT_Error error;
@@ -348,7 +348,7 @@
static
FT_Error parse_cid_ros( T2_Parser* parser )
{
- CFF_Top_Dict* dict = (CFF_Top_Dict*)parser->object;
+ CFF_Font_Dict* dict = (CFF_Font_Dict*)parser->object;
FT_Byte** data = parser->stack;
FT_Error error;
@@ -395,7 +395,7 @@
code | T2CODE, \
(FT_UInt)(char*)&T2_REF( T2TYPE, name ), \
sizeof( T2_REF( T2TYPE, name ) ), \
- 0 \
+ 0, 0, 0 \
},
#undef T2_FIELD_DELTA
@@ -478,7 +478,7 @@
/* and look for it in our current list. */
FT_UInt code;
- FT_Int num_args = parser->top - parser->stack;
+ FT_UInt num_args = (FT_UInt)(parser->top - parser->stack);
const T2_Field_Handler* field;
@@ -498,7 +498,7 @@
for ( field = t2_field_handlers; field->kind; field++ )
{
- if ( field->code == code )
+ if ( field->code == (FT_Int)code )
{
/* we found our field's handler; read it */
FT_Long val;
diff --git a/src/cff/t2tokens.h b/src/cff/t2tokens.h
index 7b6e4e6..13a15e4 100644
--- a/src/cff/t2tokens.h
+++ b/src/cff/t2tokens.h
@@ -18,7 +18,7 @@
#undef T2TYPE
#undef T2CODE
-#define T2TYPE CFF_Top_Dict
+#define T2TYPE CFF_Font_Dict
#define T2CODE T2CODE_TOPDICT
T2_FIELD_STRING ( 0, version )
diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c
index 4b38c2c..acdbb75 100644
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -244,6 +244,9 @@
FT_Error error;
SFNT_Interface* sfnt = (SFNT_Interface*)face->sfnt;
+ UNUSED(face_index);
+ UNUSED(num_params);
+ UNUSED(params);
/* Load tables */
if ( LOAD_( header ) ||