shithub: freetype+ttf2subf

Download patch

ref: ec39a8a3914a19a39742778a397c967dbb0ba0d0
parent: 17439423f8a62e508647d5427c8171c0b229a081
author: Werner Lemberg <[email protected]>
date: Thu Aug 12 08:22:28 EDT 2004

Make otlayout module compile (without actually working).

* src/otlayout/*: s/OTL_Valid/OTL_Validator/.
s/NULL/0/.

* src/otlayout/otlayout.h: Fix various typos.
(OTL_Bool): New typedef.
(OTL_Int, OTL_Long, OTL_Int16, OTL_Int32): Use `signed' keyword.
(OTL_Err_InvalidArgument): Removed.
(OTL_Err_InvalidData, OTL_Err_InvalidSize): New enum values.
(OTL_MAKE_TAG): Add missing parenthesis.
(OTL_INVALID_DATA): Use OTL_Err_InvalidData.
(OTL_INVALID_TOO_SHORT): Use OTL_Err_InvalidSize.
(OTL_INVALID_FORMAT, OTL_INVALID_OFFSET): New macros.

* src/otlayout/otlgpos.c: s/FT_/OTL_/.
s/OTL_Short/OTL_Int16/.
(otl_gpos_pairset_validate): Add return type.
(otl_base_array_validate): Fix call to otl_anchor_validate.
(otl_liga_array_validate): Fix call to otl_liga_attach_validate.
(otl_gpos_lookup5_validate): Fix typos.
(otl_gpos_lookup6_validate): Fix call to otl_mark2_array_validate.
(otl_gpos_lookup7_validate): Comment out unfinished code.
Fix typos.

* src/otlayout/otlgsub.c: Add forward declaration for
otl_gsub_validate_funcs.
(otl_gsub_lookup1_apply, otl_gsub_lookup2_apply,
otl_gsub_lookup3_apply): Fix call to otl_parser_check_property.
s/otl_coverage_lookup/otl_coverage_get_index/.
(otl_ligature_validate): Add missing variable declaration.
(otl_sub_rule_validate): Fix typo.
(otl_sub_class_rule_validate): Add missing variable declaration.
Fix typo.
(otl_gsub_lookup5_validate): Fix typo.
(otl_gsub_lookup6_validate): Fix call to
otl_chain_sub_class_set_validate.
(otl_gsub_validate_funcs): Don't use `const'.

* src/otlayout/otlcommn.c (otl_class_definition_get_value,
otl_device_table_validate, otl_device_table_get_delta,
otl_lookup_validate, otl_script_validate): Add missing
variable declarations.
(otl_lookup_list_validate): Comment out first definition.
(otl_lookup_list_foreach, otl_feature_list_foreach): Comment out.
(otl_feature_list_validate):
s/otl_feature_table_validate/otl_feature_validate/.
(otl_script_list_validate):
s/otl_script_table_validate/otl_script_validate/.

* src/otlayout/otlcommn.h: Comment out first declaration.
(otl_lookup_list_foreach, otl_feature_list_foreach): Comment out.

* src/otlayout/otlbase.c (otl_base_coord_validate): Fix call to
otl_device_table_validate.
(otl_base_scsript_validate): Add missing variable declarations.
(otl_base_script_list_validate): Fix call to
otl_base_script_validate.
(otl_axis_table_validate): Fix calls to otl_base_tag_list_validate
and otl_base_script_list_validate.
(otl_base_validate): Fix calls to otl_axis_table_validate.

* src/otlayout/otlgdef.c (otl_attach_list_validate): Fix call to
otl_attach_point_validate.
(otl_caret_value_validate): Add missing variable declaration.
Fix call to otl_device_table_validate.
(otl_ligature_glyph_validate): Fix call to otl_caret_value_validate.
(otl_ligature_caret_list_validate): Fix call to
otl_ligature_glyph_validate.
(otl_gdef_validate): Fix calls to otl_class_definition_validate,
otl_attach_list_validate, otl_ligature_caret_list_validate, and
otl_class_definition_validate.

* src/otlayout/otltable.h (otl_table_validate, otl_table_init,
otl_table_set_script): Comment out.

* src/otlayout/otlparse.h (OTL_ParserRec):
s/OTL_Alternate/OTL_GSUB_Alternate/.
(OTL_ParseError): Add OTL_Err_Parser_Memory and
OTL_Err_Parser_Internal.
(otl_parser_error): Fix typo.
(otl_parser_check_property): Remove third argument.

* src/otlayout/otlparse.c (otl_string_ensure):
s/OTL_Parse_Err_Memory/OTL_Err_Parser_Memory/.
(OTL_STRING_ENSURE, otl_parser_error, otl_parser_get_index,
otl_parser_replace_1, otl_parser_replace_n): Fix typos.
(OTL_PARSER_UNCOVERED): Removed.
(otl_parser_check_property): Remove third argument.

* src/otlayout/otljstf.c (otl_jstf_priority_validate): Add missing
variable declaration.

* src/otlayout/otlutils.h (OTL_MEM_REALLOC): Fix typo.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,100 @@
+2004-08-12  Werner Lemberg  <[email protected]>
+
+	Make otlayout module compile (without actually working).
+
+	* src/otlayout/*: s/OTL_Valid/OTL_Validator/.
+	s/NULL/0/.
+
+	* src/otlayout/otlayout.h: Fix various typos.
+	(OTL_Bool): New typedef.
+	(OTL_Int, OTL_Long, OTL_Int16, OTL_Int32): Use `signed' keyword.
+	(OTL_Err_InvalidArgument): Removed.
+	(OTL_Err_InvalidData, OTL_Err_InvalidSize): New enum values.
+	(OTL_MAKE_TAG): Add missing parenthesis.
+	(OTL_INVALID_DATA): Use OTL_Err_InvalidData.
+	(OTL_INVALID_TOO_SHORT): Use OTL_Err_InvalidSize.
+	(OTL_INVALID_FORMAT, OTL_INVALID_OFFSET): New macros.
+
+	* src/otlayout/otlgpos.c: s/FT_/OTL_/.
+	s/OTL_Short/OTL_Int16/.
+	(otl_gpos_pairset_validate): Add return type.
+	(otl_base_array_validate): Fix call to otl_anchor_validate.
+	(otl_liga_array_validate): Fix call to otl_liga_attach_validate.
+	(otl_gpos_lookup5_validate): Fix typos.
+	(otl_gpos_lookup6_validate): Fix call to otl_mark2_array_validate.
+	(otl_gpos_lookup7_validate): Comment out unfinished code.
+	Fix typos.
+
+	* src/otlayout/otlgsub.c: Add forward declaration for
+	otl_gsub_validate_funcs.
+	(otl_gsub_lookup1_apply, otl_gsub_lookup2_apply,
+	otl_gsub_lookup3_apply): Fix call to otl_parser_check_property. 
+	s/otl_coverage_lookup/otl_coverage_get_index/.
+	(otl_ligature_validate): Add missing variable declaration.
+	(otl_sub_rule_validate): Fix typo.
+	(otl_sub_class_rule_validate): Add missing variable declaration.
+	Fix typo.
+	(otl_gsub_lookup5_validate): Fix typo.
+	(otl_gsub_lookup6_validate): Fix call to
+	otl_chain_sub_class_set_validate.
+	(otl_gsub_validate_funcs): Don't use `const'.
+
+	* src/otlayout/otlcommn.c (otl_class_definition_get_value,
+	otl_device_table_validate, otl_device_table_get_delta,
+	otl_lookup_validate, otl_script_validate): Add missing
+	variable declarations.
+	(otl_lookup_list_validate): Comment out first definition.
+	(otl_lookup_list_foreach, otl_feature_list_foreach): Comment out.
+	(otl_feature_list_validate):
+	s/otl_feature_table_validate/otl_feature_validate/.
+	(otl_script_list_validate):
+	s/otl_script_table_validate/otl_script_validate/.
+
+	* src/otlayout/otlcommn.h: Comment out first declaration.
+	(otl_lookup_list_foreach, otl_feature_list_foreach): Comment out.
+
+	* src/otlayout/otlbase.c (otl_base_coord_validate): Fix call to
+	otl_device_table_validate.
+	(otl_base_scsript_validate): Add missing variable declarations.
+	(otl_base_script_list_validate): Fix call to
+	otl_base_script_validate.
+	(otl_axis_table_validate): Fix calls to otl_base_tag_list_validate
+	and otl_base_script_list_validate.
+	(otl_base_validate): Fix calls to otl_axis_table_validate.
+
+	* src/otlayout/otlgdef.c (otl_attach_list_validate): Fix call to
+	otl_attach_point_validate.
+	(otl_caret_value_validate): Add missing variable declaration.
+	Fix call to otl_device_table_validate.
+	(otl_ligature_glyph_validate): Fix call to otl_caret_value_validate.
+	(otl_ligature_caret_list_validate): Fix call to
+	otl_ligature_glyph_validate.
+	(otl_gdef_validate): Fix calls to otl_class_definition_validate,
+	otl_attach_list_validate, otl_ligature_caret_list_validate, and
+	otl_class_definition_validate.
+
+	* src/otlayout/otltable.h (otl_table_validate, otl_table_init,
+	otl_table_set_script): Comment out.
+
+	* src/otlayout/otlparse.h (OTL_ParserRec):
+	s/OTL_Alternate/OTL_GSUB_Alternate/.
+	(OTL_ParseError): Add OTL_Err_Parser_Memory and
+	OTL_Err_Parser_Internal.
+	(otl_parser_error): Fix typo.
+	(otl_parser_check_property): Remove third argument.
+
+	* src/otlayout/otlparse.c (otl_string_ensure):
+	s/OTL_Parse_Err_Memory/OTL_Err_Parser_Memory/.
+	(OTL_STRING_ENSURE, otl_parser_error, otl_parser_get_index,
+	otl_parser_replace_1, otl_parser_replace_n): Fix typos.
+	(OTL_PARSER_UNCOVERED): Removed.
+	(otl_parser_check_property): Remove third argument.
+
+	* src/otlayout/otljstf.c (otl_jstf_priority_validate): Add missing
+	variable declaration.
+
+	* src/otlayout/otlutils.h (OTL_MEM_REALLOC): Fix typo.
+
 2004-08-11  Danny  <[email protected]>
 
 	* src/base/ftstream.c (FT_Stream_Close): Don't reset stream->close
--- a/src/cff/cfftoken.h
+++ b/src/cff/cfftoken.h
@@ -49,7 +49,7 @@
   CFF_FIELD_STRING  ( 0x116, base_font_name )
   CFF_FIELD_DELTA   ( 0x117, base_font_blend, 16 )
   CFF_FIELD_CALLBACK( 0x118, multiple_master )
-  CFF_FIELD_CALLBACK( 0x119, blend_axit_types )
+  CFF_FIELD_CALLBACK( 0x119, blend_axis_types )
 #endif
 
   CFF_FIELD_CALLBACK( 0x11E, cid_ros )
--- a/src/otlayout/otlayout.h
+++ b/src/otlayout/otlayout.h
@@ -6,6 +6,7 @@
 
 OTL_BEGIN_HEADER
 
+
  /************************************************************************/
  /************************************************************************/
  /*****                                                              *****/
@@ -21,24 +22,26 @@
 
   typedef void*             OTL_Pointer;
 
-  typedef int               OTL_Int;
+  typedef unsigned char     OTL_Bool;
+
+  typedef signed int        OTL_Int;
   typedef unsigned int      OTL_UInt;
 
-  typedef long              OTL_Long;
+  typedef signed long       OTL_Long;
   typedef unsigned long     OTL_ULong;
 
-  typedef short             OTL_Int16;
+  typedef signed short      OTL_Int16;
   typedef unsigned short    OTL_UInt16;
 
 
 #if OTL_SIZEOF_INT == 4
 
-  typedef int               OTL_Int32;
+  typedef signed int        OTL_Int32;
   typedef unsigned int      OTL_UInt32;
 
 #elif OTL_SIZEOF_LONG == 4
 
-  typedef long              OTL_Int32;
+  typedef signed long       OTL_Int32;
   typedef unsigned long     OTL_UInt32;
 
 #else
@@ -47,6 +50,7 @@
 
   typedef OTL_UInt32        OTL_Tag;
 
+
  /************************************************************************/
  /************************************************************************/
  /*****                                                              *****/
@@ -55,16 +59,17 @@
  /************************************************************************/
  /************************************************************************/
 
-  typedef enum
+  enum
   {
     OTL_Err_Ok = 0,
-    OTL_Err_InvalidArgument,
     OTL_Err_InvalidFormat,
+    OTL_Err_InvalidSize,
+    OTL_Err_InvalidData,
     OTL_Err_InvalidOffset,
 
     OTL_Err_Max
 
-  } OTL_Error;
+  };
 
 
  /************************************************************************/
@@ -94,6 +99,7 @@
 
   } OTL_MemoryRec, *OTL_Memory;
 
+
  /************************************************************************/
  /************************************************************************/
  /*****                                                              *****/
@@ -107,9 +113,9 @@
 #ifndef  OTL_MAKE_TAG
 #define  OTL_MAKE_TAG(c1,c2,c3,c4)         \
            ( ( (OTL_UInt32)(c1) << 24 ) |  \
-               (OTL_UInt32)(c2) << 16 ) |  \
-               (OTL_UInt32)(c3) <<  8 ) |  \
-               (OTL_UInt32)(c4)         )
+             ( (OTL_UInt32)(c2) << 16 ) |  \
+             ( (OTL_UInt32)(c3) <<  8 ) |  \
+             ( (OTL_UInt32)(c4)       ) )
 #endif
 
   typedef enum OTL_ScriptTag_
@@ -162,6 +168,7 @@
 #define  OTL_NEXT_SHORT(p)   ((OTL_Int16)OTL_NEXT_USHORT(p))
 #define  OTL_NEXT_LONG(p)    ((OTL_Int32)OTL_NEXT_ULONG(p))
 
+
  /************************************************************************/
  /************************************************************************/
  /*****                                                              *****/
@@ -181,8 +188,8 @@
 
   } OTL_ValidatorRec;
 
-  typedef void  (*OTL_ValidateFunc)( OTL_Bytes  table,
-                                     OTL_Valid  valid );
+  typedef void  (*OTL_ValidateFunc)( OTL_Bytes      table,
+                                     OTL_Validator  valid );
 
   OTL_API( void )
   otl_validator_error( OTL_Validator  validator,
@@ -190,8 +197,10 @@
 
 #define  OTL_INVALID(e)  otl_validator_error( valid, e )
 
-#define  OTL_INVALID_TOO_SHORT  OTL_INVALID( OTL_Err_InvalidOffset )
-#define  OTL_INVALID_DATA       OTL_INVALID( OTL_Err_InvalidFormat )
+#define  OTL_INVALID_TOO_SHORT  OTL_INVALID( OTL_Err_InvalidSize )
+#define  OTL_INVALID_OFFSET     OTL_INVALID( OTL_Err_InvalidOffset )
+#define  OTL_INVALID_DATA       OTL_INVALID( OTL_Err_InvalidData )
+#define  OTL_INVALID_FORMAT     OTL_INVALID( OTL_Err_InvalidFormat )
 
 #define  OTL_CHECK(_count)   OTL_BEGIN_STMNT                       \
                                if ( p + (_count) > valid->limit )  \
@@ -202,4 +211,4 @@
 
 OTL_END_HEADER
 
-#endif /* __OPENTYPE_LAYOUT_H__ */
+#endif /* __OT_LAYOUT_H__ */
--- a/src/otlayout/otlbase.c
+++ b/src/otlayout/otlbase.c
@@ -24,7 +24,7 @@
 
       case 3:
         OTL_CHECK( 2 );
-        otl_device_table_validate( table + OTL_PEEK_USHORT( p ) );
+        otl_device_table_validate( table + OTL_PEEK_USHORT( p ), valid );
         break;
 
       default:
@@ -106,7 +106,7 @@
                             OTL_Validator  valid )
   {
     OTL_Bytes  p = table;
-    OTL_UInt   values, default_minmax;
+    OTL_UInt   values, default_minmax, count;
 
     OTL_CHECK(6);
 
@@ -144,7 +144,7 @@
     for ( ; count > 0; count-- )
     {
       p += 4;  /* ignore script tag */
-      otl_base_script_validate( table + OTL_NEXT_USHORT( p ) );
+      otl_base_script_validate( table + OTL_NEXT_USHORT( p ), valid );
     }
   }
 
@@ -159,9 +159,9 @@
 
     tags = OTL_NEXT_USHORT( p );
     if ( tags )
-      otl_base_tag_list_validate   ( table + tags );
+      otl_base_tag_list_validate( table + tags, valid );
 
-    otl_base_script_list_validate( table + OTL_NEXT_USHORT( p ) );
+    otl_base_script_list_validate( table + OTL_NEXT_USHORT( p ), valid );
   }
 
 
@@ -176,6 +176,6 @@
     if ( OTL_NEXT_ULONG( p ) != 0x10000UL )
       OTL_INVALID_DATA;
 
-    otl_axis_table_validate( table + OTL_NEXT_USHORT( p ) );
-    otl_axis_table_validate( table + OTL_NEXT_USHORT( p ) );
-  }
\ No newline at end of file
+    otl_axis_table_validate( table + OTL_NEXT_USHORT( p ), valid );
+    otl_axis_table_validate( table + OTL_NEXT_USHORT( p ), valid );
+  }
--- a/src/otlayout/otlcommn.c
+++ b/src/otlayout/otlcommn.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    OpenType layout support, common tables (body).                       */
 /*                                                                         */
-/*  Copyright 2002 by                                                      */
+/*  Copyright 2002, 2004 by                                                */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -286,7 +286,7 @@
     case 2:
       {
         OTL_UInt  count = OTL_NEXT_USHORT( p );
-        OTL_UInt  min = 0, max = count, mid, gindex;
+        OTL_UInt  min = 0, max = count, mid, gindex, start, end;
 
 
         table += 4;
@@ -328,7 +328,7 @@
                              OTL_Validator  valid )
   {
     OTL_Bytes  p = table;
-    OTL_UInt   start, end, count, format, count;
+    OTL_UInt   start, end, count, format;
 
 
     if ( p + 8 > valid->limit )
@@ -374,7 +374,7 @@
   {
     OTL_Bytes  p = table;
     OTL_Int    result = 0;
-    OTL_UInt   start, end, format, idx, value;
+    OTL_UInt   start, end, format, idx, value, shift;
 
 
     start  = OTL_NEXT_USHORT( p );
@@ -393,7 +393,7 @@
         p     += idx / 16;
         value  = OTL_PEEK_USHORT( p );
         shift  = idx & 15;
-        result = (OTL_Short)( value << shift ) >> ( 14 - shift );
+        result = (OTL_Int16)( value << shift ) >> ( 14 - shift );
 
         break;
 
@@ -402,7 +402,7 @@
         p     += idx / 16;
         value  = OTL_PEEK_USHORT( p );
         shift  = idx & 15;
-        result = (OTL_Short)( value << shift ) >> ( 12 - shift );
+        result = (OTL_Int16)( value << shift ) >> ( 12 - shift );
 
         break;
 
@@ -411,7 +411,7 @@
         p     += idx / 16;
         value  = OTL_PEEK_USHORT( p );
         shift  = idx & 15;
-        result = (OTL_Short)( value << shift ) >> ( 8 - shift );
+        result = (OTL_Int16)( value << shift ) >> ( 8 - shift );
 
         break;
 
@@ -451,7 +451,7 @@
 
     for ( ; num_tables > 0; num_tables-- )
     {
-      offset = OTL_NEXT_USHORT( p );
+      OTL_UInt offset = OTL_NEXT_USHORT( p );
 
       if ( table + offset >= valid->limit )
         OTL_INVALID_OFFSET;
@@ -475,7 +475,7 @@
   otl_lookup_get_table( OTL_Bytes  table,
                         OTL_UInt   idx )
   {
-    OTL_Bytes  p, result = NULL;
+    OTL_Bytes  p, result = 0;
     OTL_UInt   count;
 
 
@@ -499,6 +499,7 @@
   /*************************************************************************/
   /*************************************************************************/
 
+#if 0
   OTL_LOCALDEF( void )
   otl_lookup_list_validate( OTL_Bytes      table,
                             OTL_Validator  valid )
@@ -522,6 +523,7 @@
       otl_lookup_validate( table + offset, valid );
     }
   }
+#endif
 
 
   OTL_LOCALDEF( OTL_UInt )
@@ -559,7 +561,7 @@
                              OTL_UInt   lookup_index,
                              OTL_UInt   table_index )
   {
-    OTL_Bytes  result = NULL;
+    OTL_Bytes  result = 0;
 
 
     result = otl_lookup_list_get_lookup( table, lookup_index );
@@ -570,6 +572,7 @@
   }
 
 
+#if 0
   OTL_LOCALDEF( void )
   otl_lookup_list_foreach( OTL_Bytes        table,
                            OTL_ForeachFunc  func,
@@ -582,6 +585,7 @@
     for ( ; count > 0; count-- )
       func( table + OTL_NEXT_USHORT( p ), func_data );
   }
+#endif
 
 
   /*************************************************************************/
@@ -678,7 +682,7 @@
       p     += 4;                       /* skip tag */
       offset = OTL_NEXT_USHORT( p );
 
-      otl_feature_table_validate( table + offset, valid );
+      otl_feature_validate( table + offset, valid );
     }
   }
 
@@ -697,7 +701,7 @@
   otl_feature_list_get_feature( OTL_Bytes  table,
                                 OTL_UInt   idx )
   {
-    OTL_Bytes  p, result = NULL;
+    OTL_Bytes  p, result = 0;
     OTL_UInt   count;
 
 
@@ -714,6 +718,7 @@
   }
 
 
+#if 0
   OTL_LOCALDEF( void )
   otl_feature_list_foreach( OTL_Bytes        table,
                             OTL_ForeachFunc  func,
@@ -729,6 +734,7 @@
     for ( ; count > 0; count-- )
       func( table + OTL_NEXT_USHORT( p ), func_data );
   }
+#endif
 
 
   /*************************************************************************/
@@ -824,7 +830,7 @@
   otl_script_validate( OTL_Bytes      table,
                        OTL_Validator  valid )
   {
-    OTL_UInt   default_lang;
+    OTL_UInt   default_lang, num_langs;
     OTL_Bytes  p = table;
 
 
@@ -880,7 +886,7 @@
       p     += 4;                       /* skip tag */
       offset = OTL_NEXT_USHORT( p );
 
-      otl_script_table_validate( list + offset, valid );
+      otl_script_validate( list + offset, valid );
     }
   }
 
--- a/src/otlayout/otlcommn.h
+++ b/src/otlayout/otlcommn.h
@@ -126,10 +126,12 @@
   /*************************************************************************/
   /*************************************************************************/
 
+#if 0
   /* validate lookup list */
   OTL_LOCALDEF( void )
   otl_lookup_list_validate( OTL_Bytes      table,
                             OTL_Validator  valid );
+#endif
 
   /* return number of lookups in list */
   OTL_LOCALDEF( OTL_UInt )
@@ -146,11 +148,13 @@
                              OTL_UInt   lookup_index,
                              OTL_UInt   table_index );
 
+#if 0
   /* iterate over lookup list */
   OTL_LOCALDEF( void )
   otl_lookup_list_foreach( OTL_Bytes        table,
                            OTL_ForeachFunc  func,
                            OTL_Pointer      func_data );
+#endif
 
 
   /*************************************************************************/
@@ -202,11 +206,13 @@
   otl_feature_list_get_feature( OTL_Bytes  table,
                                 OTL_UInt   idx );
 
+#if 0
   /* iterate over all features in a list */
   OTL_LOCALDEF( void )
   otl_feature_list_foreach( OTL_Bytes        table,
                             OTL_ForeachFunc  func,
                             OTL_Pointer      func_data );
+#endif
 
 
   /*************************************************************************/
--- a/src/otlayout/otlgdef.c
+++ b/src/otlayout/otlgdef.c
@@ -47,7 +47,7 @@
       OTL_INVALID_TOO_SHORT;
 
     for ( ; count > 0; count-- )
-      otl_attach_point_validate( table + OTL_NEXT_USHORT( p ) );
+      otl_attach_point_validate( table + OTL_NEXT_USHORT( p ), valid );
   }
 
 
@@ -64,6 +64,7 @@
                             OTL_Validator  valid )
   {
     OTL_Bytes  p = table;
+    OTL_Int   format;
 
     if ( p + 4 > valid->limit )
       OTL_INVALID_TOO_SHORT;
@@ -83,7 +84,7 @@
           if ( p + 2 > valid->limit )
             OTL_INVALID_TOO_SHORT;
 
-          otl_device_table_validate( table + OTL_PEEK_USHORT( p ) );
+          otl_device_table_validate( table + OTL_PEEK_USHORT( p ), valid );
         }
         break;
 
@@ -109,7 +110,7 @@
       OTL_INVALID_TOO_SHORT;
 
     for ( ; count > 0; count-- )
-      otl_caret_value_validate( table + OTL_NEXT_USHORT( p ) );
+      otl_caret_value_validate( table + OTL_NEXT_USHORT( p ), valid );
   }
 
 
@@ -135,7 +136,7 @@
       OTL_INVALID_TOO_SHORT;
 
     for ( ; count > 0; count-- )
-      otl_ligature_glyph_validate( table + OTL_NEXT_USHORT( p ) );
+      otl_ligature_glyph_validate( table + OTL_NEXT_USHORT( p ), valid );
   }
 
 
@@ -161,15 +162,14 @@
       OTL_INVALID_FORMAT;
 
     /* validate class definition table */
-    otl_class_definition_validate( table + OTL_NEXT_USHORT( p ) );
+    otl_class_definition_validate( table + OTL_NEXT_USHORT( p ), valid );
 
     /* validate attachment point list */
-    otl_attach_list_validate( table + OTL_NEXT_USHORT( p ) );
+    otl_attach_list_validate( table + OTL_NEXT_USHORT( p ), valid );
 
     /* validate ligature caret list */
-    otl_ligature_caret_list_validate( table + OTL_NEXT_USHORT( p ) );
+    otl_ligature_caret_list_validate( table + OTL_NEXT_USHORT( p ), valid );
 
     /* validate mark attach class */
-    otl_class_definition_validate( table + OTL_NEXT_USHORT( p ) );
+    otl_class_definition_validate( table + OTL_NEXT_USHORT( p ), valid );
   }
-
--- a/src/otlayout/otlgdef.h
+++ b/src/otlayout/otlgdef.h
@@ -6,8 +6,8 @@
 OTL_BEGIN_HEADER
 
   OTL_API( void )
-  otl_gdef_validate( OTL_Bytes  table,
-                     OTL_Valid  valid );
+  otl_gdef_validate( OTL_Bytes      table,
+                     OTL_Validator  valid );
 
 OTL_END_HEADER
 
--- a/src/otlayout/otlgpos.c
+++ b/src/otlayout/otlgpos.c
@@ -16,7 +16,7 @@
   static OTL_UInt
   otl_value_length( OTL_UInt  format )
   {
-    FT_UInt  count;
+    OTL_UInt  count;
 
     count = (( format & 0xAA ) >> 1) + ( format & 0x55 );
     count = (( count  & 0xCC ) >> 2) + ( count  & 0x33 );
@@ -161,7 +161,7 @@
     {
       case 1:
         {
-          FT_UInt  coverage, value_format;
+          OTL_UInt  coverage, value_format;
 
           OTL_CHECK( 4 );
           coverage     = OTL_NEXT_USHORT( p );
@@ -174,7 +174,7 @@
 
       case 2:
         {
-          FT_UInt  coverage, value_format, count, len;
+          OTL_UInt  coverage, value_format, count, len;
 
           OTL_CHECK( 6 );
           coverage     = OTL_NEXT_USHORT( p );
@@ -207,11 +207,12 @@
  /************************************************************************/
  /************************************************************************/
 
-  static otl_gpos_pairset_validate( OTL_Bytes      table,
-                                    OTL_Bytes      pos_table,
-                                    OTL_UInt       format1,
-                                    OTL_UInt       format2,
-                                    OTL_Validator  valid )
+  static void
+  otl_gpos_pairset_validate( OTL_Bytes      table,
+                             OTL_Bytes      pos_table,
+                             OTL_UInt       format1,
+                             OTL_UInt       format2,
+                             OTL_Validator  valid )
   {
     OTL_Bytes  p = table;
     OTL_UInt   len1, len2, count;
@@ -314,8 +315,8 @@
  /************************************************************************/
 
   static void
-  otl_gpos_lookup3_validate( OTL_Bytes  table,
-                             OTL_Valid  valid )
+  otl_gpos_lookup3_validate( OTL_Bytes      table,
+                             OTL_Validator  valid )
   {
     OTL_Bytes  p = table;
     OTL_UInt   format;
@@ -377,13 +378,13 @@
     OTL_CHECK( count*class_count*2 );
     for ( ; count > 0; count-- )
       for ( count2 = class_count; count2 > 0; count2-- )
-        otl_anchor_validate( table + OTL_NEXT_USHORT( p ) );
+        otl_anchor_validate( table + OTL_NEXT_USHORT( p ), valid );
   }
 
 
   static void
-  otl_gpos_lookup4_validate( OTL_Bytes  table,
-                             OTL_Valid  valid )
+  otl_gpos_lookup4_validate( OTL_Bytes      table,
+                             OTL_Validator  valid )
   {
     OTL_Bytes  p = table;
     OTL_UInt   format;
@@ -456,13 +457,14 @@
 
     OTL_CHECK( count*2 );
     for ( ; count > 0; count-- )
-      otl_liga_attach_validate( table + OTL_NEXT_USHORT( p ), valid );
+      otl_liga_attach_validate( table + OTL_NEXT_USHORT( p ),
+                                class_count, valid );
   }
 
 
   static void
-  otl_gpos_lookup5_validate( OTL_Bytes  table,
-                             OTL_Valid  valid )
+  otl_gpos_lookup5_validate( OTL_Bytes      table,
+                             OTL_Validator  valid )
   {
     OTL_Bytes  p = table;
     OTL_UInt   format;
@@ -473,8 +475,8 @@
     {
       case 1:
         {
-          OTL_UInt  mark_coverage, lig_coverage, class_count;
-          OTL_UInt  mar_array, lig_array;
+          OTL_UInt  mark_coverage, liga_coverage, class_count;
+          OTL_UInt  mark_array, liga_array;
 
           OTL_CHECK( 10 );
           mark_coverage = OTL_NEXT_USHORT( p );
@@ -524,8 +526,8 @@
 
 
   static void
-  otl_gpos_lookup6_validate( OTL_Bytes  table,
-                             OTL_Valid  valid )
+  otl_gpos_lookup6_validate( OTL_Bytes      table,
+                             OTL_Validator  valid )
   {
     OTL_Bytes  p = table;
     OTL_UInt   format;
@@ -549,7 +551,7 @@
           otl_coverage_validate( table + coverage2, valid );
 
           otl_mark_array_validate( table + array1, valid );
-          otl_mark2_array_validate( table + array2, valid );
+          otl_mark2_array_validate( table + array2, class_count, valid );
         }
         break;
 
@@ -680,8 +682,10 @@
           otl_class_definition_validate( table + class_def, valid );
 
           OTL_CHECK( count*2 );
+#if 0 /* XXX */
           for ( ; count > 0; count-- )
             otl_
+#endif
         }
         break;
 
@@ -694,7 +698,7 @@
           pos_count   = OTL_NEXT_USHORT( p );
 
           OTL_CHECK( glyph_count*2 + pos_count*4 );
-          for ( ; glyph_count > 0; glyph_count )
+          for ( ; glyph_count > 0; glyph_count-- )
             otl_coverage_validate( table + OTL_NEXT_USHORT( p ), valid );
 
           /* XXX: check pos lookups */
@@ -900,8 +904,8 @@
  /************************************************************************/
 
   static void
-  otl_gpos_lookup9_validate( OTL_Bytes  table,
-                             OTL_Valid  valid )
+  otl_gpos_lookup9_validate( OTL_Bytes      table,
+                             OTL_Validator  valid )
   {
     OTL_Bytes  p = table;
     OTL_UInt   format;
@@ -977,4 +981,3 @@
     otl_lookup_list_validate( table + lookups, 9, otl_gpos_validate_funcs,
                               valid );
   }
-  
\ No newline at end of file
--- a/src/otlayout/otlgsub.c
+++ b/src/otlayout/otlgsub.c
@@ -1,6 +1,11 @@
 #include "otlgsub.h"
 #include "otlcommn.h"
+#include "otlparse.h"
 
+ /* forward declaration */
+  static OTL_ValidateFunc  otl_gsub_validate_funcs[];
+
+
  /************************************************************************/
  /************************************************************************/
  /*****                                                              *****/
@@ -92,12 +97,13 @@
 
     gindex = otl_parser_get_gindex( parser );
 
-    if ( !otl_parser_check_property( parser, gindex, &property ) )
+    otl_parser_check_property( parser, gindex, &property );
+    if ( parser->error )
       goto Exit;
 
     format   = OTL_NEXT_USHORT(p);
     coverage = table + OTL_NEXT_USHORT(p);
-    index    = otl_coverage_lookup( coverage, gindex );
+    index    = otl_coverage_get_index( coverage, gindex );
 
     if ( index >= 0 )
     {
@@ -219,22 +225,22 @@
   {
     OTL_Bytes  p = table;
     OTL_Bytes  coverage, sequence;
-    OTL_UInt   format, gindex, index, property;
-    OTL_Int    index;
+    OTL_UInt   format, gindex, index, property, context_len, seq_count, count;
     OTL_Bool   subst = 0;
 
-    if ( context_len != 0xFFFFU && context_len < 1 )
+    if ( parser->context_len != 0xFFFFU && parser->context_len < 1 )
       goto Exit;
 
     gindex = otl_parser_get_gindex( parser );
 
-    if ( !otl_parser_check_property( parser, gindex, &property ) )
+    otl_parser_check_property( parser, gindex, &property );
+    if ( parser->error )
       goto Exit;
 
     p        += 2;  /* skip format */
     coverage  = table + OTL_NEXT_USHORT(p);
     seq_count = OTL_NEXT_USHORT(p);
-    index     = otl_coverage_lookup( coverage, gindex );
+    index     = otl_coverage_get_index( coverage, gindex );
 
     if ( (OTL_UInt) index >= seq_count )
       goto Exit;
@@ -335,27 +341,27 @@
   {
     OTL_Bytes  p = table;
     OTL_Bytes  coverage, alternates;
-    OTL_UInt   format, gindex, index, property;
-    OTL_Int    index;
+    OTL_UInt   format, gindex, index, property, seq_count, count;
     OTL_Bool   subst = 0;
 
     OTL_GSUB_Alternate  alternate = parser->alternate;
 
-    if ( context_len != 0xFFFFU && context_len < 1 )
+    if ( parser->context_len != 0xFFFFU && parser->context_len < 1 )
       goto Exit;
 
-    if ( alternate == NULL )
+    if ( alternate == 0 )
       goto Exit;
 
     gindex = otl_parser_get_gindex( parser );
 
-    if ( !otl_parser_check_property( parser, gindex, &property ) )
+    otl_parser_check_property( parser, gindex, &property );
+    if ( parser->error )
       goto Exit;
 
     p        += 2;  /* skip format */
     coverage  = table + OTL_NEXT_USHORT(p);
     seq_count = OTL_NEXT_USHORT(p);
-    index     = otl_coverage_lookup( coverage, gindex );
+    index     = otl_coverage_get_index( coverage, gindex );
 
     if ( (OTL_UInt) index >= seq_count )
       goto Exit;
@@ -387,7 +393,8 @@
   otl_ligature_validate( OTL_Bytes      table,
                          OTL_Validator  valid )
   {
-    OTL_UInt  glyph_id, count;
+    OTL_Bytes  p = table;
+    OTL_UInt   glyph_id, count;
 
     OTL_CHECK( 4 );
     glyph_id = OTL_NEXT_USHORT( p );
@@ -473,7 +480,7 @@
     if ( glyph_count == 0 )
       OTL_INVALID_DATA;
 
-    OTL_CHECK( (glyph_count-1)*2 + substcount*4 );
+    OTL_CHECK( (glyph_count-1)*2 + subst_count*4 );
 
     /* XXX: check glyph indices and subst lookups */
   }
@@ -499,7 +506,8 @@
   otl_sub_class_rule_validate( OTL_Bytes      table,
                                OTL_Validator  valid )
   {
-    OTL_UInt  glyph_count, subst_count;
+    OTL_Bytes  p = table;
+    OTL_UInt   glyph_count, subst_count;
 
     OTL_CHECK( 4 );
     glyph_count = OTL_NEXT_USHORT( p );
@@ -508,7 +516,7 @@
     if ( glyph_count == 0 )
       OTL_INVALID_DATA;
 
-    OTL_CHECK( (glyph_count-1)*2 + substcount*4 );
+    OTL_CHECK( (glyph_count-1)*2 + subst_count*4 );
 
     /* XXX: check glyph indices and subst lookups */
   }
@@ -571,7 +579,7 @@
 
           OTL_CHECK( 2*count );
           for ( ; count > 0; count-- )
-            otl_sub_class_rule_set_validate( table + coveragen valid );
+            otl_sub_class_rule_set_validate( table + coverage, valid );
         }
         break;
 
@@ -745,7 +753,8 @@
 
           OTL_CHECK( 2*count );
           for ( ; count > 0; count-- )
-            otl_chain_sub_class_set( table + OTL_NEXT_USHORT( p ), valid );
+            otl_chain_sub_class_set_validate( table + OTL_NEXT_USHORT( p ),
+                                              valid );
         }
         break;
 
@@ -782,10 +791,11 @@
     }
   }
 
+
  /************************************************************************/
  /************************************************************************/
  /*****                                                              *****/
- /*****                 GSUB LOOKUP TYPE 6                           *****/
+ /*****                 GSUB LOOKUP TYPE 7                           *****/
  /*****                                                              *****/
  /************************************************************************/
  /************************************************************************/
@@ -824,7 +834,7 @@
   }
 
 
-  static const OTL_ValidateFunc  otl_gsub_validate_funcs[ 7 ] =
+  static OTL_ValidateFunc  otl_gsub_validate_funcs[ 7 ] =
   {
     otl_gsub_lookup1_validate,
     otl_gsub_lookup2_validate,
@@ -833,6 +843,7 @@
     otl_gsub_lookup5_validate,
     otl_gsub_lookup6_validate
   };
+
 
  /************************************************************************/
  /************************************************************************/
--- a/src/otlayout/otljstf.c
+++ b/src/otlayout/otljstf.c
@@ -69,7 +69,7 @@
                               OTL_Validator  valid )
   {
     OTL_Bytes  p = table;
-    OTL_UInt   offset;
+    OTL_UInt   offset, val;
 
     OTL_CHECK( 20 );
 
@@ -186,4 +186,3 @@
       otl_jstf_script_validate( table + OTL_NEXT_USHORT( p ), valid );
     }
   }
-  
\ No newline at end of file
--- a/src/otlayout/otljstf.h
+++ b/src/otlayout/otljstf.h
@@ -11,4 +11,4 @@
 
 OTL_END_HEADER
 
-#endif /* __OTL_JSTF_H__ */
\ No newline at end of file
+#endif /* __OTL_JSTF_H__ */
--- a/src/otlayout/otlparse.c
+++ b/src/otlayout/otlparse.c
@@ -1,6 +1,7 @@
 #include "otlparse.h"
 #include "otlutils.h"
 
+
   static void
   otl_string_ensure( OTL_String  string,
                      OTL_UInt    count,
@@ -18,7 +19,7 @@
         new_count += (new_count >> 1) + 16;
 
       if ( OTL_MEM_RENEW_ARRAY( string->glyphs, old_count, new_count ) )
-        otl_parser_error( parser, OTL_Parse_Err_Memory );
+        otl_parser_error( parser, OTL_Err_Parser_Memory );
 
       string->capacity = new_count;
     }
@@ -26,7 +27,7 @@
 
 #define  OTL_STRING_ENSURE(str,count,parser)                   \
            OTL_BEGIN_STMNT                                     \
-             if ( (str)->length + (count) > (str)>capacity )   \
+             if ( (str)->length + (count) > (str)->capacity )  \
                otl_string_ensure( str, count, parser );        \
            OTL_END_STMNT
 
@@ -36,27 +37,24 @@
   {
     OTL_String  in = parser->str_in;
 
-    if ( in->cursor >= in->num_glyphs )
+    if ( in->cursor >= in->length )
       otl_parser_error( parser, OTL_Err_Parser_Internal );
 
-    return in->str[ in->cursor ].gindex;
+    return in->glyphs[ in->cursor ].gindex;
   }
 
 
   OTL_LOCALDEF( void )
   otl_parser_error( OTL_Parser      parser,
-                    OTL_ParseError  error; )
+                    OTL_ParseError  error )
   {
     parser->error = error;
     otl_longjmp( parser->jump_buffer, 1 );
   }
 
-#define  OTL_PARSER_UNCOVERED(x)  otl_parser_error( x, OTL_Parse_Err_UncoveredGlyph );
-
   OTL_LOCAL( void )
   otl_parser_check_property( OTL_Parser  parser,
                              OTL_UInt    gindex,
-                             OTL_UInt    flags,
                              OTL_UInt   *aproperty );
 
   OTL_LOCALDEF( void )
@@ -68,14 +66,14 @@
     OTL_StringGlyph  glyph, in_glyph;
 
     /* sanity check */
-    if ( in == NULL               ||
-         out == NULL              ||
+    if ( in == 0                  ||
+         out == 0                 ||
          in->length == 0          ||
          in->cursor >= in->length )
     {
       /* report as internal error, since these should */
       /* never happen !!                              */
-      otl_parser_error( parser, OTL_Err_Parse_Internal );
+      otl_parser_error( parser, OTL_Err_Parser_Internal );
     }
 
     OTL_STRING_ENSURE( out, 1, parser );
@@ -83,7 +81,7 @@
     in_glyph = in->glyphs  + in->cursor;
 
     glyph->gindex        = gindex;
-    glyph->property      = in_glyph->property;
+    glyph->properties    = in_glyph->properties;
     glyph->lig_component = in_glyph->lig_component;
     glyph->lig_id        = in_glyph->lig_id;
 
@@ -97,7 +95,7 @@
                         OTL_UInt    count,
                         OTL_Bytes   indices )
   {
-    OTL_UInt         lig_component, lig_id, property;
+    OTL_UInt         lig_component, lig_id, properties;
     OTL_String       in  = parser->str_in;
     OTL_String       out = parser->str_out;
     OTL_StringGlyph  glyph, in_glyph;
@@ -104,14 +102,14 @@
     OTL_Bytes        p = indices;
 
     /* sanity check */
-    if ( in == NULL               ||
-         out == NULL              ||
+    if ( in == 0                  ||
+         out == 0                 ||
          in->length == 0          ||
          in->cursor >= in->length )
     {
       /* report as internal error, since these should */
       /* never happen !!                              */
-      otl_parser_error( parser, OTL_Err_Parse_Internal );
+      otl_parser_error( parser, OTL_Err_Parser_Internal );
     }
 
     OTL_STRING_ENSURE( out, count, parser );
@@ -118,16 +116,16 @@
     glyph    = out->glyphs + out->length;
     in_glyph = in->glyphs  + in->cursor;
 
-    glyph->gindex = gindex;
+    glyph->gindex = in_glyph->gindex;
 
     lig_component = in_glyph->lig_component;
-    lig_id        = in_glyph->lid_id;
-    property      = in_glyph->property;
+    lig_id        = in_glyph->lig_id;
+    properties    = in_glyph->properties;
 
     for ( ; count > 0; count-- )
     {
       glyph->gindex        = OTL_NEXT_USHORT(p);
-      glyph->property      = property;
+      glyph->properties    = properties;
       glyph->lig_component = lig_component;
       glyph->lig_id        = lig_id;
 
@@ -137,6 +135,3 @@
     out->cursor  = out->length;
     in->cursor  += 1;
   }
-
-
-
--- a/src/otlayout/otlparse.h
+++ b/src/otlayout/otlparse.h
@@ -32,24 +32,24 @@
 
   typedef struct OTL_ParserRec_
   {
-    OTL_Bytes      tab_gdef;
-    OTL_Bytes      tab_gsub;
-    OTL_Bytes      tab_gpos;
-    OTL_Bytes      tab_base;
-    OTL_Bytes      tab_jstf;
+    OTL_Bytes           tab_gdef;
+    OTL_Bytes           tab_gsub;
+    OTL_Bytes           tab_gpos;
+    OTL_Bytes           tab_base;
+    OTL_Bytes           tab_jstf;
 
-    OTL_Alternate  alternate;  /* external alternate handler */
+    OTL_GSUB_Alternate  alternate;  /* external alternate handler */
 
-    OTL_UInt       context_len;
-    OTL_UInt       markup_flags;
+    OTL_UInt            context_len;
+    OTL_UInt            markup_flags;
 
-    OTL_jmp_buf    jump_buffer;
-    OTL_Memory     memory;
-    OTL_Error      error;
+    OTL_jmp_buf         jump_buffer;
+    OTL_Memory          memory;
+    OTL_Error           error;
 
-    OTL_StringRec  strings[2];
-    OTL_String     str_in;
-    OTL_String     str_out;
+    OTL_StringRec       strings[2];
+    OTL_String          str_in;
+    OTL_String          str_out;
 
   } OTL_ParserRec;
 
@@ -57,7 +57,9 @@
   {
     OTL_Err_Parser_Ok = 0,
     OTL_Err_Parser_InvalidData,
-    OTL_Err_Parser_UncoveredGlyph
+    OTL_Err_Parser_UncoveredGlyph,
+    OTL_Err_Parser_Memory,
+    OTL_Err_Parser_Internal,
 
   } OTL_ParseError;
 
@@ -66,7 +68,8 @@
 
 
   OTL_LOCAL( void )
-  otl_parser_error( OTL_Parser  parser, OTL_ParserError  error );
+  otl_parser_error( OTL_Parser      parser,
+                    OTL_ParseError  error );
 
 #define  OTL_PARSER_UNCOVERED(x)  \
            otl_parser_error( x, OTL_Err_Parser_UncoveredGlyph )
@@ -74,7 +77,6 @@
   OTL_LOCAL( void )
   otl_parser_check_property( OTL_Parser  parser,
                              OTL_UInt    gindex,
-                             OTL_UInt    flags,
                              OTL_UInt   *aproperty );
 
  /* copy current input glyph to output */
@@ -96,4 +98,3 @@
 OTL_END_HEADER
 
 #endif /* __OTL_PARSER_H__ */
-
--- a/src/otlayout/otltable.h
+++ b/src/otlayout/otltable.h
@@ -38,6 +38,7 @@
   } OTL_TableRec;
 
 
+#if 0
   OTL_API( OTL_Error )
   otl_table_validate( OTL_Bytes      table,
                       OTL_Size       size,
@@ -54,6 +55,7 @@
   otl_table_set_script( OTL_Table      table,
                         OTL_ScriptTag  script,
                         OTL_LangTag    language );
+#endif
 
 OTL_END_HEADER
 
--- a/src/otlayout/otltags.h
+++ b/src/otlayout/otltags.h
@@ -85,4 +85,3 @@
 #endif
 
 #undef OTL_FEATURE_TAG
-
--- a/src/otlayout/otlutils.h
+++ b/src/otlayout/otlutils.h
@@ -22,7 +22,7 @@
 
 #define  OTL_MEM_ALLOC(p,s)       otl_mem_alloc( (void**)&(p), (s), memory )
 #define  OTL_MEM_FREE(p)          otl_mem_free( (void**)&(p), memory )
-#define  OTL_MEM_REALLOC(p,c,n)   otl_mem_realloc( (void**)&(p), (c), (s), memory )
+#define  OTL_MEM_REALLOC(p,c,s)   otl_mem_realloc( (void**)&(p), (c), (s), memory )
 
 #define  OTL_MEM_NEW(p)   OTL_MEM_ALLOC(p,sizeof(*(p)))
 #define  OTL_MEM_NEW_ARRAY(p,c)  OTL_MEM_ALLOC(p,(c)*sizeof(*(p)))