Commit 1d8d0b4ef962592d8f0f856a411140b8997f86fa

Nikolaus Waxweiler 2016-01-28T14:11:14

Remove unpatented hinter (3/3). * include/freetype/config/ftoption.h (TT_CONFIG_OPTION_UNPATENTED_HINTING): Remove. * include/freetype/internal/ftobjs.h (FT_Face_InternalRec): Remove `ignore_unpatented_hinter' field. Update users. (FT_DEBUG_HOOK_UNPATENTED_HINTING): Remove. Update users. * include/freetype/internal/tttypes.h (TT_FaceRec): Remove `unpatented_hinting' field. Update users. * src/base/ftpatent.c (_tt_check_patents_in_range, _tt_check_patents_in_table, _tt_face_check_patents): Remove. (FT_Face_CheckTrueTypePatents, FT_Face_SetUnpatentedHinting): Replace code with dummies. * src/truetype/ttobjs.c (tt_face_init): Remove now defunct code. * src/truetype/ttobjs.h (TT_GraphicsState): Remove `both_x_axis' field.

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
diff --git a/ChangeLog b/ChangeLog
index 6bd34d1..a884e56 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,31 @@
 2016-01-28  Nikolaus Waxweiler  <madigens@gmail.com>
 
+	Remove unpatented hinter (3/3).
+
+	* include/freetype/config/ftoption.h
+	(TT_CONFIG_OPTION_UNPATENTED_HINTING): Remove.
+
+	* include/freetype/internal/ftobjs.h (FT_Face_InternalRec): Remove
+	`ignore_unpatented_hinter' field.
+	Update users.
+	(FT_DEBUG_HOOK_UNPATENTED_HINTING): Remove.
+	Update users.
+
+	* include/freetype/internal/tttypes.h (TT_FaceRec): Remove
+	`unpatented_hinting' field.
+	Update users.
+
+	* src/base/ftpatent.c (_tt_check_patents_in_range,
+	_tt_check_patents_in_table, _tt_face_check_patents): Remove.
+	(FT_Face_CheckTrueTypePatents, FT_Face_SetUnpatentedHinting):
+	Replace code with dummies.
+
+	* src/truetype/ttobjs.c (tt_face_init): Remove now defunct code. 
+	* src/truetype/ttobjs.h (TT_GraphicsState): Remove `both_x_axis'
+	field.
+
+2016-01-28  Nikolaus Waxweiler  <madigens@gmail.com>
+
 	Remove unpatented hinter (2/3).
 
 	* devel/ftoption.h (TT_CONFIG_OPTION_UNPATENTED_HINTING): Remove.
diff --git a/include/freetype/config/ftheader.h b/include/freetype/config/ftheader.h
index 4c2f108..68e1483 100644
--- a/include/freetype/config/ftheader.h
+++ b/include/freetype/config/ftheader.h
@@ -753,8 +753,7 @@
    *   FT_UNPATENTED_HINTING_H
    *
    * @description:
-   *   A macro used in #include statements to name the file containing the
-   *   FreeType~2 API which performs color filtering for subpixel rendering.
+   *   Deprecated.
    */
 #define FT_UNPATENTED_HINTING_H  <freetype/ttunpat.h>
 
@@ -766,7 +765,7 @@
    *
    * @description:
    *   A macro used in #include statements to name the file containing the
-   *   FreeType~2 API which performs color filtering for subpixel rendering.
+   *   FreeType~2 API which performs incremental glyph loading.
    */
 #define FT_INCREMENTAL_H  <freetype/ftincrem.h>
 
diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
index 2c33a66..a8097fe 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -607,56 +607,6 @@ FT_BEGIN_HEADER
 
   /*************************************************************************/
   /*                                                                       */
-  /* If you define TT_CONFIG_OPTION_UNPATENTED_HINTING, a special version  */
-  /* of the TrueType bytecode interpreter is used that doesn't implement   */
-  /* any of the patented opcodes and algorithms.  The patents related to   */
-  /* TrueType hinting have expired worldwide since May 2010; this option   */
-  /* is now deprecated.                                                    */
-  /*                                                                       */
-  /* Note that the TT_CONFIG_OPTION_UNPATENTED_HINTING macro is *ignored*  */
-  /* if you define TT_CONFIG_OPTION_BYTECODE_INTERPRETER; in other words,  */
-  /* either define TT_CONFIG_OPTION_BYTECODE_INTERPRETER or                */
-  /* TT_CONFIG_OPTION_UNPATENTED_HINTING but not both at the same time.    */
-  /*                                                                       */
-  /* This macro is only useful for a small number of font files (mostly    */
-  /* for Asian scripts) that require bytecode interpretation to properly   */
-  /* load glyphs.  For all other fonts, this produces unpleasant results,  */
-  /* thus the unpatented interpreter is never used to load glyphs from     */
-  /* TrueType fonts unless one of the following two options is used.       */
-  /*                                                                       */
-  /*   - The unpatented interpreter is explicitly activated by the user    */
-  /*     through the FT_PARAM_TAG_UNPATENTED_HINTING parameter tag         */
-  /*     when opening the FT_Face.                                         */
-  /*                                                                       */
-  /*   - FreeType detects that the FT_Face corresponds to one of the       */
-  /*     `trick' fonts (e.g., `Mingliu') it knows about.  The font engine  */
-  /*     contains a hard-coded list of font names and other matching       */
-  /*     parameters (see function `tt_face_init' in file                   */
-  /*     `src/truetype/ttobjs.c').                                         */
-  /*                                                                       */
-  /* Here a sample code snippet for using FT_PARAM_TAG_UNPATENTED_HINTING. */
-  /*                                                                       */
-  /*   {                                                                   */
-  /*     FT_Parameter  parameter;                                          */
-  /*     FT_Open_Args  open_args;                                          */
-  /*                                                                       */
-  /*                                                                       */
-  /*     parameter.tag = FT_PARAM_TAG_UNPATENTED_HINTING;                  */
-  /*                                                                       */
-  /*     open_args.flags      = FT_OPEN_PATHNAME | FT_OPEN_PARAMS;         */
-  /*     open_args.pathname   = my_font_pathname;                          */
-  /*     open_args.num_params = 1;                                         */
-  /*     open_args.params     = &parameter;                                */
-  /*                                                                       */
-  /*     error = FT_Open_Face( library, &open_args, index, &face );        */
-  /*     ...                                                               */
-  /*   }                                                                   */
-  /*                                                                       */
-/* #define TT_CONFIG_OPTION_UNPATENTED_HINTING */
-
-
-  /*************************************************************************/
-  /*                                                                       */
   /* Define TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED to compile the        */
   /* TrueType glyph loader to use Apple's definition of how to handle      */
   /* component offsets in composite glyphs.                                */
@@ -856,14 +806,11 @@ FT_BEGIN_HEADER
 
 
   /*
-   * This macro is defined if either unpatented or native TrueType
-   * hinting is requested by the definitions above.
+   * This macro is defined if native TrueType hinting is requested by the
+   * definitions above.
    */
 #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
 #define  TT_USE_BYTECODE_INTERPRETER
-#undef   TT_CONFIG_OPTION_UNPATENTED_HINTING
-#elif defined TT_CONFIG_OPTION_UNPATENTED_HINTING
-#define  TT_USE_BYTECODE_INTERPRETER
 #endif
 
 
diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h
index 8d0577c..e575eab 100644
--- a/include/freetype/freetype.h
+++ b/include/freetype/freetype.h
@@ -4217,20 +4217,13 @@ FT_BEGIN_HEADER
   /*    FT_Face_CheckTrueTypePatents                                       */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Parse all bytecode instructions of a TrueType font file to check   */
-  /*    whether any of the patented opcodes are used.  This is only useful */
-  /*    if you want to be able to use the unpatented hinter with           */
-  /*    fonts that do *not* use these opcodes.                             */
-  /*                                                                       */
-  /*    Note that this function parses *all* glyph instructions in the     */
-  /*    font file, which may be slow.                                      */
+  /*    Deprecated, does nothing.                                          */
   /*                                                                       */
   /* <Input>                                                               */
   /*    face :: A face handle.                                             */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    1~if this is a TrueType font that uses one of the patented         */
-  /*    opcodes, 0~otherwise.                                              */
+  /*    Always returns false.                                              */
   /*                                                                       */
   /* <Note>                                                                */
   /*    Since May 2010, TrueType hinting is no longer patented.            */
@@ -4248,9 +4241,7 @@ FT_BEGIN_HEADER
   /*    FT_Face_SetUnpatentedHinting                                       */
   /*                                                                       */
   /* <Description>                                                         */
-  /*    Enable or disable the unpatented hinter for a given face.          */
-  /*    Only enable it if you have determined that the face doesn't        */
-  /*    use any patented opcodes (see @FT_Face_CheckTrueTypePatents).      */
+  /*    Deprecated, does nothing.                                          */
   /*                                                                       */
   /* <Input>                                                               */
   /*    face  :: A face handle.                                            */
@@ -4258,9 +4249,7 @@ FT_BEGIN_HEADER
   /*    value :: New boolean setting.                                      */
   /*                                                                       */
   /* <Return>                                                              */
-  /*    The old setting value.  This will always be false if this is not   */
-  /*    an SFNT font, or if the unpatented hinter is not compiled in this  */
-  /*    instance of the library.                                           */
+  /*    Always returns false.                                              */
   /*                                                                       */
   /* <Note>                                                                */
   /*    Since May 2010, TrueType hinting is no longer patented.            */
diff --git a/include/freetype/ftmodapi.h b/include/freetype/ftmodapi.h
index abf8b41..b4d2758 100644
--- a/include/freetype/ftmodapi.h
+++ b/include/freetype/ftmodapi.h
@@ -613,12 +613,7 @@ FT_BEGIN_HEADER
    *       The library doesn't implement any kind of bytecode interpreter.
    *
    *     FT_TRUETYPE_ENGINE_TYPE_UNPATENTED ::
-   *       The library implements a bytecode interpreter that doesn't
-   *       support the patented operations of the TrueType virtual machine.
-   *
-   *       Its main use is to load certain Asian fonts that position and
-   *       scale glyph components with bytecode instructions.  It produces
-   *       bad output for most other fonts.
+   *       Deprecated and removed.
    *
    *     FT_TRUETYPE_ENGINE_TYPE_PATENTED ::
    *       The library implements a bytecode interpreter that covers
diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h
index 584c9e7..c37c07e 100644
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -341,12 +341,6 @@ FT_BEGIN_HEADER
   /*      this data when first opened.  This field exists only if          */
   /*      @FT_CONFIG_OPTION_INCREMENTAL is defined.                        */
   /*                                                                       */
-  /*    ignore_unpatented_hinter ::                                        */
-  /*      This boolean flag instructs the glyph loader to ignore the       */
-  /*      native font hinter, if one is found.  This is exclusively used   */
-  /*      in the case when the unpatented hinter is compiled within the    */
-  /*      library.                                                         */
-  /*                                                                       */
   /*    refcount ::                                                        */
   /*      A counter initialized to~1 at the time an @FT_Face structure is  */
   /*      created.  @FT_Reference_Face increments this counter, and        */
@@ -365,7 +359,6 @@ FT_BEGIN_HEADER
     FT_Incremental_InterfaceRec*  incremental_interface;
 #endif
 
-    FT_Bool             ignore_unpatented_hinter;
     FT_Int              refcount;
 
   } FT_Face_InternalRec;
@@ -775,13 +768,6 @@ FT_BEGIN_HEADER
 #define FT_DEBUG_HOOK_TRUETYPE            0
 
 
-  /* Set this debug hook to a non-null pointer to force unpatented hinting */
-  /* for all faces when both TT_USE_BYTECODE_INTERPRETER and               */
-  /* TT_CONFIG_OPTION_UNPATENTED_HINTING are defined.  This is only used   */
-  /* during debugging.                                                     */
-#define FT_DEBUG_HOOK_UNPATENTED_HINTING  1
-
-
   typedef void  (*FT_Bitmap_LcdFilterFunc)( FT_Bitmap*      bitmap,
                                             FT_Render_Mode  render_mode,
                                             FT_Library      library );
diff --git a/include/freetype/internal/tttypes.h b/include/freetype/internal/tttypes.h
index 4f467af..8643775 100644
--- a/include/freetype/internal/tttypes.h
+++ b/include/freetype/internal/tttypes.h
@@ -1233,9 +1233,6 @@ FT_BEGIN_HEADER
   /*                            interpreters field is also used to hook    */
   /*                            the debugger in `ttdebug'.                 */
   /*                                                                       */
-  /*    unpatented_hinting   :: If true, use only unpatented methods in    */
-  /*                            the bytecode interpreter.                  */
-  /*                                                                       */
   /*    doblend              :: A boolean which is set if the font should  */
   /*                            be blended (this is for GX var).           */
   /*                                                                       */
@@ -1334,10 +1331,6 @@ FT_BEGIN_HEADER
     /* used to hook the debugger for the `ttdebug' utility.        */
     TT_Interpreter        interpreter;
 
-#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
-    /* Use unpatented hinting only. */
-    FT_Bool               unpatented_hinting;
-#endif
 
     /***********************************************************************/
     /*                                                                     */
diff --git a/include/freetype/ttunpat.h b/include/freetype/ttunpat.h
index 689fa9c..ca4676b 100644
--- a/include/freetype/ttunpat.h
+++ b/include/freetype/ttunpat.h
@@ -2,7 +2,8 @@
 /*                                                                         */
 /*  ttunpat.h                                                              */
 /*                                                                         */
-/*    Definitions for the unpatented TrueType hinting system               */
+/*    Definitions for the unpatented TrueType hinting system.              */
+/*    Obsolete, retained for backwards compatibility.                      */
 /*                                                                         */
 /*  Copyright 2003-2016 by                                                 */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
@@ -41,9 +42,11 @@ FT_BEGIN_HEADER
   *   FT_PARAM_TAG_UNPATENTED_HINTING
   *
   * @description:
-  *   A constant used as the tag of an @FT_Parameter structure to indicate
-  *   that unpatented methods only should be used by the TrueType bytecode
-  *   interpreter for a typeface opened by @FT_Open_Face.
+  *   Deprecated.
+  *
+  *   Previously: A constant used as the tag of an @FT_Parameter structure to
+  *   indicate that unpatented methods only should be used by the TrueType
+  *   bytecode interpreter for a typeface opened by @FT_Open_Face.
   *
   */
 #define FT_PARAM_TAG_UNPATENTED_HINTING  FT_MAKE_TAG( 'u', 'n', 'p', 'a' )
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index d3ec4ee..a68f21b 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -688,7 +688,6 @@
         /* both `fpgm' and `prep' tables are missing                 */
         if ( ( mode == FT_RENDER_MODE_LIGHT                   &&
                !FT_DRIVER_HINTS_LIGHTLY( driver ) )             ||
-             face->internal->ignore_unpatented_hinter           ||
              ( FT_IS_SFNT( face )                             &&
                ttface->num_locations                          &&
                ttface->max_profile.maxSizeOfInstructions == 0 &&
diff --git a/src/base/ftpatent.c b/src/base/ftpatent.c
index 5a8ad0f..4861be1 100644
--- a/src/base/ftpatent.c
+++ b/src/base/ftpatent.c
@@ -3,7 +3,7 @@
 /*  ftpatent.c                                                             */
 /*                                                                         */
 /*    FreeType API for checking patented TrueType bytecode instructions    */
-/*    (body).                                                              */
+/*    (body).  Obsolete, retained for backwards compatibility.             */
 /*                                                                         */
 /*  Copyright 2007-2016 by                                                 */
 /*  David Turner.                                                          */
@@ -25,238 +25,14 @@
 #include FT_SERVICE_TRUETYPE_GLYF_H
 
 
-  static FT_Bool
-  _tt_check_patents_in_range( FT_Stream  stream,
-                              FT_ULong   size )
-  {
-    FT_Bool   result = FALSE;
-    FT_Error  error;
-    FT_Bytes  p, end;
-
-
-    if ( FT_FRAME_ENTER( size ) )
-      return 0;
-
-    p   = stream->cursor;
-    end = p + size;
-
-    while ( p < end )
-    {
-      switch (p[0])
-      {
-      case 0x06:  /* SPvTL // */
-      case 0x07:  /* SPvTL +  */
-      case 0x08:  /* SFvTL // */
-      case 0x09:  /* SFvTL +  */
-      case 0x0A:  /* SPvFS    */
-      case 0x0B:  /* SFvFS    */
-        result = TRUE;
-        goto Exit;
-
-      case 0x40:
-        if ( p + 1 >= end )
-          goto Exit;
-
-        p += p[1] + 2;
-        break;
-
-      case 0x41:
-        if ( p + 1 >= end )
-          goto Exit;
-
-        p += p[1] * 2 + 2;
-        break;
-
-      case 0x71:  /* DELTAP2 */
-      case 0x72:  /* DELTAP3 */
-      case 0x73:  /* DELTAC0 */
-      case 0x74:  /* DELTAC1 */
-      case 0x75:  /* DELTAC2 */
-        result = TRUE;
-        goto Exit;
-
-      case 0xB0:
-      case 0xB1:
-      case 0xB2:
-      case 0xB3:
-      case 0xB4:
-      case 0xB5:
-      case 0xB6:
-      case 0xB7:
-        p += ( p[0] - 0xB0 ) + 2;
-        break;
-
-      case 0xB8:
-      case 0xB9:
-      case 0xBA:
-      case 0xBB:
-      case 0xBC:
-      case 0xBD:
-      case 0xBE:
-      case 0xBF:
-        p += ( p[0] - 0xB8 ) * 2 + 3;
-        break;
-
-      default:
-        p += 1;
-        break;
-      }
-    }
-
-  Exit:
-    FT_UNUSED( error );
-    FT_FRAME_EXIT();
-    return result;
-  }
-
-
-  static FT_Bool
-  _tt_check_patents_in_table( FT_Face   face,
-                              FT_ULong  tag )
-  {
-    FT_Stream              stream = face->stream;
-    FT_Error               error  = FT_Err_Ok;
-    FT_Service_SFNT_Table  service;
-    FT_Bool                result = FALSE;
-
-
-    FT_FACE_FIND_SERVICE( face, service, SFNT_TABLE );
-
-    if ( service )
-    {
-      FT_UInt   i = 0;
-      FT_ULong  tag_i = 0, offset_i = 0, length_i = 0;
-
-
-      for ( i = 0; !error && tag_i != tag ; i++ )
-        error = service->table_info( face, i,
-                                     &tag_i, &offset_i, &length_i );
-
-      if ( error                      ||
-           FT_STREAM_SEEK( offset_i ) )
-        goto Exit;
-
-      result = _tt_check_patents_in_range( stream, length_i );
-    }
-
-  Exit:
-    return result;
-  }
-
-
-  static FT_Bool
-  _tt_face_check_patents( FT_Face  face )
-  {
-    FT_Stream  stream = face->stream;
-    FT_UInt    gindex;
-    FT_Error   error;
-    FT_Bool    result;
-
-    FT_Service_TTGlyf  service;
-
-
-    result = _tt_check_patents_in_table( face, TTAG_fpgm );
-    if ( result )
-      goto Exit;
-
-    result = _tt_check_patents_in_table( face, TTAG_prep );
-    if ( result )
-      goto Exit;
-
-    FT_FACE_FIND_SERVICE( face, service, TT_GLYF );
-    if ( service == NULL )
-      goto Exit;
-
-    for ( gindex = 0; gindex < (FT_UInt)face->num_glyphs; gindex++ )
-    {
-      FT_ULong  offset, num_ins, size;
-      FT_Int    num_contours;
-
-
-      offset = service->get_location( face, gindex, &size );
-      if ( size == 0 )
-        continue;
-
-      if ( FT_STREAM_SEEK( offset )      ||
-           FT_READ_SHORT( num_contours ) )
-        continue;
-
-      if ( num_contours >= 0 )  /* simple glyph */
-      {
-        if ( FT_STREAM_SKIP( 8 + num_contours * 2 ) )
-          continue;
-      }
-      else  /* compound glyph */
-      {
-        FT_Bool  has_instr = 0;
-
-
-        if ( FT_STREAM_SKIP( 8 ) )
-          continue;
-
-        /* now read each component */
-        for (;;)
-        {
-          FT_UInt  flags, toskip;
-
-
-          if( FT_READ_USHORT( flags ) )
-            break;
-
-          toskip = 2 + 1 + 1;
-
-          if ( ( flags & ( 1 << 0 ) ) != 0 )       /* ARGS_ARE_WORDS */
-            toskip += 2;
-
-          if ( ( flags & ( 1 << 3 ) ) != 0 )       /* WE_HAVE_A_SCALE */
-            toskip += 2;
-          else if ( ( flags & ( 1 << 6 ) ) != 0 )  /* WE_HAVE_X_Y_SCALE */
-            toskip += 4;
-          else if ( ( flags & ( 1 << 7 ) ) != 0 )  /* WE_HAVE_A_2x2 */
-            toskip += 8;
-
-          if ( ( flags & ( 1 << 8 ) ) != 0 )       /* WE_HAVE_INSTRUCTIONS */
-            has_instr = 1;
-
-          if ( FT_STREAM_SKIP( toskip ) )
-            goto NextGlyph;
-
-          if ( ( flags & ( 1 << 5 ) ) == 0 )       /* MORE_COMPONENTS */
-            break;
-        }
-
-        if ( !has_instr )
-          goto NextGlyph;
-      }
-
-      if ( FT_READ_USHORT( num_ins ) )
-        continue;
-
-      result = _tt_check_patents_in_range( stream, num_ins );
-      if ( result )
-        goto Exit;
-
-    NextGlyph:
-      ;
-    }
-
-  Exit:
-    return result;
-  }
-
-
   /* documentation is in freetype.h */
 
   FT_EXPORT_DEF( FT_Bool )
   FT_Face_CheckTrueTypePatents( FT_Face  face )
   {
-    FT_Bool  result = FALSE;
-
-
-    if ( face && FT_IS_SFNT( face ) )
-      result = _tt_face_check_patents( face );
+    FT_UNUSED( face );
 
-    return result;
+    return FALSE;
   }
 
 
@@ -266,22 +42,10 @@
   FT_Face_SetUnpatentedHinting( FT_Face  face,
                                 FT_Bool  value )
   {
-    FT_Bool  result = FALSE;
-
-
-#if defined( TT_CONFIG_OPTION_UNPATENTED_HINTING ) && \
-    !defined( TT_CONFIG_OPTION_BYTECODE_INTERPRETER )
-    if ( face && FT_IS_SFNT( face ) )
-    {
-      result = !face->internal->ignore_unpatented_hinter;
-      face->internal->ignore_unpatented_hinter = !value;
-    }
-#else
     FT_UNUSED( face );
     FT_UNUSED( value );
-#endif
 
-    return result;
+    return FALSE;
   }
 
 /* END */
diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c
index 6b0f8fb..188c7bb 100644
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -429,11 +429,7 @@
   {
 #ifdef TT_USE_BYTECODE_INTERPRETER
 
-#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
-    FT_TRUETYPE_ENGINE_TYPE_UNPATENTED
-#else
     FT_TRUETYPE_ENGINE_TYPE_PATENTED
-#endif
 
 #else /* !TT_USE_BYTECODE_INTERPRETER */
 
diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c
index c3b2af0..cd4e294 100644
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -32,10 +32,6 @@
 #include "ttinterp.h"
 #endif
 
-#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
-#include FT_TRUETYPE_UNPATENTED_H
-#endif
-
 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
 #include "ttgxvar.h"
 #endif
@@ -681,29 +677,6 @@
 
 #endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */
 
-#if defined( TT_CONFIG_OPTION_UNPATENTED_HINTING    ) && \
-    !defined( TT_CONFIG_OPTION_BYTECODE_INTERPRETER )
-
-    {
-      FT_Bool  unpatented_hinting;
-      int      i;
-
-
-      /* Determine whether unpatented hinting is to be used for this face. */
-      unpatented_hinting = FT_BOOL
-        ( library->debug_hooks[FT_DEBUG_HOOK_UNPATENTED_HINTING] != NULL );
-
-      for ( i = 0; i < num_params && !face->unpatented_hinting; i++ )
-        if ( params[i].tag == FT_PARAM_TAG_UNPATENTED_HINTING )
-          unpatented_hinting = TRUE;
-
-      if ( !unpatented_hinting )
-        ttface->internal->ignore_unpatented_hinter = TRUE;
-    }
-
-#endif /* TT_CONFIG_OPTION_UNPATENTED_HINTING &&
-          !TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
-
     /* initialize standard glyph loading routines */
     TT_Init_Glyph_Loading( face );
 
diff --git a/src/truetype/ttobjs.h b/src/truetype/ttobjs.h
index 1615c85..ed61a7d 100644
--- a/src/truetype/ttobjs.h
+++ b/src/truetype/ttobjs.h
@@ -72,10 +72,6 @@ FT_BEGIN_HEADER
     FT_UnitVector  projVector;
     FT_UnitVector  freeVector;
 
-#ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
-    FT_Bool        both_x_axis;
-#endif
-
     FT_Long        loop;
     FT_F26Dot6     minimum_distance;
     FT_Int         round_state;
diff --git a/src/type42/t42objs.c b/src/type42/t42objs.c
index 12275f5..4672c6e 100644
--- a/src/type42/t42objs.c
+++ b/src/type42/t42objs.c
@@ -231,9 +231,6 @@
     if ( info->is_fixed_pitch )
       root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
 
-    /* We only set this flag if we have the patented bytecode interpreter. */
-    /* There are no known `tricky' Type42 fonts that could be loaded with  */
-    /* the unpatented interpreter.                                         */
 #ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
     root->face_flags |= FT_FACE_FLAG_HINTER;
 #endif