add support for new postscript hinter
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
diff --git a/include/freetype/config/ftmodule.h b/include/freetype/config/ftmodule.h
index eb35a32..71e668e 100644
--- a/include/freetype/config/ftmodule.h
+++ b/include/freetype/config/ftmodule.h
@@ -4,9 +4,11 @@ FT_USE_MODULE(t1cid_driver_class)
FT_USE_MODULE(pcf_driver_class)
FT_USE_MODULE(psaux_module_class)
FT_USE_MODULE(psnames_module_class)
+FT_USE_MODULE(pshinter_module_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(winfnt_driver_class)
+
diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h
index 9608ace..96bf3c0 100644
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -171,13 +171,16 @@ FT_BEGIN_HEADER
/* glyph_delta :: The 2d translation vector corresponding to */
/* the glyph transformation, if necessary. */
/* */
+ /* glyph_hints :: format-specific glyph hints management */
+ /* */
typedef struct FT_Slot_InternalRec_
{
FT_GlyphLoader* loader;
FT_Bool glyph_transformed;
FT_Matrix glyph_matrix;
FT_Vector glyph_delta;
-
+ void* glyph_hints;
+
} FT_GlyphSlot_InternalRec;
diff --git a/include/freetype/internal/internal.h b/include/freetype/internal/internal.h
index c2dea4f..62f369c 100644
--- a/include/freetype/internal/internal.h
+++ b/include/freetype/internal/internal.h
@@ -40,8 +40,10 @@
#define FT_INTERNAL_CFF_TYPES_H <freetype/internal/cfftypes.h>
#define FT_INTERNAL_FNT_TYPES_H <freetype/internal/fnttypes.h>
-#define FT_INTERNAL_POSTSCRIPT_NAMES_H <freetype/internal/psnames.h>
-#define FT_INTERNAL_POSTSCRIPT_AUX_H <freetype/internal/psaux.h>
+#define FT_INTERNAL_POSTSCRIPT_NAMES_H <freetype/internal/psnames.h>
+#define FT_INTERNAL_POSTSCRIPT_AUX_H <freetype/internal/psaux.h>
+#define FT_INTERNAL_POSTSCRIPT_HINTS_H <freetype/internal/pshints.h>
+#define FT_INTERNAL_POSTSCRIPT_GLOBALS_H <freetype/internal/psglobal.h>
#define FT_INTERNAL_AUTOHINT_H <freetype/internal/autohint.h>
diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h
index 4d18067..f74c2d9 100644
--- a/include/freetype/internal/psaux.h
+++ b/include/freetype/internal/psaux.h
@@ -426,19 +426,11 @@ FT_BEGIN_HEADER
typedef struct T1_Builder_Funcs_
{
-<<<<<<< psaux.h
- void
- (*init)( T1_Builder* builder,
- FT_Face face,
- FT_Size size,
- FT_GlyphSlot slot );
-=======
void (*init)( T1_Builder* builder,
FT_Face face,
FT_Size size,
FT_GlyphSlot slot,
FT_Bool hinting );
->>>>>>> 1.14.2.2
void
(*done)( T1_Builder* builder );
diff --git a/include/freetype/internal/t1types.h b/include/freetype/internal/t1types.h
index d40e2c4..40612a8 100644
--- a/include/freetype/internal/t1types.h
+++ b/include/freetype/internal/t1types.h
@@ -24,7 +24,7 @@
#include<ft2build.h>
#include FT_TYPE1_TABLES_H
#include FT_INTERNAL_POSTSCRIPT_NAMES_H
-
+#include FT_INTERNAL_POSTSCRIPT_HINTS_H
FT_BEGIN_HEADER
@@ -172,6 +172,9 @@ FT_BEGIN_HEADER
/* support for Multiple Masters fonts */
T1_Blend* blend;
+
+ /* since FT 2.1 - interface to Postscript hinter */
+ void* pshinter;
} T1_FaceRec;
diff --git a/src/Jamfile b/src/Jamfile
index 47248b4..c37cbcb 100644
--- a/src/Jamfile
+++ b/src/Jamfile
@@ -14,6 +14,7 @@ SubDirHdrs [ FT2_SubDir src ] ;
#
HDRMACRO [ FT2_SubDir include internal internal.h ] ;
+SubInclude FT2_TOP src pshinter ;
SubInclude FT2_TOP src autohint ;
SubInclude FT2_TOP src base ;
SubInclude FT2_TOP src cache ;
diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c
index a210084..e5d9124 100644
--- a/src/psaux/psobjs.c
+++ b/src/psaux/psobjs.c
@@ -101,7 +101,7 @@
static FT_Error
reallocate_t1_table( PS_Table* table,
- FT_Long new_size )
+ FT_Int new_size )
{
FT_Memory memory = table->memory;
FT_Byte* old_base = table->block;
@@ -1071,7 +1071,8 @@
T1_Builder_Init( T1_Builder* builder,
FT_Face face,
FT_Size size,
- FT_GlyphSlot glyph )
+ FT_GlyphSlot glyph,
+ FT_Bool hinting )
{
builder->path_begun = 0;
builder->load_points = 1;
@@ -1085,10 +1086,16 @@
FT_GlyphLoader* loader = glyph->internal->loader;
- builder->loader = loader;
- builder->base = &loader->base.outline;
- builder->current = &loader->current.outline;
+ builder->loader = loader;
+ builder->base = &loader->base.outline;
+ builder->current = &loader->current.outline;
FT_GlyphLoader_Rewind( loader );
+
+ builder->hints_globals = size->internal;
+ builder->hints_funcs = 0;
+
+ if (hinting)
+ builder->hints_funcs = glyph->internal->glyph_hints;
}
if ( size )
diff --git a/src/psaux/psobjs.h b/src/psaux/psobjs.h
index a3ae8f8..34f7f05 100644
--- a/src/psaux/psobjs.h
+++ b/src/psaux/psobjs.h
@@ -147,7 +147,8 @@ FT_BEGIN_HEADER
T1_Builder_Init( T1_Builder* builder,
FT_Face face,
FT_Size size,
- FT_GlyphSlot glyph );
+ FT_GlyphSlot glyph,
+ FT_Bool hinting );
FT_LOCAL void
T1_Builder_Done( T1_Builder* builder );
@@ -176,7 +177,6 @@ FT_BEGIN_HEADER
FT_Pos x,
FT_Pos y );
-
FT_LOCAL void
T1_Builder_Close_Contour( T1_Builder* builder );
diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c
index 6139ed3..fc5b682 100644
--- a/src/psaux/t1decode.c
+++ b/src/psaux/t1decode.c
@@ -18,6 +18,7 @@
#include <ft2build.h>
#include FT_INTERNAL_DEBUG_H
+#include FT_INTERNAL_POSTSCRIPT_HINTS_H
#include FT_OUTLINE_H
#include "t1decode.h"
@@ -140,7 +141,7 @@
FT_String* name = (FT_String*)decoder->glyph_names[n];
- if ( name && strcmp( name,glyph_name ) == 0 )
+ if ( name && name[0] == glyph_name[0] && strcmp( name,glyph_name ) == 0 )
return n;
}
@@ -244,6 +245,7 @@
glyph->format = ft_glyph_format_composite;
loader->current.num_subglyphs = 2;
+ goto Exit;
}
/* First load `bchar' in builder */
@@ -266,6 +268,9 @@
decoder->builder.left_bearing.x = 0;
decoder->builder.left_bearing.y = 0;
+ decoder->builder.pos_x = adx - asb;
+ decoder->builder.pos_y = ady;
+
/* Now load `achar' on top of */
/* the base outline */
error = T1_Decoder_Parse_Glyph( decoder, achar_index );
@@ -278,17 +283,22 @@
decoder->builder.left_bearing = left_bearing;
decoder->builder.advance = advance;
+ /* XXX: old code doesn't work with postscript hinter */
+#if 0
/* Finally, move the accent */
if ( decoder->builder.load_points )
{
FT_Outline dummy;
-
dummy.n_points = (short)( base->n_points - n_base_points );
dummy.points = base->points + n_base_points;
FT_Outline_Translate( &dummy, adx - asb, ady );
}
+#else
+ decoder->builder.pos_x = 0;
+ decoder->builder.pos_y = 0;
+#endif
Exit:
return error;
@@ -323,8 +333,9 @@
FT_Byte* ip;
FT_Byte* limit;
T1_Builder* builder = &decoder->builder;
- FT_Pos x, y;
+ FT_Pos x, y, orig_x, orig_y;
+ T1_Hints_Funcs hinter;
/* we don't want to touch the source code -- use macro trick */
#define start_point T1_Builder_Start_Point
@@ -341,14 +352,20 @@
builder->path_begun = 0;
+ hinter = (T1_Hints_Funcs) builder->hints_funcs;
+
zone->base = charstring_base;
limit = zone->limit = charstring_base + charstring_len;
ip = zone->cursor = zone->base;
error = PSaux_Err_Ok;
- x = builder->pos_x;
- y = builder->pos_y;
+ x = orig_x = builder->pos_x;
+ y = orig_y = builder->pos_y;
+
+ /* begin hints recording session, if any */
+ if ( hinter )
+ hinter->open( hinter->hints );
/* now, execute loop */
while ( ip < limit )
@@ -613,6 +630,10 @@
goto Syntax_Error;
}
ip += 2;
+
+ if ( hinter )
+ hinter->reset( hinter->hints, builder->current->n_points );
+
break;
case 12:
@@ -707,7 +728,19 @@
FT_TRACE4(( " endchar" ));
close_contour( builder );
-
+
+ /* close hints recording session */
+ if ( hinter )
+ {
+ if (hinter->close( hinter->hints, builder->current->n_points ))
+ goto Syntax_Error;
+
+ /* apply hints to the loaded glyph outline now */
+ hinter->apply( hinter->hints,
+ builder->current,
+ (PSH_Globals) builder->hints_globals );
+ }
+
/* add current outline to the glyph slot */
FT_GlyphLoader_Add( builder->loader );
@@ -722,8 +755,8 @@
builder->advance.x = top[1];
builder->advance.y = 0;
- builder->last.x = x = top[0];
- builder->last.y = y = 0;
+ orig_x = builder->last.x = x = builder->pos_x + top[0];
+ orig_y = builder->last.y = y = builder->pos_y;
/* the `metrics_only' indicates that we only want to compute */
/* the glyph's metrics (lsb + advance width), not load the */
@@ -746,8 +779,8 @@
builder->advance.x = top[2];
builder->advance.y = top[3];
- builder->last.x = x = top[0];
- builder->last.y = y = top[1];
+ builder->last.x = x = builder->pos_x + top[0];
+ builder->last.y = y = builder->pos_y + top[1];
/* the `metrics_only' indicates that we only want to compute */
/* the glyph's metrics (lsb + advance width), not load the */
@@ -973,22 +1006,50 @@
case op_hstem:
FT_TRACE4(( " hstem" ));
+
+ /* record horizontal hint */
+ if ( hinter )
+ {
+ /* top[0] += builder->left_bearing.y; */
+ hinter->stem( hinter->hints, 0, top );
+ }
break;
case op_hstem3:
FT_TRACE4(( " hstem3" ));
+ /* record horizontal counter-controlled hints */
+ if ( hinter )
+ hinter->stem3( hinter->hints, 0, top );
+
break;
case op_vstem:
FT_TRACE4(( " vstem" ));
+ /* record vertical hint */
+ if ( hinter )
+ {
+ top[0] += orig_x;
+ hinter->stem( hinter->hints, 1, top );
+ }
+
break;
case op_vstem3:
FT_TRACE4(( " vstem3" ));
+ /* record vertical counter-controlled hints */
+ if ( hinter )
+ {
+ FT_Pos dx = orig_x;
+
+ top[0] += dx;
+ top[2] += dx;
+ top[4] += dx;
+ hinter->stem3( hinter->hints, 1, top );
+ }
break;
case op_setcurrentpoint:
@@ -1011,6 +1072,7 @@
} /* while ip < limit */
FT_TRACE4(( "..end..\n\n" ));
+
return error;
Syntax_Error:
@@ -1024,6 +1086,7 @@
}
+ /* parse a single Type 1 glyph */
FT_LOCAL_DEF FT_Error
T1_Decoder_Parse_Glyph( T1_Decoder* decoder,
FT_UInt glyph )
@@ -1032,6 +1095,7 @@
}
+ /* initialise T1 decoder */
FT_LOCAL_DEF FT_Error
T1_Decoder_Init( T1_Decoder* decoder,
FT_Face face,
@@ -1039,6 +1103,7 @@
FT_GlyphSlot slot,
FT_Byte** glyph_names,
T1_Blend* blend,
+ FT_Bool hinting,
T1_Decoder_Callback parse_callback )
{
MEM_Set( decoder, 0, sizeof ( *decoder ) );
@@ -1059,7 +1124,7 @@
decoder->psnames = psnames;
}
- T1_Builder_Init( &decoder->builder, face, size, slot );
+ T1_Builder_Init( &decoder->builder, face, size, slot, hinting );
decoder->num_glyphs = face->num_glyphs;
decoder->glyph_names = glyph_names;
@@ -1072,6 +1137,7 @@
}
+ /* finalize T1 decoder */
FT_LOCAL_DEF void
T1_Decoder_Done( T1_Decoder* decoder )
{
diff --git a/src/psaux/t1decode.h b/src/psaux/t1decode.h
index 14dc043..fd58870 100644
--- a/src/psaux/t1decode.h
+++ b/src/psaux/t1decode.h
@@ -49,6 +49,7 @@ FT_BEGIN_HEADER
FT_GlyphSlot slot,
FT_Byte** glyph_names,
T1_Blend* blend,
+ FT_Bool hinting,
T1_Decoder_Callback parse_glyph );
FT_LOCAL void
diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c
index 49be9f6..57e59f9 100644
--- a/src/type1/t1driver.c
+++ b/src/type1/t1driver.c
@@ -331,7 +331,10 @@
const FT_Driver_Class t1_driver_class =
{
{
- ft_module_font_driver | ft_module_driver_scalable,
+ ft_module_font_driver |
+ ft_module_driver_scalable |
+ ft_module_driver_has_hinter,
+
sizeof( FT_DriverRec ),
"type1",
@@ -340,8 +343,8 @@
0, /* format interface */
- (FT_Module_Constructor)T1_Init_Driver,
- (FT_Module_Destructor) T1_Done_Driver,
+ (FT_Module_Constructor)T1_Driver_Init,
+ (FT_Module_Destructor) T1_Driver_Done,
(FT_Module_Requester) Get_Interface,
},
@@ -349,15 +352,15 @@
sizeof( T1_SizeRec ),
sizeof( T1_GlyphSlotRec ),
- (FTDriver_initFace) T1_Init_Face,
- (FTDriver_doneFace) T1_Done_Face,
- (FTDriver_initSize) 0,
- (FTDriver_doneSize) 0,
- (FTDriver_initGlyphSlot)0,
- (FTDriver_doneGlyphSlot)0,
+ (FTDriver_initFace) T1_Face_Init,
+ (FTDriver_doneFace) T1_Face_Done,
+ (FTDriver_initSize) T1_Size_Init,
+ (FTDriver_doneSize) T1_Size_Done,
+ (FTDriver_initGlyphSlot)T1_GlyphSlot_Init,
+ (FTDriver_doneGlyphSlot)T1_GlyphSlot_Done,
- (FTDriver_setCharSizes) 0,
- (FTDriver_setPixelSizes)0,
+ (FTDriver_setCharSizes) T1_Size_Reset,
+ (FTDriver_setPixelSizes)T1_Size_Reset,
(FTDriver_loadGlyph) T1_Load_Glyph,
(FTDriver_getCharIndex) Get_Char_Index,
diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c
index f23b2cd..6dafb6e 100644
--- a/src/type1/t1gload.c
+++ b/src/type1/t1gload.c
@@ -93,6 +93,7 @@
0, /* glyph slot */
(FT_Byte**)type1->glyph_names,
face->blend,
+ 0,
T1_Parse_Glyph );
if ( error )
return error;
@@ -172,6 +173,7 @@
(FT_GlyphSlot)glyph,
(FT_Byte**)type1->glyph_names,
face->blend,
+ FT_BOOL(hinting),
T1_Parse_Glyph );
if ( error )
goto Exit;
@@ -239,20 +241,15 @@
if ( size && size->root.metrics.y_ppem < 24 )
glyph->root.outline.flags |= ft_outline_high_precision;
- /* apply the font matrix */
+/* XXXX: the following needs serious work to work properly with hinting !! */
+#if 0
+ /* apply the font matrix, if any.. */
FT_Outline_Transform( &glyph->root.outline, &font_matrix );
FT_Outline_Translate( &glyph->root.outline,
font_offset.x,
font_offset.y );
-
-#if 0
-
- glyph->root.outline.second_pass = TRUE;
- glyph->root.outline.high_precision = size->root.metrics.y_ppem < 24;
- glyph->root.outline.dropout_mode = 2;
-
-#endif /* 0 */
+#endif
if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 )
{
@@ -264,12 +261,13 @@
FT_Fixed y_scale = glyph->y_scale;
- /* First of all, scale the points */
- for ( n = cur->n_points; n > 0; n--, vec++ )
- {
- vec->x = FT_MulFix( vec->x, x_scale );
- vec->y = FT_MulFix( vec->y, y_scale );
- }
+ /* First of all, scale the points, fi we're not hinting */
+ if ( !hinting )
+ for ( n = cur->n_points; n > 0; n--, vec++ )
+ {
+ vec->x = FT_MulFix( vec->x, x_scale );
+ vec->y = FT_MulFix( vec->y, y_scale );
+ }
FT_Outline_Get_CBox( &glyph->root.outline, &cbox );
diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c
index 9eaadcc..8c9bbd3 100644
--- a/src/type1/t1objs.c
+++ b/src/type1/t1objs.c
@@ -47,6 +47,121 @@
/*************************************************************************/
/* */
+ /* SIZE FUNCTIONS */
+ /* */
+ /* note that we store the global hints in the size's "internal" root */
+ /* field.. */
+ /* */
+ /*************************************************************************/
+
+ static PSH_Globals_Funcs
+ T1_Size_Get_Globals_Funcs( T1_Size size )
+ {
+ T1_Face face = (T1_Face) size->root.face;
+ PSHinter_Interface* pshinter = face->pshinter;
+ FT_Module module;
+
+ module = FT_Get_Module( size->root.face->driver->root.library, "pshinter" );
+ return ( module && pshinter && pshinter->get_globals_funcs )
+ ? pshinter->get_globals_funcs( module )
+ : 0 ;
+ }
+
+
+ FT_LOCAL_DEF
+ void T1_Size_Done( T1_Size size )
+ {
+ if ( size->root.internal )
+ {
+ PSH_Globals_Funcs funcs;
+
+ funcs = T1_Size_Get_Globals_Funcs(size);
+ if (funcs)
+ funcs->destroy( (PSH_Globals) size->root.internal );
+
+ size->root.internal = 0;
+ }
+ }
+
+
+
+ FT_LOCAL_DEF
+ FT_Error T1_Size_Init( T1_Size size )
+ {
+ FT_Error error = 0;
+ PSH_Globals_Funcs funcs = T1_Size_Get_Globals_Funcs( size );
+
+ if ( funcs )
+ {
+ PSH_Globals globals;
+ T1_Face face = (T1_Face) size->root.face;
+
+ error = funcs->create( size->root.face->memory,
+ &face->type1.private_dict, &globals );
+ if (!error)
+ size->root.internal = (FT_Size_Internal)(void*) globals;
+ }
+
+ return error;
+ }
+
+
+
+ FT_LOCAL_DEF
+ FT_Error T1_Size_Reset( T1_Size size )
+ {
+ PSH_Globals_Funcs funcs = T1_Size_Get_Globals_Funcs(size);
+ FT_Error error = 0;
+
+ if (funcs)
+ error = funcs->set_scale( (PSH_Globals) size->root.internal,
+ size->root.metrics.x_scale,
+ size->root.metrics.y_scale,
+ 0, 0 );
+ return error;
+ }
+
+
+ /*************************************************************************/
+ /* */
+ /* SLOT FUNCTIONS */
+ /* */
+ /*************************************************************************/
+
+ FT_LOCAL_DEF void
+ T1_GlyphSlot_Done( T1_GlyphSlot slot )
+ {
+ slot->root.internal->glyph_hints = 0;
+ }
+
+
+ FT_LOCAL_DEF FT_Error
+ T1_GlyphSlot_Init( T1_GlyphSlot slot )
+ {
+ T1_Face face;
+ PSHinter_Interface* pshinter;
+
+ face = (T1_Face) slot->root.face;
+ pshinter = face->pshinter;
+ if (pshinter)
+ {
+ FT_Module module;
+
+ module = FT_Get_Module( slot->root.face->driver->root.library, "pshinter" );
+ if (module)
+ {
+ T1_Hints_Funcs funcs;
+
+ funcs = pshinter->get_t1_funcs( module );
+ slot->root.internal->glyph_hints = (void*)funcs;
+ }
+ }
+ return 0;
+ }
+
+
+ /*************************************************************************/
+ /* */
/* FACE FUNCTIONS */
/* */
/*************************************************************************/
@@ -55,7 +170,7 @@
/*************************************************************************/
/* */
/* <Function> */
- /* T1_Done_Face */
+ /* T1_Face_Done */
/* */
/* <Description> */
/* The face object destructor. */
@@ -63,8 +178,8 @@
/* <Input> */
/* face :: A typeless pointer to the face object to destroy. */
/* */
- FT_LOCAL_DEF void
- T1_Done_Face( T1_Face face )
+ FT_LOCAL_DEF
+ void T1_Face_Done( T1_Face face )
{
FT_Memory memory;
T1_Font* type1 = &face->type1;
@@ -124,10 +239,11 @@
}
+
/*************************************************************************/
/* */
/* <Function> */
- /* T1_Init_Face */
+ /* T1_Face_Init */
/* */
/* <Description> */
/* The face object constructor. */
@@ -148,15 +264,16 @@
/* FreeType error code. 0 means success. */
/* */
FT_LOCAL_DEF FT_Error
- T1_Init_Face( FT_Stream stream,
+ T1_Face_Init( FT_Stream stream,
T1_Face face,
FT_Int face_index,
FT_Int num_params,
FT_Parameter* params )
{
- FT_Error error;
- PSNames_Interface* psnames;
- PSAux_Interface* psaux;
+ FT_Error error;
+ PSNames_Interface* psnames;
+ PSAux_Interface* psaux;
+ PSHinter_Interface* pshinter;
FT_UNUSED( num_params );
FT_UNUSED( params );
@@ -183,6 +300,15 @@
face->psaux = psaux;
}
+
+ pshinter = (PSHinter_Interface*)face->pshinter;
+ if ( !pshinter )
+ {
+ pshinter = (PSHinter_Interface*)
+ FT_Get_Module_Interface( FT_FACE_LIBRARY( face ), "pshinter" );
+
+ face->pshinter = pshinter;
+ }
/* open the tokenizer, this will also check the font format */
error = T1_Open_Face( face );
@@ -196,7 +322,7 @@
/* check the face index */
if ( face_index != 0 )
{
- FT_ERROR(( "T1_Init_Face: invalid face index\n" ));
+ FT_ERROR(( "T1_Face_Init: invalid face index\n" ));
error = T1_Err_Invalid_Argument;
goto Exit;
}
@@ -375,7 +501,7 @@
/*************************************************************************/
/* */
/* <Function> */
- /* T1_Init_Driver */
+ /* T1_Driver_Init */
/* */
/* <Description> */
/* Initializes a given Type 1 driver object. */
@@ -387,7 +513,7 @@
/* FreeType error code. 0 means success. */
/* */
FT_LOCAL_DEF FT_Error
- T1_Init_Driver( T1_Driver driver )
+ T1_Driver_Init( T1_Driver driver )
{
FT_UNUSED( driver );
@@ -398,7 +524,7 @@
/*************************************************************************/
/* */
/* <Function> */
- /* T1_Done_Driver */
+ /* T1_Driver_Done */
/* */
/* <Description> */
/* Finalizes a given Type 1 driver. */
@@ -407,7 +533,7 @@
/* driver :: A handle to the target Type 1 driver. */
/* */
FT_LOCAL_DEF void
- T1_Done_Driver( T1_Driver driver )
+ T1_Driver_Done( T1_Driver driver )
{
FT_UNUSED( driver );
}
diff --git a/src/type1/t1objs.h b/src/type1/t1objs.h
index 59e00e1..c7ff803 100644
--- a/src/type1/t1objs.h
+++ b/src/type1/t1objs.h
@@ -100,15 +100,20 @@ FT_BEGIN_HEADER
/* */
typedef struct T1_SizeRec_
{
- FT_SizeRec root;
- FT_Bool valid;
- T1_Size_Hints* hints; /* defined in the hinter. This allows */
- /* us to experiment with different */
- /* hinting schemes without having to */
- /* change `t1objs' each time. */
+ FT_SizeRec root;
+
} T1_SizeRec;
+ FT_LOCAL
+ void T1_Size_Done( T1_Size size );
+
+ FT_LOCAL
+ FT_Error T1_Size_Reset( T1_Size size );
+
+ FT_LOCAL
+ FT_Error T1_Size_Init( T1_Size size );
+
/*************************************************************************/
/* */
/* <Type> */
@@ -130,26 +135,36 @@ FT_BEGIN_HEADER
FT_Fixed x_scale;
FT_Fixed y_scale;
- T1_Glyph_Hints* hints; /* defined in the hinter */
-
} T1_GlyphSlotRec;
FT_LOCAL FT_Error
- T1_Init_Face( FT_Stream stream,
+ T1_Face_Init( FT_Stream stream,
T1_Face face,
FT_Int face_index,
FT_Int num_params,
FT_Parameter* params );
FT_LOCAL void
- T1_Done_Face( T1_Face face );
+ T1_Face_Done( T1_Face face );
+
+ FT_LOCAL FT_Error
+ T1_Size_Init( T1_Size size );
+
+ FT_LOCAL void
+ T1_Size_Done( T1_Size size );
+
+ FT_LOCAL FT_Error
+ T1_GlyphSlot_Init( T1_GlyphSlot slot );
+
+ FT_LOCAL void
+ T1_GlyphSlot_Done( T1_GlyphSlot slot );
FT_LOCAL FT_Error
- T1_Init_Driver( T1_Driver driver );
+ T1_Driver_Init( T1_Driver driver );
FT_LOCAL void
- T1_Done_Driver( T1_Driver driver );
+ T1_Driver_Done( T1_Driver driver );
FT_END_HEADER