misc/libfreetype/src/gxvalid/gxvmod.c
author nemo
Thu, 16 May 2013 14:02:33 -0400
changeset 9004 901ee9a8a3b4
parent 5172 88f2e05288ba
permissions -rw-r--r--
Yeah, this isn't safe either. Caused bug #629 - removing.
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
/*  gxvmod.c                                                               */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     4
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     5
/*    FreeType's TrueTypeGX/AAT validation module implementation (body).   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     6
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     7
/*  Copyright 2004, 2005, 2006                                             */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     8
/*  by suzuki toshiya, Masatake YAMATO, Red Hat K.K.,                      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     9
/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    10
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    11
/*  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
    12
/*  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
    13
/*  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
    14
/*  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
    15
/*  understand and accept it fully.                                        */
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
/***************************************************************************/
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
/* gxvalid is derived from both gxlayout module and otvalid module.        */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    22
/* Development of gxlayout is supported by the Information-technology      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    23
/* Promotion Agency(IPA), Japan.                                           */
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
#include <ft2build.h>
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    29
#include FT_TRUETYPE_TABLES_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    30
#include FT_TRUETYPE_TAGS_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    31
#include FT_GX_VALIDATE_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    32
#include FT_INTERNAL_OBJECTS_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    33
#include FT_SERVICE_GX_VALIDATE_H
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
#include "gxvmod.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    36
#include "gxvalid.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    37
#include "gxvcommn.h"
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
  /*************************************************************************/
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
  /* 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
    43
  /* 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
    44
  /* messages during execution.                                            */
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
#undef  FT_COMPONENT
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    47
#define FT_COMPONENT  trace_gxvmodule
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
  static FT_Error
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    51
  gxv_load_table( FT_Face             face,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    52
                  FT_Tag              tag,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    53
                  FT_Byte* volatile*  table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    54
                  FT_ULong*           table_len )
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
    FT_Error   error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    57
    FT_Memory  memory = FT_FACE_MEMORY( face );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    58
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    59
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    60
    error = FT_Load_Sfnt_Table( face, tag, 0, NULL, table_len );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    61
    if ( error == GXV_Err_Table_Missing )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    62
      return GXV_Err_Ok;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    63
    if ( error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    64
      goto Exit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    65
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    66
    if ( FT_ALLOC( *table, *table_len ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    67
      goto Exit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    68
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    69
    error = FT_Load_Sfnt_Table( face, tag, 0, *table, table_len );
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
  Exit:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    72
    return error;
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
#define GXV_TABLE_DECL( _sfnt )                     \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    77
          FT_Byte* volatile  _sfnt          = NULL; \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    78
          FT_ULong            len_ ## _sfnt = 0
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    79
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    80
#define GXV_TABLE_LOAD( _sfnt )                                     \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    81
          if ( ( FT_VALIDATE_ ## _sfnt ## _INDEX < table_count ) && \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    82
               ( gx_flags & FT_VALIDATE_ ## _sfnt )            )    \
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
            error = gxv_load_table( face, TTAG_ ## _sfnt,           \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    85
                                    &_sfnt, &len_ ## _sfnt );       \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    86
            if ( error )                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    87
              goto Exit;                                            \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    88
          }
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
#define GXV_TABLE_VALIDATE( _sfnt )                                  \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    91
          if ( _sfnt )                                               \
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
            ft_validator_init( &valid, _sfnt, _sfnt + len_ ## _sfnt, \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    94
                               FT_VALIDATE_DEFAULT );                \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    95
            if ( ft_setjmp( valid.jump_buffer ) == 0 )               \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    96
              gxv_ ## _sfnt ## _validate( _sfnt, face, &valid );     \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    97
            error = valid.error;                                     \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    98
            if ( error )                                             \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    99
              goto Exit;                                             \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   100
          }
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
#define GXV_TABLE_SET( _sfnt )                                        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   103
          if ( FT_VALIDATE_ ## _sfnt ## _INDEX < table_count )        \
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   104
            tables[FT_VALIDATE_ ## _sfnt ## _INDEX] = (FT_Bytes)_sfnt
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   107
  static FT_Error
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   108
  gxv_validate( FT_Face   face,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   109
                FT_UInt   gx_flags,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   110
                FT_Bytes  tables[FT_VALIDATE_GX_LENGTH],
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   111
                FT_UInt   table_count )
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
    FT_Memory volatile        memory = FT_FACE_MEMORY( face );
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
    FT_Error                  error = GXV_Err_Ok;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   116
    FT_ValidatorRec volatile  valid;
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
    FT_UInt  i;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   121
    GXV_TABLE_DECL( feat );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   122
    GXV_TABLE_DECL( bsln );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   123
    GXV_TABLE_DECL( trak );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   124
    GXV_TABLE_DECL( just );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   125
    GXV_TABLE_DECL( mort );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   126
    GXV_TABLE_DECL( morx );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   127
    GXV_TABLE_DECL( kern );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   128
    GXV_TABLE_DECL( opbd );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   129
    GXV_TABLE_DECL( prop );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   130
    GXV_TABLE_DECL( lcar );
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
    for ( i = 0; i < table_count; i++ )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   133
      tables[i] = 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   134
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   135
    /* load tables */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   136
    GXV_TABLE_LOAD( feat );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   137
    GXV_TABLE_LOAD( bsln );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   138
    GXV_TABLE_LOAD( trak );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   139
    GXV_TABLE_LOAD( just );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   140
    GXV_TABLE_LOAD( mort );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   141
    GXV_TABLE_LOAD( morx );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   142
    GXV_TABLE_LOAD( kern );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   143
    GXV_TABLE_LOAD( opbd );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   144
    GXV_TABLE_LOAD( prop );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   145
    GXV_TABLE_LOAD( lcar );
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
    /* validate tables */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   148
    GXV_TABLE_VALIDATE( feat );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   149
    GXV_TABLE_VALIDATE( bsln );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   150
    GXV_TABLE_VALIDATE( trak );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   151
    GXV_TABLE_VALIDATE( just );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   152
    GXV_TABLE_VALIDATE( mort );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   153
    GXV_TABLE_VALIDATE( morx );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   154
    GXV_TABLE_VALIDATE( kern );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   155
    GXV_TABLE_VALIDATE( opbd );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   156
    GXV_TABLE_VALIDATE( prop );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   157
    GXV_TABLE_VALIDATE( lcar );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   158
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   159
    /* Set results */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   160
    GXV_TABLE_SET( feat );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   161
    GXV_TABLE_SET( mort );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   162
    GXV_TABLE_SET( morx );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   163
    GXV_TABLE_SET( bsln );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   164
    GXV_TABLE_SET( just );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   165
    GXV_TABLE_SET( kern );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   166
    GXV_TABLE_SET( opbd );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   167
    GXV_TABLE_SET( trak );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   168
    GXV_TABLE_SET( prop );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   169
    GXV_TABLE_SET( lcar );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   170
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   171
  Exit:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   172
    if ( error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   173
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   174
      FT_FREE( feat );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   175
      FT_FREE( bsln );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   176
      FT_FREE( trak );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   177
      FT_FREE( just );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   178
      FT_FREE( mort );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   179
      FT_FREE( morx );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   180
      FT_FREE( kern );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   181
      FT_FREE( opbd );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   182
      FT_FREE( prop );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   183
      FT_FREE( lcar );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   184
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   185
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   186
    return error;
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
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
  static FT_Error
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   191
  classic_kern_validate( FT_Face    face,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   192
                         FT_UInt    ckern_flags,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   193
                         FT_Bytes*  ckern_table )
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
    FT_Memory volatile        memory = FT_FACE_MEMORY( face );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   196
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   197
    FT_Byte* volatile         ckern     = NULL;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   198
    FT_ULong                  len_ckern = 0;
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
    /* without volatile on `error' GCC 4.1.1. emits:                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   201
    /*  warning: variable 'error' might be clobbered by 'longjmp' or 'vfork' */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   202
    /* this warning seems spurious but ---                                   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   203
    FT_Error volatile         error = GXV_Err_Ok;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   204
    FT_ValidatorRec volatile  valid;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   205
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
    *ckern_table = NULL;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   208
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   209
    error = gxv_load_table( face, TTAG_kern, &ckern, &len_ckern );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   210
    if ( error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   211
      goto Exit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   212
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   213
    if ( ckern )
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
      ft_validator_init( &valid, ckern, ckern + len_ckern,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   216
                         FT_VALIDATE_DEFAULT );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   217
      if ( ft_setjmp( valid.jump_buffer ) == 0 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   218
        gxv_kern_validate_classic( ckern, face,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   219
                                   ckern_flags & FT_VALIDATE_CKERN, &valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   220
      error = valid.error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   221
      if ( error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   222
        goto Exit;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   225
    *ckern_table = ckern;
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
  Exit:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   228
    if ( error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   229
      FT_FREE( ckern );
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
    return error;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   235
  static
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   236
  const FT_Service_GXvalidateRec  gxvalid_interface =
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
    gxv_validate
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   239
  };
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   240
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   241
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   242
  static
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   243
  const FT_Service_CKERNvalidateRec  ckernvalid_interface =
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
    classic_kern_validate
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   246
  };
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   247
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   248
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   249
  static
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   250
  const FT_ServiceDescRec  gxvalid_services[] =
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   251
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   252
    { FT_SERVICE_ID_GX_VALIDATE,          &gxvalid_interface },
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   253
    { FT_SERVICE_ID_CLASSICKERN_VALIDATE, &ckernvalid_interface },
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   254
    { NULL, NULL }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   255
  };
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   256
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   257
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   258
  static FT_Pointer
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   259
  gxvalid_get_service( FT_Module    module,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   260
                       const char*  service_id )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   261
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   262
    FT_UNUSED( module );
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
    return ft_service_list_lookup( gxvalid_services, service_id );
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
  FT_CALLBACK_TABLE_DEF
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   269
  const FT_Module_Class  gxv_module_class =
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
    0,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   272
    sizeof( FT_ModuleRec ),
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   273
    "gxvalid",
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   274
    0x10000L,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   275
    0x20000L,
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
    0,              /* module-specific interface */
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
    (FT_Module_Constructor)0,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   280
    (FT_Module_Destructor) 0,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   281
    (FT_Module_Requester)  gxvalid_get_service
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   285
/* END */