misc/libfreetype/src/otvalid/otvjstf.c
author unc0rr
Fri, 25 Jan 2013 12:59:06 +0400
changeset 8431 74c2c95ab07b
parent 5172 88f2e05288ba
permissions -rw-r--r--
Fix finding player's another clan
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
/*  otvjstf.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
/*    OpenType JSTF table validation (body).                               */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     6
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     7
/*  Copyright 2004, 2007 by                                                */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     8
/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    19
#include "otvalid.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    20
#include "otvcommn.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    21
#include "otvgpos.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    22
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    23
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    24
  /*************************************************************************/
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
  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    27
  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    28
  /* messages during execution.                                            */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    29
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    30
#undef  FT_COMPONENT
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    31
#define FT_COMPONENT  trace_otvjstf
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    32
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    33
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    34
#define JstfPriorityFunc  otv_JstfPriority_validate
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    35
#define JstfLookupFunc    otv_GPOS_subtable_validate
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    36
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    37
  /* uses valid->extra1 (GSUB lookup count) */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    38
  /* uses valid->extra2 (GPOS lookup count) */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    39
  /* sets valid->extra1 (counter)           */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    40
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    41
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    42
  otv_JstfPriority_validate( FT_Bytes       table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    43
                             OTV_Validator  valid )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    44
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    45
    FT_Bytes  p = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    46
    FT_UInt   table_size;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    47
    FT_UInt   gsub_lookup_count, gpos_lookup_count;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    48
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    49
    OTV_OPTIONAL_TABLE( ShrinkageEnableGSUB  );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    50
    OTV_OPTIONAL_TABLE( ShrinkageDisableGSUB );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    51
    OTV_OPTIONAL_TABLE( ShrinkageEnableGPOS  );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    52
    OTV_OPTIONAL_TABLE( ShrinkageDisableGPOS );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    53
    OTV_OPTIONAL_TABLE( ExtensionEnableGSUB  );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    54
    OTV_OPTIONAL_TABLE( ExtensionDisableGSUB );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    55
    OTV_OPTIONAL_TABLE( ExtensionEnableGPOS  );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    56
    OTV_OPTIONAL_TABLE( ExtensionDisableGPOS );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    57
    OTV_OPTIONAL_TABLE( ShrinkageJstfMax );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    58
    OTV_OPTIONAL_TABLE( ExtensionJstfMax );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    59
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    60
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    61
    OTV_ENTER;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    62
    OTV_TRACE(( "JstfPriority table\n" ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    63
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    64
    OTV_LIMIT_CHECK( 20 );
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
    gsub_lookup_count = valid->extra1;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    67
    gpos_lookup_count = valid->extra2;
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
    table_size = 20;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    70
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    71
    valid->extra1 = gsub_lookup_count;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    72
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    73
    OTV_OPTIONAL_OFFSET( ShrinkageEnableGSUB );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    74
    OTV_SIZE_CHECK( ShrinkageEnableGSUB );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    75
    if ( ShrinkageEnableGSUB )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    76
      otv_x_ux( table + ShrinkageEnableGSUB, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    77
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    78
    OTV_OPTIONAL_OFFSET( ShrinkageDisableGSUB );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    79
    OTV_SIZE_CHECK( ShrinkageDisableGSUB );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    80
    if ( ShrinkageDisableGSUB )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    81
      otv_x_ux( table + ShrinkageDisableGSUB, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    82
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    83
    valid->extra1 = gpos_lookup_count;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    84
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    85
    OTV_OPTIONAL_OFFSET( ShrinkageEnableGPOS );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    86
    OTV_SIZE_CHECK( ShrinkageEnableGPOS );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    87
    if ( ShrinkageEnableGPOS )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    88
      otv_x_ux( table + ShrinkageEnableGPOS, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    89
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    90
    OTV_OPTIONAL_OFFSET( ShrinkageDisableGPOS );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    91
    OTV_SIZE_CHECK( ShrinkageDisableGPOS );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    92
    if ( ShrinkageDisableGPOS )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    93
      otv_x_ux( table + ShrinkageDisableGPOS, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    94
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    95
    OTV_OPTIONAL_OFFSET( ShrinkageJstfMax );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    96
    OTV_SIZE_CHECK( ShrinkageJstfMax );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    97
    if ( ShrinkageJstfMax )
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
      /* XXX: check lookup types? */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   100
      OTV_NEST2( JstfMax, JstfLookup );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   101
      OTV_RUN( table + ShrinkageJstfMax, valid );
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
    valid->extra1 = gsub_lookup_count;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   105
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   106
    OTV_OPTIONAL_OFFSET( ExtensionEnableGSUB );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   107
    OTV_SIZE_CHECK( ExtensionEnableGSUB );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   108
    if ( ExtensionEnableGSUB )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   109
      otv_x_ux( table + ExtensionEnableGSUB, valid );
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
    OTV_OPTIONAL_OFFSET( ExtensionDisableGSUB );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   112
    OTV_SIZE_CHECK( ExtensionDisableGSUB );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   113
    if ( ExtensionDisableGSUB )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   114
      otv_x_ux( table + ExtensionDisableGSUB, valid );
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
    valid->extra1 = gpos_lookup_count;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   117
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   118
    OTV_OPTIONAL_OFFSET( ExtensionEnableGPOS );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   119
    OTV_SIZE_CHECK( ExtensionEnableGPOS );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   120
    if ( ExtensionEnableGPOS )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   121
      otv_x_ux( table + ExtensionEnableGPOS, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   122
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   123
    OTV_OPTIONAL_OFFSET( ExtensionDisableGPOS );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   124
    OTV_SIZE_CHECK( ExtensionDisableGPOS );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   125
    if ( ExtensionDisableGPOS )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   126
      otv_x_ux( table + ExtensionDisableGPOS, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   127
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   128
    OTV_OPTIONAL_OFFSET( ExtensionJstfMax );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   129
    OTV_SIZE_CHECK( ExtensionJstfMax );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   130
    if ( ExtensionJstfMax )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   131
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   132
      /* XXX: check lookup types? */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   133
      OTV_NEST2( JstfMax, JstfLookup );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   134
      OTV_RUN( table + ExtensionJstfMax, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   135
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   136
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   137
    valid->extra1 = gsub_lookup_count;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   138
    valid->extra2 = gpos_lookup_count;
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
    OTV_EXIT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   141
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   142
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
  /* sets valid->extra (glyph count)               */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   145
  /* sets valid->func1 (otv_JstfPriority_validate) */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   146
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   147
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   148
  otv_JstfScript_validate( FT_Bytes       table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   149
                           OTV_Validator  valid )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   150
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   151
    FT_Bytes  p = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   152
    FT_UInt   table_size;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   153
    FT_UInt   JstfLangSysCount;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   154
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   155
    OTV_OPTIONAL_TABLE( ExtGlyph );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   156
    OTV_OPTIONAL_TABLE( DefJstfLangSys );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   157
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   158
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   159
    OTV_NAME_ENTER( "JstfScript" );
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
    OTV_LIMIT_CHECK( 6 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   162
    OTV_OPTIONAL_OFFSET( ExtGlyph );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   163
    OTV_OPTIONAL_OFFSET( DefJstfLangSys );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   164
    JstfLangSysCount = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   165
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   166
    OTV_TRACE(( " (JstfLangSysCount = %d)\n", JstfLangSysCount ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   167
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   168
    table_size = JstfLangSysCount * 6 + 6;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   169
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   170
    OTV_SIZE_CHECK( ExtGlyph );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   171
    if ( ExtGlyph )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   172
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   173
      valid->extra1 = valid->glyph_count;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   174
      OTV_NEST1( ExtenderGlyph );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   175
      OTV_RUN( table + ExtGlyph, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   176
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   177
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   178
    OTV_SIZE_CHECK( DefJstfLangSys );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   179
    if ( DefJstfLangSys )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   180
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   181
      OTV_NEST2( JstfLangSys, JstfPriority );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   182
      OTV_RUN( table + DefJstfLangSys, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   183
    }
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
    OTV_LIMIT_CHECK( 6 * JstfLangSysCount );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   186
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   187
    /* JstfLangSysRecord */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   188
    OTV_NEST2( JstfLangSys, JstfPriority );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   189
    for ( ; JstfLangSysCount > 0; JstfLangSysCount-- )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   190
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   191
      p += 4;       /* skip JstfLangSysTag */
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
      OTV_RUN( table + FT_NEXT_USHORT( p ), valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   194
    }
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
    OTV_EXIT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   197
  }
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   200
  /* sets valid->extra1 (GSUB lookup count) */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   201
  /* sets valid->extra2 (GPOS lookup count) */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   202
  /* sets valid->glyph_count                */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   203
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   204
  FT_LOCAL_DEF( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   205
  otv_JSTF_validate( FT_Bytes      table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   206
                     FT_Bytes      gsub,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   207
                     FT_Bytes      gpos,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   208
                     FT_UInt       glyph_count,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   209
                     FT_Validator  ftvalid )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   210
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   211
    OTV_ValidatorRec  validrec;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   212
    OTV_Validator     valid = &validrec;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   213
    FT_Bytes          p     = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   214
    FT_UInt           JstfScriptCount;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   215
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
    valid->root = ftvalid;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   218
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   219
    FT_TRACE3(( "validating JSTF table\n" ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   220
    OTV_INIT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   221
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   222
    OTV_LIMIT_CHECK( 6 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   223
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   224
    if ( FT_NEXT_ULONG( p ) != 0x10000UL )      /* Version */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   225
      FT_INVALID_FORMAT;
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
    JstfScriptCount = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   228
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   229
    FT_TRACE3(( " (JstfScriptCount = %d)\n", JstfScriptCount ));
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
    OTV_LIMIT_CHECK( JstfScriptCount * 6 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   232
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   233
    if ( gsub )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   234
      valid->extra1 = otv_GSUBGPOS_get_Lookup_count( gsub );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   235
    else
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   236
      valid->extra1 = 0;
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
    if ( gpos )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   239
      valid->extra2 = otv_GSUBGPOS_get_Lookup_count( gpos );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   240
    else
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   241
      valid->extra2 = 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   242
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   243
    valid->glyph_count = glyph_count;
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
    /* JstfScriptRecord */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   246
    for ( ; JstfScriptCount > 0; JstfScriptCount-- )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   247
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   248
      p += 4;       /* skip JstfScriptTag */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   249
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   250
      /* JstfScript */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   251
      otv_JstfScript_validate( table + FT_NEXT_USHORT( p ), valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   252
    }
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
    FT_TRACE4(( "\n" ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   255
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   256
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
/* END */