misc/libfreetype/src/otvalid/otvmath.c
author sheepluva
Thu, 03 May 2012 13:25:40 +0200
changeset 7015 08642c7da4a3
parent 5172 88f2e05288ba
permissions -rw-r--r--
add DLC button to net game room
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
/*  otvmath.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 MATH 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 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
/*  Written by George Williams.                                            */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    11
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    12
/*  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
    13
/*  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
    14
/*  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
    15
/*  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
    16
/*  understand and accept it fully.                                        */
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    20
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    21
#include "otvalid.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    22
#include "otvcommn.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    23
#include "otvgpos.h"
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
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    27
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    28
  /* 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
    29
  /* 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
    30
  /* messages during execution.                                            */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    31
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    32
#undef  FT_COMPONENT
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    33
#define FT_COMPONENT  trace_otvmath
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    34
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    35
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    36
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
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    39
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    40
  /*****                  MATH TYPOGRAPHIC CONSTANTS                   *****/
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
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    46
  otv_MathConstants_validate( FT_Bytes       table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    47
                              OTV_Validator  valid )
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
    FT_Bytes  p = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    50
    FT_UInt   i;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    51
    FT_UInt   table_size;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    52
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    53
    OTV_OPTIONAL_TABLE( DeviceTableOffset );
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    56
    OTV_NAME_ENTER( "MathConstants" );
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
    /* 56 constants, 51 have device tables */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    59
    OTV_LIMIT_CHECK( 2 * ( 56 + 51 ) );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    60
    table_size = 2 * ( 56 + 51 );
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
    p += 4 * 2;                 /* First 4 constants have no device tables */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    63
    for ( i = 0; i < 51; ++i )
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
      p += 2;                                            /* skip the value */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    66
      OTV_OPTIONAL_OFFSET( DeviceTableOffset );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    67
      OTV_SIZE_CHECK( DeviceTableOffset );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    68
      if ( DeviceTableOffset )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    69
        otv_Device_validate( table + DeviceTableOffset, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    70
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    71
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    72
    OTV_EXIT;
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
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
  /*************************************************************************/
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
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    79
  /*****                   MATH ITALICS CORRECTION                     *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    80
  /*****                 MATH TOP ACCENT ATTACHMENT                    *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    81
  /*****                                                               *****/
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    85
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    86
  otv_MathItalicsCorrectionInfo_validate( FT_Bytes       table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    87
                                          OTV_Validator  valid,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    88
                                          FT_Int         isItalic )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    89
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    90
    FT_Bytes  p = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    91
    FT_UInt   i, cnt, table_size ;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    92
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    93
    OTV_OPTIONAL_TABLE( Coverage );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    94
    OTV_OPTIONAL_TABLE( DeviceTableOffset );
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
    FT_UNUSED( isItalic );  /* only used if tracing is active */
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
    OTV_NAME_ENTER( isItalic ? "MathItalicsCorrectionInfo"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   100
                             : "MathTopAccentAttachment" );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   101
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   102
    OTV_LIMIT_CHECK( 4 );
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
    OTV_OPTIONAL_OFFSET( Coverage );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   105
    cnt = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   106
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   107
    OTV_LIMIT_CHECK( 4 * cnt );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   108
    table_size = 4 + 4 * cnt;
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
    OTV_SIZE_CHECK( Coverage );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   111
    otv_Coverage_validate( table + Coverage, valid, cnt );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   112
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   113
    for ( i = 0; i < cnt; ++i )
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
      p += 2;                                            /* Skip the value */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   116
      OTV_OPTIONAL_OFFSET( DeviceTableOffset );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   117
      OTV_SIZE_CHECK( DeviceTableOffset );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   118
      if ( DeviceTableOffset )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   119
        otv_Device_validate( table + DeviceTableOffset, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   120
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   121
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   122
    OTV_EXIT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   123
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   124
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   125
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   126
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   127
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   128
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   129
  /*****                           MATH KERNING                        *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   130
  /*****                                                               *****/
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
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   133
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   134
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   135
  otv_MathKern_validate( FT_Bytes       table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   136
                         OTV_Validator  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
    FT_Bytes  p = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   139
    FT_UInt   i, cnt, table_size;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   140
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   141
    OTV_OPTIONAL_TABLE( DeviceTableOffset );
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
    /* OTV_NAME_ENTER( "MathKern" );*/
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
    OTV_LIMIT_CHECK( 2 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   147
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   148
    cnt = FT_NEXT_USHORT( p );
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
    OTV_LIMIT_CHECK( 4 * cnt + 2 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   151
    table_size = 4 + 4 * cnt;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   152
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   153
    /* Heights */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   154
    for ( i = 0; i < cnt; ++i )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   155
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   156
      p += 2;                                            /* Skip the value */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   157
      OTV_OPTIONAL_OFFSET( DeviceTableOffset );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   158
      OTV_SIZE_CHECK( DeviceTableOffset );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   159
      if ( DeviceTableOffset )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   160
        otv_Device_validate( table + DeviceTableOffset, valid );
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   163
    /* One more Kerning value */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   164
    for ( i = 0; i < cnt + 1; ++i )
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
      p += 2;                                            /* Skip the value */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   167
      OTV_OPTIONAL_OFFSET( DeviceTableOffset );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   168
      OTV_SIZE_CHECK( DeviceTableOffset );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   169
      if ( DeviceTableOffset )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   170
        otv_Device_validate( table + DeviceTableOffset, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   171
    }
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
    OTV_EXIT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   174
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   175
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   176
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   177
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   178
  otv_MathKernInfo_validate( FT_Bytes       table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   179
                             OTV_Validator  valid )
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
    FT_Bytes  p = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   182
    FT_UInt   i, j, cnt, table_size;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   183
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   184
    OTV_OPTIONAL_TABLE( Coverage );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   185
    OTV_OPTIONAL_TABLE( MKRecordOffset );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   186
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   187
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   188
    OTV_NAME_ENTER( "MathKernInfo" );
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_LIMIT_CHECK( 4 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   191
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   192
    OTV_OPTIONAL_OFFSET( Coverage );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   193
    cnt = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   194
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   195
    OTV_LIMIT_CHECK( 8 * cnt );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   196
    table_size = 4 + 8 * cnt;
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
    OTV_SIZE_CHECK( Coverage );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   199
    otv_Coverage_validate( table + Coverage, valid, cnt );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   200
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   201
    for ( i = 0; i < cnt; ++i )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   202
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   203
      for ( j = 0; j < 4; ++j )
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
        OTV_OPTIONAL_OFFSET( MKRecordOffset );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   206
        OTV_SIZE_CHECK( MKRecordOffset );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   207
        if ( MKRecordOffset )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   208
          otv_MathKern_validate( table + MKRecordOffset, valid );
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
    }
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
    OTV_EXIT;
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
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
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   218
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   219
  /*****                         MATH GLYPH INFO                       *****/
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
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   222
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   223
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   224
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   225
  otv_MathGlyphInfo_validate( FT_Bytes       table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   226
                              OTV_Validator  valid )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   227
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   228
    FT_Bytes  p = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   229
    FT_UInt   MathItalicsCorrectionInfo, MathTopAccentAttachment;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   230
    FT_UInt   ExtendedShapeCoverage, MathKernInfo;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   231
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
    OTV_NAME_ENTER( "MathGlyphInfo" );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   234
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   235
    OTV_LIMIT_CHECK( 8 );
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
    MathItalicsCorrectionInfo = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   238
    MathTopAccentAttachment   = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   239
    ExtendedShapeCoverage     = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   240
    MathKernInfo              = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   241
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   242
    if ( MathItalicsCorrectionInfo )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   243
      otv_MathItalicsCorrectionInfo_validate(
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   244
        table + MathItalicsCorrectionInfo, valid, TRUE );
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
    /* Italic correction and Top Accent Attachment have the same format */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   247
    if ( MathTopAccentAttachment )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   248
      otv_MathItalicsCorrectionInfo_validate(
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   249
        table + MathTopAccentAttachment, valid, FALSE );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   250
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   251
    if ( ExtendedShapeCoverage )
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
      OTV_NAME_ENTER( "ExtendedShapeCoverage" );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   254
      otv_Coverage_validate( table + ExtendedShapeCoverage, valid, -1 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   255
      OTV_EXIT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   256
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   257
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   258
    if ( MathKernInfo )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   259
      otv_MathKernInfo_validate( table + MathKernInfo, valid );
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
    OTV_EXIT;
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
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
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   266
  /*************************************************************************/
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
  /*****                    MATH GLYPH CONSTRUCTION                    *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   269
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   270
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   271
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   272
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   273
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   274
  otv_GlyphAssembly_validate( FT_Bytes       table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   275
                              OTV_Validator  valid )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   276
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   277
    FT_Bytes  p = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   278
    FT_UInt   pcnt, table_size;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   279
    FT_UInt   i;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   280
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   281
    OTV_OPTIONAL_TABLE( DeviceTableOffset );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   282
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   283
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   284
    /* OTV_NAME_ENTER( "GlyphAssembly" ); */
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_LIMIT_CHECK( 6 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   287
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   288
    p += 2;                           /* Skip the Italics Correction value */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   289
    OTV_OPTIONAL_OFFSET( DeviceTableOffset );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   290
    pcnt = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   291
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   292
    OTV_LIMIT_CHECK( 8 * pcnt );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   293
    table_size = 6 + 8 * pcnt;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   294
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   295
    OTV_SIZE_CHECK( DeviceTableOffset );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   296
    if ( DeviceTableOffset )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   297
      otv_Device_validate( table + DeviceTableOffset, valid );
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
    for ( i = 0; i < pcnt; ++i )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   300
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   301
      FT_UInt  gid;
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
      gid = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   305
      if ( gid >= valid->glyph_count )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   306
        FT_INVALID_GLYPH_ID;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   307
      p += 2*4;             /* skip the Start, End, Full, and Flags fields */
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
    /* OTV_EXIT; */
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   313
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   314
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   315
  otv_MathGlyphConstruction_validate( FT_Bytes       table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   316
                                      OTV_Validator  valid )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   317
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   318
    FT_Bytes  p = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   319
    FT_UInt   vcnt, table_size;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   320
    FT_UInt   i;
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_OPTIONAL_TABLE( GlyphAssembly );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   323
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_NAME_ENTER( "MathGlyphConstruction" ); */
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( 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
    OTV_OPTIONAL_OFFSET( GlyphAssembly );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   330
    vcnt = FT_NEXT_USHORT( p );
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
    OTV_LIMIT_CHECK( 4 * vcnt );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   333
    table_size = 4 + 4 * vcnt;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   334
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   335
    for ( i = 0; i < vcnt; ++i )
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
      FT_UInt  gid;
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
      gid = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   341
      if ( gid >= valid->glyph_count )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   342
        FT_INVALID_GLYPH_ID;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   343
      p += 2;                          /* skip the size */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   344
    }
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
    OTV_SIZE_CHECK( GlyphAssembly );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   347
    if ( GlyphAssembly )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   348
      otv_GlyphAssembly_validate( table+GlyphAssembly, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   349
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   350
    /* OTV_EXIT; */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   351
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   352
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   353
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   354
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   355
  otv_MathVariants_validate( FT_Bytes       table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   356
                             OTV_Validator  valid )
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
    FT_Bytes  p = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   359
    FT_UInt   vcnt, hcnt, i, table_size;
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_OPTIONAL_TABLE( VCoverage );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   362
    OTV_OPTIONAL_TABLE( HCoverage );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   363
    OTV_OPTIONAL_TABLE( Offset );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   364
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
    OTV_NAME_ENTER( "MathVariants" );
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
    OTV_LIMIT_CHECK( 10 );
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
    p += 2;                       /* Skip the MinConnectorOverlap constant */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   371
    OTV_OPTIONAL_OFFSET( VCoverage );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   372
    OTV_OPTIONAL_OFFSET( HCoverage );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   373
    vcnt = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   374
    hcnt = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   375
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   376
    OTV_LIMIT_CHECK( 2 * vcnt + 2 * hcnt );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   377
    table_size = 10 + 2 * vcnt + 2 * hcnt;
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_SIZE_CHECK( VCoverage );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   380
    if ( VCoverage )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   381
      otv_Coverage_validate( table + VCoverage, valid, vcnt );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   382
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   383
    OTV_SIZE_CHECK( HCoverage );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   384
    if ( HCoverage )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   385
      otv_Coverage_validate( table + HCoverage, valid, hcnt );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   386
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   387
    for ( i = 0; i < vcnt; ++i )
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_OPTIONAL_OFFSET( Offset );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   390
      OTV_SIZE_CHECK( Offset );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   391
      otv_MathGlyphConstruction_validate( table + Offset, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   392
    }
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
    for ( i = 0; i < hcnt; ++i )
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
      OTV_OPTIONAL_OFFSET( Offset );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   397
      OTV_SIZE_CHECK( Offset );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   398
      otv_MathGlyphConstruction_validate( table + Offset, valid );
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   401
    OTV_EXIT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   402
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   403
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
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   406
  /*************************************************************************/
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
  /*****                          MATH TABLE                           *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   409
  /*****                                                               *****/
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
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   412
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   413
  /* sets valid->glyph_count */
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
  FT_LOCAL_DEF( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   416
  otv_MATH_validate( FT_Bytes      table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   417
                     FT_UInt       glyph_count,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   418
                     FT_Validator  ftvalid )
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
    OTV_ValidatorRec  validrec;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   421
    OTV_Validator     valid = &validrec;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   422
    FT_Bytes          p     = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   423
    FT_UInt           MathConstants, MathGlyphInfo, MathVariants;
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
    valid->root = ftvalid;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   427
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   428
    FT_TRACE3(( "validating MATH table\n" ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   429
    OTV_INIT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   430
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   431
    OTV_LIMIT_CHECK( 10 );
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
    if ( FT_NEXT_ULONG( p ) != 0x10000UL )      /* Version */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   434
      FT_INVALID_FORMAT;
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
    MathConstants = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   437
    MathGlyphInfo = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   438
    MathVariants  = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   439
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   440
    valid->glyph_count = glyph_count;
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_MathConstants_validate( table + MathConstants,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   443
                                valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   444
    otv_MathGlyphInfo_validate( table + MathGlyphInfo,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   445
                                valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   446
    otv_MathVariants_validate ( table + MathVariants,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   447
                                valid );
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
    FT_TRACE4(( "\n" ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   450
  }
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   453
/* END */