misc/libfreetype/src/otvalid/otvgpos.c
author koda
Fri, 06 Jan 2012 01:51:04 +0100
changeset 6551 a2f39cb9af62
parent 5172 88f2e05288ba
permissions -rw-r--r--
fix a couple of loose ends: sdl_mixer is informed of that OGG is provided by Tremor with its own macro, there is no more a segfault on Tremor cleanup, added new event type and timestamp entry for SDL, removed spurious characters from the japanese translation, uSound errors now are output with SDLTry, uSound doesn't need sound preloading any more
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
/*  otvgpos.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 GPOS 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 2002, 2004, 2005, 2006, 2007, 2008 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_otvgpos
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
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    35
  otv_Anchor_validate( FT_Bytes       table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    36
                       OTV_Validator  valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    37
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    38
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    39
  otv_MarkArray_validate( FT_Bytes       table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    40
                          OTV_Validator  valid );
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
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
  /*************************************************************************/
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
  /*****                      UTILITY FUNCTIONS                        *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    47
  /*****                                                               *****/
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
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    50
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    51
#define BaseArrayFunc       otv_x_sxy
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    52
#define LigatureAttachFunc  otv_x_sxy
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    53
#define Mark2ArrayFunc      otv_x_sxy
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
  /* uses valid->extra1 (counter)                             */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    56
  /* uses valid->extra2 (boolean to handle NULL anchor field) */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    57
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    58
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    59
  otv_x_sxy( FT_Bytes       table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    60
             OTV_Validator  valid )
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
    FT_Bytes  p = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    63
    FT_UInt   Count, count1, table_size;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    64
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
    OTV_ENTER;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    67
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    68
    OTV_LIMIT_CHECK( 2 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    69
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    70
    Count = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    71
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    72
    OTV_TRACE(( " (Count = %d)\n", Count ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    73
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    74
    OTV_LIMIT_CHECK( Count * valid->extra1 * 2 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    75
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    76
    table_size = Count * valid->extra1 * 2 + 2;
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
    for ( ; Count > 0; Count-- )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    79
      for ( count1 = valid->extra1; count1 > 0; count1-- )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    80
      {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    81
        OTV_OPTIONAL_TABLE( anchor_offset );
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    84
        OTV_OPTIONAL_OFFSET( anchor_offset );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    85
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    86
        if ( valid->extra2 )
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
          OTV_SIZE_CHECK( anchor_offset );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    89
          if ( anchor_offset )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    90
            otv_Anchor_validate( table + anchor_offset, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    91
        }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    92
        else
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    93
          otv_Anchor_validate( table + anchor_offset, 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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    96
    OTV_EXIT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    97
  }
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   100
#define MarkBasePosFormat1Func  otv_u_O_O_u_O_O
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   101
#define MarkLigPosFormat1Func   otv_u_O_O_u_O_O
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   102
#define MarkMarkPosFormat1Func  otv_u_O_O_u_O_O
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
  /* sets valid->extra1 (class 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
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   107
  otv_u_O_O_u_O_O( FT_Bytes       table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   108
                   OTV_Validator  valid )
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
    FT_Bytes           p = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   111
    FT_UInt            Coverage1, Coverage2, ClassCount;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   112
    FT_UInt            Array1, Array2;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   113
    OTV_Validate_Func  func;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   114
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
    OTV_ENTER;
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
    p += 2;     /* skip PosFormat */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   119
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   120
    OTV_LIMIT_CHECK( 10 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   121
    Coverage1  = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   122
    Coverage2  = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   123
    ClassCount = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   124
    Array1     = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   125
    Array2     = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   126
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   127
    otv_Coverage_validate( table + Coverage1, valid, -1 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   128
    otv_Coverage_validate( table + Coverage2, valid, -1 );
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
    otv_MarkArray_validate( table + Array1, valid );
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
    valid->nesting_level++;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   133
    func          = valid->func[valid->nesting_level];
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   134
    valid->extra1 = ClassCount;
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
    func( table + Array2, valid );
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
    valid->nesting_level--;
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
  /*************************************************************************/
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
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   147
  /*****                        VALUE RECORDS                          *****/
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
  /*************************************************************************/
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   152
  static FT_UInt
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   153
  otv_value_length( FT_UInt  format )
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
    FT_UInt  count;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   158
    count = ( ( format & 0xAA ) >> 1 ) + ( format & 0x55 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   159
    count = ( ( count  & 0xCC ) >> 2 ) + ( count  & 0x33 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   160
    count = ( ( count  & 0xF0 ) >> 4 ) + ( count  & 0x0F );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   161
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   162
    return count * 2;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   163
  }
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   166
  /* uses valid->extra3 (pointer to base table) */
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
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   169
  otv_ValueRecord_validate( FT_Bytes       table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   170
                            FT_UInt        format,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   171
                            OTV_Validator  valid )
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
    FT_Bytes  p = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   174
    FT_UInt   count;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   175
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   176
#ifdef FT_DEBUG_LEVEL_TRACE
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   177
    FT_Int    loop;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   178
    FT_ULong  res = 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   179
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_NAME_ENTER( "ValueRecord" );
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
    /* display `format' in dual representation */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   184
    for ( loop = 7; loop >= 0; loop-- )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   185
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   186
      res <<= 4;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   187
      res  += ( format >> loop ) & 1;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   188
    }
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
    OTV_TRACE(( " (format 0b%08lx)\n", res ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   191
#endif
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 ( format >= 0x100 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   194
      FT_INVALID_FORMAT;
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
    for ( count = 4; count > 0; count-- )
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
      if ( format & 1 )
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
        /* XPlacement, YPlacement, XAdvance, YAdvance */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   201
        OTV_LIMIT_CHECK( 2 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   202
        p += 2;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   205
      format >>= 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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   208
    for ( count = 4; count > 0; count-- )
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 ( format & 1 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   211
      {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   212
        FT_PtrDist  table_size;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   213
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   214
        OTV_OPTIONAL_TABLE( device );
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
        /* XPlaDevice, YPlaDevice, XAdvDevice, YAdvDevice */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   218
        OTV_LIMIT_CHECK( 2 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   219
        OTV_OPTIONAL_OFFSET( device );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   220
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   221
        /* XXX: this value is usually too small, especially if the current */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   222
        /* ValueRecord is part of an array -- getting the correct table    */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   223
        /* size is probably not worth the trouble                          */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   224
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   225
        table_size = p - valid->extra3;
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
        OTV_SIZE_CHECK( device );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   228
        if ( device )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   229
          otv_Device_validate( valid->extra3 + device, valid );
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
      format >>= 1;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   234
    OTV_EXIT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   235
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   236
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
  /*************************************************************************/
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
  /*****                           ANCHORS                             *****/
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
  /*************************************************************************/
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
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   247
  otv_Anchor_validate( FT_Bytes       table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   248
                       OTV_Validator  valid )
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
    FT_Bytes  p = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   251
    FT_UInt   AnchorFormat;
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
    OTV_NAME_ENTER( "Anchor");
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
    OTV_LIMIT_CHECK( 6 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   257
    AnchorFormat = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   258
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   259
    OTV_TRACE(( " (format %d)\n", AnchorFormat ));
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
    p += 4;     /* skip XCoordinate and YCoordinate */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   262
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   263
    switch ( AnchorFormat )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   264
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   265
    case 1:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   266
      break;
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
    case 2:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   269
      OTV_LIMIT_CHECK( 2 );  /* AnchorPoint */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   270
      break;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   271
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   272
    case 3:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   273
      {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   274
        FT_UInt   table_size;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   275
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   276
        OTV_OPTIONAL_TABLE( XDeviceTable );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   277
        OTV_OPTIONAL_TABLE( YDeviceTable );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   278
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   279
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   280
        OTV_LIMIT_CHECK( 4 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   281
        OTV_OPTIONAL_OFFSET( XDeviceTable );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   282
        OTV_OPTIONAL_OFFSET( YDeviceTable );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   283
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   284
        table_size = 6 + 4;
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
        OTV_SIZE_CHECK( XDeviceTable );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   287
        if ( XDeviceTable )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   288
          otv_Device_validate( table + XDeviceTable, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   289
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   290
        OTV_SIZE_CHECK( YDeviceTable );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   291
        if ( YDeviceTable )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   292
          otv_Device_validate( table + YDeviceTable, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   293
      }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   294
      break;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   295
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   296
    default:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   297
      FT_INVALID_FORMAT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   298
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   299
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   300
    OTV_EXIT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   301
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   302
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   303
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   304
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   305
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   306
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   307
  /*****                         MARK ARRAYS                           *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   308
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   309
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   310
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   311
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   312
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   313
  otv_MarkArray_validate( FT_Bytes       table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   314
                          OTV_Validator  valid )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   315
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   316
    FT_Bytes  p = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   317
    FT_UInt   MarkCount;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   318
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   319
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   320
    OTV_NAME_ENTER( "MarkArray" );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   321
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   322
    OTV_LIMIT_CHECK( 2 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   323
    MarkCount = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   324
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   325
    OTV_TRACE(( " (MarkCount = %d)\n", MarkCount ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   326
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   327
    OTV_LIMIT_CHECK( MarkCount * 4 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   328
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   329
    /* MarkRecord */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   330
    for ( ; MarkCount > 0; MarkCount-- )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   331
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   332
      p += 2;   /* skip Class */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   333
      /* MarkAnchor */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   334
      otv_Anchor_validate( table + FT_NEXT_USHORT( p ), valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   335
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   336
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   337
    OTV_EXIT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   338
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   339
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   340
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   341
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   342
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   343
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   344
  /*****                     GPOS LOOKUP TYPE 1                        *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   345
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   346
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   347
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   348
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   349
  /* sets valid->extra3 (pointer to base table) */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   350
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   351
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   352
  otv_SinglePos_validate( FT_Bytes       table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   353
                          OTV_Validator  valid )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   354
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   355
    FT_Bytes  p = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   356
    FT_UInt   PosFormat;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   357
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   358
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   359
    OTV_NAME_ENTER( "SinglePos" );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   360
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   361
    OTV_LIMIT_CHECK( 2 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   362
    PosFormat = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   363
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   364
    OTV_TRACE(( " (format %d)\n", PosFormat ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   365
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   366
    valid->extra3 = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   367
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   368
    switch ( PosFormat )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   369
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   370
    case 1:     /* SinglePosFormat1 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   371
      {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   372
        FT_UInt  Coverage, ValueFormat;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   373
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   374
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   375
        OTV_LIMIT_CHECK( 4 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   376
        Coverage    = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   377
        ValueFormat = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   378
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   379
        otv_Coverage_validate( table + Coverage, valid, -1 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   380
        otv_ValueRecord_validate( p, ValueFormat, valid ); /* Value */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   381
      }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   382
      break;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   383
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   384
    case 2:     /* SinglePosFormat2 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   385
      {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   386
        FT_UInt  Coverage, ValueFormat, ValueCount, len_value;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   387
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   388
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   389
        OTV_LIMIT_CHECK( 6 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   390
        Coverage    = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   391
        ValueFormat = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   392
        ValueCount  = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   393
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   394
        OTV_TRACE(( " (ValueCount = %d)\n", ValueCount ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   395
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   396
        len_value = otv_value_length( ValueFormat );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   397
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   398
        otv_Coverage_validate( table + Coverage, valid, ValueCount );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   399
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   400
        OTV_LIMIT_CHECK( ValueCount * len_value );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   401
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   402
        /* Value */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   403
        for ( ; ValueCount > 0; ValueCount-- )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   404
        {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   405
          otv_ValueRecord_validate( p, ValueFormat, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   406
          p += len_value;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   407
        }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   408
      }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   409
      break;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   410
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   411
    default:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   412
      FT_INVALID_FORMAT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   413
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   414
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   415
    OTV_EXIT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   416
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   417
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   418
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   419
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   420
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   421
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   422
  /*****                     GPOS LOOKUP TYPE 2                        *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   423
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   424
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   425
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   426
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   427
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   428
  otv_PairSet_validate( FT_Bytes       table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   429
                        FT_UInt        format1,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   430
                        FT_UInt        format2,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   431
                        OTV_Validator  valid )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   432
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   433
    FT_Bytes  p = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   434
    FT_UInt   value_len1, value_len2, PairValueCount;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   435
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   436
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   437
    OTV_NAME_ENTER( "PairSet" );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   438
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   439
    OTV_LIMIT_CHECK( 2 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   440
    PairValueCount = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   441
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   442
    OTV_TRACE(( " (PairValueCount = %d)\n", PairValueCount ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   443
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   444
    value_len1 = otv_value_length( format1 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   445
    value_len2 = otv_value_length( format2 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   446
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   447
    OTV_LIMIT_CHECK( PairValueCount * ( value_len1 + value_len2 + 2 ) );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   448
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   449
    /* PairValueRecord */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   450
    for ( ; PairValueCount > 0; PairValueCount-- )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   451
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   452
      p += 2;       /* skip SecondGlyph */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   453
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   454
      if ( format1 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   455
        otv_ValueRecord_validate( p, format1, valid ); /* Value1 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   456
      p += value_len1;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   457
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   458
      if ( format2 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   459
        otv_ValueRecord_validate( p, format2, valid ); /* Value2 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   460
      p += value_len2;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   461
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   462
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   463
    OTV_EXIT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   464
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   465
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   466
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   467
  /* sets valid->extra3 (pointer to base table) */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   468
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   469
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   470
  otv_PairPos_validate( FT_Bytes       table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   471
                        OTV_Validator  valid )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   472
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   473
    FT_Bytes  p = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   474
    FT_UInt   PosFormat;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   475
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   476
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   477
    OTV_NAME_ENTER( "PairPos" );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   478
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   479
    OTV_LIMIT_CHECK( 2 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   480
    PosFormat = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   481
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   482
    OTV_TRACE(( " (format %d)\n", PosFormat ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   483
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   484
    valid->extra3 = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   485
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   486
    switch ( PosFormat )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   487
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   488
    case 1:     /* PairPosFormat1 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   489
      {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   490
        FT_UInt  Coverage, ValueFormat1, ValueFormat2, PairSetCount;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   491
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   492
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   493
        OTV_LIMIT_CHECK( 8 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   494
        Coverage     = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   495
        ValueFormat1 = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   496
        ValueFormat2 = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   497
        PairSetCount = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   498
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   499
        OTV_TRACE(( " (PairSetCount = %d)\n", PairSetCount ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   500
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   501
        otv_Coverage_validate( table + Coverage, valid, -1 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   502
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   503
        OTV_LIMIT_CHECK( PairSetCount * 2 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   504
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   505
        /* PairSetOffset */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   506
        for ( ; PairSetCount > 0; PairSetCount-- )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   507
          otv_PairSet_validate( table + FT_NEXT_USHORT( p ),
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   508
                                ValueFormat1, ValueFormat2, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   509
      }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   510
      break;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   511
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   512
    case 2:     /* PairPosFormat2 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   513
      {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   514
        FT_UInt  Coverage, ValueFormat1, ValueFormat2, ClassDef1, ClassDef2;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   515
        FT_UInt  ClassCount1, ClassCount2, len_value1, len_value2, count;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   516
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   517
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   518
        OTV_LIMIT_CHECK( 14 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   519
        Coverage     = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   520
        ValueFormat1 = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   521
        ValueFormat2 = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   522
        ClassDef1    = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   523
        ClassDef2    = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   524
        ClassCount1  = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   525
        ClassCount2  = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   526
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   527
        OTV_TRACE(( " (ClassCount1 = %d)\n", ClassCount1 ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   528
        OTV_TRACE(( " (ClassCount2 = %d)\n", ClassCount2 ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   529
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   530
        len_value1 = otv_value_length( ValueFormat1 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   531
        len_value2 = otv_value_length( ValueFormat2 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   532
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   533
        otv_Coverage_validate( table + Coverage, valid, -1 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   534
        otv_ClassDef_validate( table + ClassDef1, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   535
        otv_ClassDef_validate( table + ClassDef2, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   536
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   537
        OTV_LIMIT_CHECK( ClassCount1 * ClassCount2 *
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   538
                     ( len_value1 + len_value2 ) );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   539
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   540
        /* Class1Record */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   541
        for ( ; ClassCount1 > 0; ClassCount1-- )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   542
        {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   543
          /* Class2Record */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   544
          for ( count = ClassCount2; count > 0; count-- )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   545
          {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   546
            if ( ValueFormat1 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   547
              /* Value1 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   548
              otv_ValueRecord_validate( p, ValueFormat1, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   549
            p += len_value1;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   550
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   551
            if ( ValueFormat2 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   552
              /* Value2 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   553
              otv_ValueRecord_validate( p, ValueFormat2, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   554
            p += len_value2;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   555
          }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   556
        }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   557
      }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   558
      break;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   559
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   560
    default:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   561
      FT_INVALID_FORMAT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   562
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   563
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   564
    OTV_EXIT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   565
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   566
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   567
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   568
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   569
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   570
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   571
  /*****                     GPOS LOOKUP TYPE 3                        *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   572
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   573
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   574
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   575
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   576
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   577
  otv_CursivePos_validate( FT_Bytes       table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   578
                           OTV_Validator  valid )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   579
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   580
    FT_Bytes  p = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   581
    FT_UInt   PosFormat;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   582
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   583
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   584
    OTV_NAME_ENTER( "CursivePos" );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   585
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   586
    OTV_LIMIT_CHECK( 2 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   587
    PosFormat = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   588
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   589
    OTV_TRACE(( " (format %d)\n", PosFormat ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   590
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   591
    switch ( PosFormat )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   592
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   593
    case 1:     /* CursivePosFormat1 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   594
      {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   595
        FT_UInt   table_size;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   596
        FT_UInt   Coverage, EntryExitCount;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   597
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   598
        OTV_OPTIONAL_TABLE( EntryAnchor );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   599
        OTV_OPTIONAL_TABLE( ExitAnchor  );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   600
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   601
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   602
        OTV_LIMIT_CHECK( 4 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   603
        Coverage       = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   604
        EntryExitCount = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   605
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   606
        OTV_TRACE(( " (EntryExitCount = %d)\n", EntryExitCount ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   607
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   608
        otv_Coverage_validate( table + Coverage, valid, EntryExitCount );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   609
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   610
        OTV_LIMIT_CHECK( EntryExitCount * 4 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   611
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   612
        table_size = EntryExitCount * 4 + 4;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   613
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   614
        /* EntryExitRecord */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   615
        for ( ; EntryExitCount > 0; EntryExitCount-- )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   616
        {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   617
          OTV_OPTIONAL_OFFSET( EntryAnchor );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   618
          OTV_OPTIONAL_OFFSET( ExitAnchor  );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   619
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   620
          OTV_SIZE_CHECK( EntryAnchor );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   621
          if ( EntryAnchor )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   622
            otv_Anchor_validate( table + EntryAnchor, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   623
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   624
          OTV_SIZE_CHECK( ExitAnchor );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   625
          if ( ExitAnchor )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   626
            otv_Anchor_validate( table + ExitAnchor, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   627
        }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   628
      }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   629
      break;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   630
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   631
    default:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   632
      FT_INVALID_FORMAT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   633
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   634
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   635
    OTV_EXIT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   636
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   637
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   638
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   639
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   640
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   641
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   642
  /*****                     GPOS LOOKUP TYPE 4                        *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   643
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   644
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   645
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   646
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   647
  /* UNDOCUMENTED (in OpenType 1.5):              */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   648
  /* BaseRecord tables can contain NULL pointers. */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   649
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   650
  /* sets valid->extra2 (1) */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   651
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   652
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   653
  otv_MarkBasePos_validate( FT_Bytes       table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   654
                            OTV_Validator  valid )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   655
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   656
    FT_Bytes  p = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   657
    FT_UInt   PosFormat;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   658
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   659
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   660
    OTV_NAME_ENTER( "MarkBasePos" );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   661
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   662
    OTV_LIMIT_CHECK( 2 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   663
    PosFormat = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   664
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   665
    OTV_TRACE(( " (format %d)\n", PosFormat ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   666
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   667
    switch ( PosFormat )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   668
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   669
    case 1:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   670
      valid->extra2 = 1;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   671
      OTV_NEST2( MarkBasePosFormat1, BaseArray );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   672
      OTV_RUN( table, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   673
      break;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   674
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   675
    default:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   676
      FT_INVALID_FORMAT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   677
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   678
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   679
    OTV_EXIT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   680
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   681
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   682
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   683
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   684
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   685
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   686
  /*****                     GPOS LOOKUP TYPE 5                        *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   687
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   688
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   689
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   690
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   691
  /* sets valid->extra2 (1) */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   692
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   693
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   694
  otv_MarkLigPos_validate( FT_Bytes       table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   695
                           OTV_Validator  valid )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   696
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   697
    FT_Bytes  p = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   698
    FT_UInt   PosFormat;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   699
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   700
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   701
    OTV_NAME_ENTER( "MarkLigPos" );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   702
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   703
    OTV_LIMIT_CHECK( 2 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   704
    PosFormat = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   705
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   706
    OTV_TRACE(( " (format %d)\n", PosFormat ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   707
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   708
    switch ( PosFormat )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   709
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   710
    case 1:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   711
      valid->extra2 = 1;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   712
      OTV_NEST3( MarkLigPosFormat1, LigatureArray, LigatureAttach );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   713
      OTV_RUN( table, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   714
      break;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   715
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   716
    default:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   717
      FT_INVALID_FORMAT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   718
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   719
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   720
    OTV_EXIT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   721
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   722
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   723
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   724
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   725
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   726
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   727
  /*****                     GPOS LOOKUP TYPE 6                        *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   728
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   729
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   730
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   731
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   732
  /* sets valid->extra2 (0) */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   733
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   734
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   735
  otv_MarkMarkPos_validate( FT_Bytes       table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   736
                            OTV_Validator  valid )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   737
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   738
    FT_Bytes  p = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   739
    FT_UInt   PosFormat;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   740
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   741
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   742
    OTV_NAME_ENTER( "MarkMarkPos" );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   743
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   744
    OTV_LIMIT_CHECK( 2 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   745
    PosFormat = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   746
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   747
    OTV_TRACE(( " (format %d)\n", PosFormat ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   748
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   749
    switch ( PosFormat )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   750
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   751
    case 1:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   752
      valid->extra2 = 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   753
      OTV_NEST2( MarkMarkPosFormat1, Mark2Array );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   754
      OTV_RUN( table, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   755
      break;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   756
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   757
    default:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   758
      FT_INVALID_FORMAT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   759
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   760
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   761
    OTV_EXIT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   762
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   763
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   764
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   765
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   766
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   767
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   768
  /*****                     GPOS LOOKUP TYPE 7                        *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   769
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   770
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   771
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   772
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   773
  /* sets valid->extra1 (lookup count) */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   774
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   775
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   776
  otv_ContextPos_validate( FT_Bytes       table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   777
                           OTV_Validator  valid )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   778
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   779
    FT_Bytes  p = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   780
    FT_UInt   PosFormat;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   781
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   782
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   783
    OTV_NAME_ENTER( "ContextPos" );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   784
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   785
    OTV_LIMIT_CHECK( 2 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   786
    PosFormat = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   787
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   788
    OTV_TRACE(( " (format %d)\n", PosFormat ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   789
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   790
    switch ( PosFormat )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   791
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   792
    case 1:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   793
      /* no need to check glyph indices/classes used as input for these */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   794
      /* context rules since even invalid glyph indices/classes return  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   795
      /* meaningful results                                             */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   796
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   797
      valid->extra1 = valid->lookup_count;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   798
      OTV_NEST3( ContextPosFormat1, PosRuleSet, PosRule );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   799
      OTV_RUN( table, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   800
      break;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   801
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   802
    case 2:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   803
      /* no need to check glyph indices/classes used as input for these */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   804
      /* context rules since even invalid glyph indices/classes return  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   805
      /* meaningful results                                             */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   806
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   807
      OTV_NEST3( ContextPosFormat2, PosClassSet, PosClassRule );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   808
      OTV_RUN( table, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   809
      break;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   810
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   811
    case 3:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   812
      OTV_NEST1( ContextPosFormat3 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   813
      OTV_RUN( table, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   814
      break;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   815
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   816
    default:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   817
      FT_INVALID_FORMAT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   818
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   819
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   820
    OTV_EXIT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   821
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   822
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   823
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   824
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   825
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   826
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   827
  /*****                     GPOS LOOKUP TYPE 8                        *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   828
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   829
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   830
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   831
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   832
  /* sets valid->extra1 (lookup count) */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   833
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   834
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   835
  otv_ChainContextPos_validate( FT_Bytes       table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   836
                                OTV_Validator  valid )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   837
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   838
    FT_Bytes  p = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   839
    FT_UInt   PosFormat;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   840
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   841
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   842
    OTV_NAME_ENTER( "ChainContextPos" );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   843
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   844
    OTV_LIMIT_CHECK( 2 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   845
    PosFormat = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   846
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   847
    OTV_TRACE(( " (format %d)\n", PosFormat ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   848
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   849
    switch ( PosFormat )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   850
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   851
    case 1:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   852
      /* no need to check glyph indices/classes used as input for these */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   853
      /* context rules since even invalid glyph indices/classes return  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   854
      /* meaningful results                                             */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   855
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   856
      valid->extra1 = valid->lookup_count;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   857
      OTV_NEST3( ChainContextPosFormat1,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   858
                 ChainPosRuleSet, ChainPosRule );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   859
      OTV_RUN( table, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   860
      break;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   861
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   862
    case 2:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   863
      /* no need to check glyph indices/classes used as input for these */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   864
      /* context rules since even invalid glyph indices/classes return  */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   865
      /* meaningful results                                             */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   866
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   867
      OTV_NEST3( ChainContextPosFormat2,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   868
                 ChainPosClassSet, ChainPosClassRule );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   869
      OTV_RUN( table, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   870
      break;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   871
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   872
    case 3:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   873
      OTV_NEST1( ChainContextPosFormat3 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   874
      OTV_RUN( table, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   875
      break;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   876
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   877
    default:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   878
      FT_INVALID_FORMAT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   879
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   880
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   881
    OTV_EXIT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   882
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   883
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   884
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   885
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   886
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   887
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   888
  /*****                     GPOS LOOKUP TYPE 9                        *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   889
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   890
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   891
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   892
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   893
  /* uses valid->type_funcs */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   894
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   895
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   896
  otv_ExtensionPos_validate( FT_Bytes       table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   897
                             OTV_Validator  valid )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   898
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   899
    FT_Bytes  p = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   900
    FT_UInt   PosFormat;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   901
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   902
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   903
    OTV_NAME_ENTER( "ExtensionPos" );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   904
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   905
    OTV_LIMIT_CHECK( 2 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   906
    PosFormat = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   907
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   908
    OTV_TRACE(( " (format %d)\n", PosFormat ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   909
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   910
    switch ( PosFormat )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   911
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   912
    case 1:     /* ExtensionPosFormat1 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   913
      {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   914
        FT_UInt            ExtensionLookupType;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   915
        FT_ULong           ExtensionOffset;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   916
        OTV_Validate_Func  validate;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   917
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   918
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   919
        OTV_LIMIT_CHECK( 6 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   920
        ExtensionLookupType = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   921
        ExtensionOffset     = FT_NEXT_ULONG( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   922
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   923
        if ( ExtensionLookupType == 0 || ExtensionLookupType >= 9 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   924
          FT_INVALID_DATA;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   925
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   926
        validate = valid->type_funcs[ExtensionLookupType - 1];
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   927
        validate( table + ExtensionOffset, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   928
      }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   929
      break;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   930
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   931
    default:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   932
      FT_INVALID_FORMAT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   933
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   934
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   935
    OTV_EXIT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   936
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   937
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   938
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   939
  static const OTV_Validate_Func  otv_gpos_validate_funcs[9] =
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   940
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   941
    otv_SinglePos_validate,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   942
    otv_PairPos_validate,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   943
    otv_CursivePos_validate,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   944
    otv_MarkBasePos_validate,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   945
    otv_MarkLigPos_validate,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   946
    otv_MarkMarkPos_validate,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   947
    otv_ContextPos_validate,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   948
    otv_ChainContextPos_validate,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   949
    otv_ExtensionPos_validate
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   950
  };
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   951
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   952
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   953
  /* sets valid->type_count */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   954
  /* sets valid->type_funcs */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   955
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   956
  FT_LOCAL_DEF( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   957
  otv_GPOS_subtable_validate( FT_Bytes       table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   958
                              OTV_Validator  valid )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   959
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   960
    valid->type_count = 9;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   961
    valid->type_funcs = (OTV_Validate_Func*)otv_gpos_validate_funcs;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   962
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   963
    otv_Lookup_validate( table, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   964
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   965
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   966
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   967
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   968
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   969
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   970
  /*****                          GPOS TABLE                           *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   971
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   972
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   973
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   974
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   975
  /* sets valid->glyph_count */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   976
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   977
  FT_LOCAL_DEF( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   978
  otv_GPOS_validate( FT_Bytes      table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   979
                     FT_UInt       glyph_count,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   980
                     FT_Validator  ftvalid )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   981
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   982
    OTV_ValidatorRec  validrec;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   983
    OTV_Validator     valid = &validrec;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   984
    FT_Bytes          p     = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   985
    FT_UInt           ScriptList, FeatureList, LookupList;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   986
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   987
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   988
    valid->root = ftvalid;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   989
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   990
    FT_TRACE3(( "validating GPOS table\n" ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   991
    OTV_INIT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   992
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   993
    OTV_LIMIT_CHECK( 10 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   994
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   995
    if ( FT_NEXT_ULONG( p ) != 0x10000UL )      /* Version */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   996
      FT_INVALID_FORMAT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   997
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   998
    ScriptList  = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   999
    FeatureList = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
  1000
    LookupList  = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
  1001
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
  1002
    valid->type_count  = 9;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
  1003
    valid->type_funcs  = (OTV_Validate_Func*)otv_gpos_validate_funcs;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
  1004
    valid->glyph_count = glyph_count;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
  1005
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
  1006
    otv_LookupList_validate( table + LookupList,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
  1007
                             valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
  1008
    otv_FeatureList_validate( table + FeatureList, table + LookupList,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
  1009
                              valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
  1010
    otv_ScriptList_validate( table + ScriptList, table + FeatureList,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
  1011
                             valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
  1012
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
  1013
    FT_TRACE4(( "\n" ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
  1014
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
  1015
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
  1016
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
  1017
/* END */