misc/libfreetype/src/base/ftpatent.c
author unc0rr
Wed, 05 Dec 2012 23:51:04 +0400
branchflibqtfrontend
changeset 8230 bd4b8f9488a4
parent 5172 88f2e05288ba
permissions -rw-r--r--
Show who's in game to spectators
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5172
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     1
/***************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     2
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     3
/*  ftpatent.c                                                             */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     4
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     5
/*    FreeType API for checking patented TrueType bytecode instructions    */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     6
/*    (body).                                                              */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     7
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     8
/*  Copyright 2007, 2008, 2010 by David Turner.                            */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     9
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    10
/*  This file is part of the FreeType project, and may only be used,       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    11
/*  modified, and distributed under the terms of the FreeType project      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    12
/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    13
/*  this file you indicate that you have read the license and              */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    14
/*  understand and accept it fully.                                        */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    15
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    16
/***************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    17
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    18
#include <ft2build.h>
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    19
#include FT_FREETYPE_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    20
#include FT_TRUETYPE_TAGS_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    21
#include FT_INTERNAL_OBJECTS_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    22
#include FT_INTERNAL_STREAM_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    23
#include FT_SERVICE_SFNT_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    24
#include FT_SERVICE_TRUETYPE_GLYF_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    25
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    26
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    27
  static FT_Bool
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    28
  _tt_check_patents_in_range( FT_Stream  stream,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    29
                              FT_ULong   size )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    30
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    31
    FT_Bool   result = FALSE;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    32
    FT_Error  error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    33
    FT_Bytes  p, end;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    34
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    35
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    36
    if ( FT_FRAME_ENTER( size ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    37
      return 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    38
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    39
    p   = stream->cursor;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    40
    end = p + size;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    41
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    42
    while ( p < end )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    43
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    44
      switch (p[0])
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    45
      {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    46
      case 0x06:  /* SPvTL // */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    47
      case 0x07:  /* SPvTL +  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    48
      case 0x08:  /* SFvTL // */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    49
      case 0x09:  /* SFvTL +  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    50
      case 0x0A:  /* SPvFS    */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    51
      case 0x0B:  /* SFvFS    */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    52
        result = TRUE;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    53
        goto Exit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    54
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    55
      case 0x40:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    56
        if ( p + 1 >= end )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    57
          goto Exit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    58
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    59
        p += p[1] + 2;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    60
        break;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    61
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    62
      case 0x41:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    63
        if ( p + 1 >= end )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    64
          goto Exit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    65
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    66
        p += p[1] * 2 + 2;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    67
        break;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    68
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    69
      case 0x71:  /* DELTAP2 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    70
      case 0x72:  /* DELTAP3 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    71
      case 0x73:  /* DELTAC0 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    72
      case 0x74:  /* DELTAC1 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    73
      case 0x75:  /* DELTAC2 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    74
        result = TRUE;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    75
        goto Exit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    76
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    77
      case 0xB0:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    78
      case 0xB1:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    79
      case 0xB2:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    80
      case 0xB3:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    81
      case 0xB4:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    82
      case 0xB5:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    83
      case 0xB6:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    84
      case 0xB7:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    85
        p += ( p[0] - 0xB0 ) + 2;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    86
        break;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    87
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    88
      case 0xB8:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    89
      case 0xB9:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    90
      case 0xBA:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    91
      case 0xBB:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    92
      case 0xBC:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    93
      case 0xBD:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    94
      case 0xBE:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    95
      case 0xBF:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    96
        p += ( p[0] - 0xB8 ) * 2 + 3;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    97
        break;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    98
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    99
      default:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   100
        p += 1;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   101
        break;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   102
      }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   103
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   104
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   105
  Exit:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   106
    FT_UNUSED( error );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   107
    FT_FRAME_EXIT();
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   108
    return result;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   109
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   110
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   111
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   112
  static FT_Bool
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   113
  _tt_check_patents_in_table( FT_Face   face,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   114
                              FT_ULong  tag )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   115
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   116
    FT_Stream              stream = face->stream;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   117
    FT_Error               error  = FT_Err_Ok;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   118
    FT_Service_SFNT_Table  service;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   119
    FT_Bool                result = FALSE;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   120
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   121
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   122
    FT_FACE_FIND_SERVICE( face, service, SFNT_TABLE );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   123
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   124
    if ( service )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   125
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   126
      FT_UInt   i = 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   127
      FT_ULong  tag_i = 0, offset_i = 0, length_i = 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   128
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   129
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   130
      for ( i = 0; !error && tag_i != tag ; i++ )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   131
        error = service->table_info( face, i,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   132
                                     &tag_i, &offset_i, &length_i );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   133
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   134
      if ( error                      ||
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   135
           FT_STREAM_SEEK( offset_i ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   136
        goto Exit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   137
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   138
      result = _tt_check_patents_in_range( stream, length_i );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   139
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   140
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   141
  Exit:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   142
    return result;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   143
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   144
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   145
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   146
  static FT_Bool
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   147
  _tt_face_check_patents( FT_Face  face )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   148
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   149
    FT_Stream  stream = face->stream;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   150
    FT_UInt    gindex;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   151
    FT_Error   error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   152
    FT_Bool    result;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   153
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   154
    FT_Service_TTGlyf  service;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   155
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   156
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   157
    result = _tt_check_patents_in_table( face, TTAG_fpgm );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   158
    if ( result )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   159
      goto Exit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   160
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   161
    result = _tt_check_patents_in_table( face, TTAG_prep );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   162
    if ( result )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   163
      goto Exit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   164
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   165
    FT_FACE_FIND_SERVICE( face, service, TT_GLYF );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   166
    if ( service == NULL )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   167
      goto Exit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   168
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   169
    for ( gindex = 0; gindex < (FT_UInt)face->num_glyphs; gindex++ )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   170
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   171
      FT_ULong  offset, num_ins, size;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   172
      FT_Int    num_contours;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   173
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   174
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   175
      offset = service->get_location( face, gindex, &size );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   176
      if ( size == 0 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   177
        continue;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   178
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   179
      if ( FT_STREAM_SEEK( offset )      ||
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   180
           FT_READ_SHORT( num_contours ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   181
        continue;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   182
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   183
      if ( num_contours >= 0 )  /* simple glyph */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   184
      {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   185
        if ( FT_STREAM_SKIP( 8 + num_contours * 2 ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   186
          continue;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   187
      }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   188
      else  /* compound glyph */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   189
      {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   190
        FT_Bool  has_instr = 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   191
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   192
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   193
        if ( FT_STREAM_SKIP( 8 ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   194
          continue;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   195
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   196
        /* now read each component */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   197
        for (;;)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   198
        {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   199
          FT_UInt  flags, toskip;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   200
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   201
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   202
          if( FT_READ_USHORT( flags ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   203
            break;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   204
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   205
          toskip = 2 + 1 + 1;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   206
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   207
          if ( ( flags & ( 1 << 0 ) ) != 0 )       /* ARGS_ARE_WORDS */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   208
            toskip += 2;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   209
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   210
          if ( ( flags & ( 1 << 3 ) ) != 0 )       /* WE_HAVE_A_SCALE */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   211
            toskip += 2;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   212
          else if ( ( flags & ( 1 << 6 ) ) != 0 )  /* WE_HAVE_X_Y_SCALE */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   213
            toskip += 4;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   214
          else if ( ( flags & ( 1 << 7 ) ) != 0 )  /* WE_HAVE_A_2x2 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   215
            toskip += 8;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   216
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   217
          if ( ( flags & ( 1 << 8 ) ) != 0 )       /* WE_HAVE_INSTRUCTIONS */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   218
            has_instr = 1;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   219
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   220
          if ( FT_STREAM_SKIP( toskip ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   221
            goto NextGlyph;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   222
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   223
          if ( ( flags & ( 1 << 5 ) ) == 0 )       /* MORE_COMPONENTS */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   224
            break;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   225
        }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   226
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   227
        if ( !has_instr )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   228
          goto NextGlyph;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   229
      }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   230
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   231
      if ( FT_READ_USHORT( num_ins ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   232
        continue;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   233
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   234
      result = _tt_check_patents_in_range( stream, num_ins );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   235
      if ( result )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   236
        goto Exit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   237
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   238
    NextGlyph:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   239
      ;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   240
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   241
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   242
  Exit:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   243
    return result;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   244
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   245
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   246
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   247
  /* documentation is in freetype.h */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   248
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   249
  FT_EXPORT_DEF( FT_Bool )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   250
  FT_Face_CheckTrueTypePatents( FT_Face  face )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   251
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   252
    FT_Bool  result = FALSE;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   253
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   254
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   255
    if ( face && FT_IS_SFNT( face ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   256
      result = _tt_face_check_patents( face );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   257
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   258
    return result;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   259
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   260
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   261
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   262
  /* documentation is in freetype.h */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   263
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   264
  FT_EXPORT_DEF( FT_Bool )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   265
  FT_Face_SetUnpatentedHinting( FT_Face  face,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   266
                                FT_Bool  value )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   267
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   268
    FT_Bool  result = FALSE;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   269
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   270
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   271
#if defined( TT_CONFIG_OPTION_UNPATENTED_HINTING ) && \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   272
    !defined( TT_CONFIG_OPTION_BYTECODE_INTEPRETER )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   273
    if ( face && FT_IS_SFNT( face ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   274
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   275
      result = !face->internal->ignore_unpatented_hinter;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   276
      face->internal->ignore_unpatented_hinter = !value;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   277
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   278
#else
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   279
    FT_UNUSED( face );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   280
    FT_UNUSED( value );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   281
#endif
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   282
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   283
    return result;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   284
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   285
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   286
/* END */