misc/libfreetype/src/gxvalid/gxvprop.c
author nemo
Thu, 04 Apr 2013 08:10:59 -0400
changeset 8848 e9ebd63f8a03
parent 5172 88f2e05288ba
permissions -rw-r--r--
So. Some themes have objects that seem to be large natural extensions of the landscape. Masks allow maintaining that. Lemme know if it doesn't look good. If it doesn't, can still use for ice/bounce/indestructible. Indestructible bunker object for example.
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
/*  gxvprop.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
/*    TrueTypeGX/AAT prop table validation (body).                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     6
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     7
/*  Copyright 2004, 2005 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
     8
/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     9
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    10
/*  This file is part of the FreeType project, and may only be used,       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    11
/*  modified, and distributed under the terms of the FreeType project      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    12
/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    13
/*  this file you indicate that you have read the license and              */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    14
/*  understand and accept it fully.                                        */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    15
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    16
/***************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    17
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    18
/***************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    19
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    20
/* 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
    21
/* 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
    22
/* Promotion Agency(IPA), Japan.                                           */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    23
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    24
/***************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    25
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    26
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    27
#include "gxvalid.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    28
#include "gxvcommn.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    29
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    30
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
  /*                                                                       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    33
  /* 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
    34
  /* 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
    35
  /* messages during execution.                                            */
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
#undef  FT_COMPONENT
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    38
#define FT_COMPONENT  trace_gxvprop
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
  /*************************************************************************/
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
  /*****                      Data and Types                           *****/
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
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    47
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    48
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    49
#define GXV_PROP_HEADER_SIZE  ( 4 + 2 + 2 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    50
#define GXV_PROP_SIZE_MIN     GXV_PROP_HEADER_SIZE
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    51
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    52
  typedef struct  GXV_prop_DataRec_
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    53
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    54
    FT_Fixed  version;
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
  } GXV_prop_DataRec, *GXV_prop_Data;
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
#define GXV_PROP_DATA( field )  GXV_TABLE_DATA( prop, field )
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
#define GXV_PROP_FLOATER                      0x8000U
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    61
#define GXV_PROP_USE_COMPLEMENTARY_BRACKET    0x1000U
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    62
#define GXV_PROP_COMPLEMENTARY_BRACKET_OFFSET 0x0F00U
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    63
#define GXV_PROP_ATTACHING_TO_RIGHT           0x0080U
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    64
#define GXV_PROP_RESERVED                     0x0060U
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    65
#define GXV_PROP_DIRECTIONALITY_CLASS         0x001FU
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    66
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    67
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    68
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    69
  /*************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    70
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    71
  /*****                      UTILITY FUNCTIONS                        *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    72
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    73
  /*************************************************************************/
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
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    77
  gxv_prop_zero_advance_validate( FT_UShort      gid,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    78
                                  GXV_Validator  valid )
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
    FT_Face       face;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    81
    FT_Error      error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    82
    FT_GlyphSlot  glyph;
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
    GXV_NAME_ENTER( "zero advance" );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    86
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    87
    face = valid->face;
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
    error = FT_Load_Glyph( face,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    90
                           gid,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    91
                           FT_LOAD_IGNORE_TRANSFORM );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    92
    if ( error )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    93
      FT_INVALID_GLYPH_ID;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    94
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    95
    glyph = face->glyph;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    96
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    97
    if ( glyph->advance.x != (FT_Pos)0 ||
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    98
         glyph->advance.y != (FT_Pos)0 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    99
      FT_INVALID_DATA;
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
    GXV_EXIT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   102
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   103
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   104
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   105
  /* Pass 0 as GLYPH to check the default property */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   106
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   107
  gxv_prop_property_validate( FT_UShort      property,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   108
                              FT_UShort      glyph,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   109
                              GXV_Validator  valid )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   110
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   111
    if ( glyph != 0 && ( property & GXV_PROP_FLOATER ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   112
      gxv_prop_zero_advance_validate( glyph, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   113
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   114
    if ( property & GXV_PROP_USE_COMPLEMENTARY_BRACKET )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   115
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   116
      FT_UShort  offset;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   117
      char       complement;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   118
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
      offset = (FT_UShort)( property & GXV_PROP_COMPLEMENTARY_BRACKET_OFFSET );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   121
      if ( offset == 0 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   122
        FT_INVALID_DATA;
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
      complement = (char)( offset >> 8 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   125
      if ( complement & 0x08 )
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
        /* Top bit is set: negative */
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
        /* Calculate the absolute offset */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   130
        complement = (char)( ( complement & 0x07 ) + 1 );
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
        /* The gid for complement must be greater than 0 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   133
        if ( glyph <= complement )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   134
          FT_INVALID_DATA;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   135
      }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   136
      else
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
        /* The gid for complement must be the face. */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   139
        gxv_glyphid_validate( (FT_UShort)( glyph + complement ), valid );
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
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   142
    else
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
      if ( property & GXV_PROP_COMPLEMENTARY_BRACKET_OFFSET )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   145
        GXV_TRACE(( "glyph %d cannot have complementary bracketing\n",
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   146
                    glyph ));
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   149
    /* this is introduced in version 2.0 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   150
    if ( property & GXV_PROP_ATTACHING_TO_RIGHT )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   151
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   152
      if ( GXV_PROP_DATA( version ) == 0x00010000UL )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   153
        FT_INVALID_DATA;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   154
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   155
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   156
    if ( property & GXV_PROP_RESERVED )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   157
      FT_INVALID_DATA;
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
    if ( ( property & GXV_PROP_DIRECTIONALITY_CLASS ) > 11 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   160
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   161
      /* TODO: Too restricted. Use the validation level. */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   162
      if ( GXV_PROP_DATA( version ) == 0x00010000UL ||
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   163
           GXV_PROP_DATA( version ) == 0x00020000UL )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   164
        FT_INVALID_DATA;
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
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   167
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   168
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   169
  static void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   170
  gxv_prop_LookupValue_validate( FT_UShort            glyph,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   171
                                 GXV_LookupValueCPtr  value_p,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   172
                                 GXV_Validator        valid )
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
    gxv_prop_property_validate( value_p->u, glyph, valid );
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   178
  /*
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   179
    +===============+ --------+
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   180
    | lookup header |         |
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   181
    +===============+         |
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   182
    | BinSrchHeader |         |
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
    | lastGlyph[0]  |         |
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
    | firstGlyph[0] |         |    head of lookup table
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
    | offset[0]     |    ->   |          offset            [byte]
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
    | lastGlyph[1]  |         | (glyphID - firstGlyph) * 2 [byte]
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
    | firstGlyph[1] |         |
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   193
    +---------------+         |
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   194
    | offset[1]     |         |
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   195
    +===============+         |
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   196
                              |
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   197
     ...                      |
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   198
                              |
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   199
    16bit value array         |
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
    |     value     | <-------+
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
  */
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
  static GXV_LookupValueDesc
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   206
  gxv_prop_LookupFmt4_transit( FT_UShort            relative_gindex,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   207
                               GXV_LookupValueCPtr  base_value_p,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   208
                               FT_Bytes             lookuptbl_limit,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   209
                               GXV_Validator        valid )
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
    FT_Bytes             p;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   212
    FT_Bytes             limit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   213
    FT_UShort            offset;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   214
    GXV_LookupValueDesc  value;
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
    /* XXX: check range? */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   217
    offset = (FT_UShort)( base_value_p->u +
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   218
                          relative_gindex * sizeof( FT_UShort ) );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   219
    p      = valid->lookuptbl_head + offset;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   220
    limit  = lookuptbl_limit;
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
    GXV_LIMIT_CHECK ( 2 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   223
    value.u = FT_NEXT_USHORT( p );
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
    return value;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   228
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   229
  /*************************************************************************/
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
  /*****                                                               *****/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   232
  /*****                         prop TABLE                            *****/
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
  /*************************************************************************/
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
  FT_LOCAL_DEF( void )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   238
  gxv_prop_validate( FT_Bytes      table,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   239
                     FT_Face       face,
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   240
                     FT_Validator  ftvalid )
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
    FT_Bytes          p     = table;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   243
    FT_Bytes          limit = 0;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   244
    GXV_ValidatorRec  validrec;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   245
    GXV_Validator     valid = &validrec;
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
    GXV_prop_DataRec  proprec;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   248
    GXV_prop_Data     prop = &proprec;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   249
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   250
    FT_Fixed          version;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   251
    FT_UShort         format;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   252
    FT_UShort         defaultProp;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   253
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   254
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   255
    valid->root       = ftvalid;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   256
    valid->table_data = prop;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   257
    valid->face       = face;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   258
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   259
    FT_TRACE3(( "validating `prop' table\n" ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   260
    GXV_INIT;
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
    GXV_LIMIT_CHECK( 4 + 2 + 2 );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   263
    version     = FT_NEXT_ULONG( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   264
    format      = FT_NEXT_USHORT( p );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   265
    defaultProp = FT_NEXT_USHORT( p );
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
    /* only versions 1.0, 2.0, 3.0 are defined (1996) */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   268
    if ( version != 0x00010000UL &&
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   269
         version != 0x00020000UL &&
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   270
         version != 0x00030000UL )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   271
      FT_INVALID_FORMAT;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   274
    /* only formats 0x0000, 0x0001 are defined (1996) */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   275
    if ( format > 1 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   276
      FT_INVALID_FORMAT;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   277
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   278
    gxv_prop_property_validate( defaultProp, 0, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   279
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   280
    if ( format == 0 )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   281
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   282
      FT_TRACE3(( "(format 0, no per-glyph properties, "
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   283
                  "remaining %d bytes are skipped)", limit - p ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   284
      goto Exit;
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
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   287
    /* format == 1 */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   288
    GXV_PROP_DATA( version ) = version;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   289
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   290
    valid->lookupval_sign   = GXV_LOOKUPVALUE_UNSIGNED;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   291
    valid->lookupval_func   = gxv_prop_LookupValue_validate;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   292
    valid->lookupfmt4_trans = gxv_prop_LookupFmt4_transit;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   293
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   294
    gxv_LookupTable_validate( p, limit, valid );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   295
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   296
  Exit:
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   297
    FT_TRACE4(( "\n" ));
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   298
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   299
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   300
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
   301
/* END */