ref: 6756a18578183c9a76d8042dadf309008a1ee618
parent: 3645982ac26c7a99bf77a3af2bf7eb6a3f871334
author: Werner Lemberg <[email protected]>
date: Fri Sep 22 20:36:49 EDT 2017
[otvalid] Handle `BASE' v1.1 table. No validation of variation stuff yet. * src/otvalid/otvbase.c (otv_BASE_validate): Implement it.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2017-09-22 Werner Lemberg <[email protected]>
+ [otvalid] Handle `BASE' v1.1 table.
+
+ No validation of variation stuff yet.
+
+ * src/otvalid/otvbase.c (otv_BASE_validate): Implement it.
+
+2017-09-22 Werner Lemberg <[email protected]>
+
[otvalid] Macros for 32bit offset support.
* src/otvalid/otvcommn.h (OTV_OPTIONAL_TABLE32,
--- a/src/otvalid/otvbase.c
+++ b/src/otvalid/otvbase.c
@@ -284,23 +284,42 @@
OTV_Validator otvalid = &otvalidrec;
FT_Bytes p = table;
FT_UInt table_size;
+ FT_UShort version;
OTV_OPTIONAL_TABLE( HorizAxis );
OTV_OPTIONAL_TABLE( VertAxis );
+ OTV_OPTIONAL_TABLE32( itemVarStore );
+
otvalid->root = ftvalid;
FT_TRACE3(( "validating BASE table\n" ));
OTV_INIT;
- OTV_LIMIT_CHECK( 6 );
+ OTV_LIMIT_CHECK( 4 );
- if ( FT_NEXT_ULONG( p ) != 0x10000UL ) /* Version */
+ if ( FT_NEXT_USHORT( p ) != 1 ) /* majorVersion */
FT_INVALID_FORMAT;
- table_size = 6;
+ version = FT_NEXT_USHORT( p ); /* minorVersion */
+ table_size = 8;
+ switch ( version )
+ {
+ case 0:
+ OTV_LIMIT_CHECK( 4 );
+ break;
+
+ case 1:
+ OTV_LIMIT_CHECK( 8 );
+ table_size += 4;
+ break;
+
+ default:
+ FT_INVALID_FORMAT;
+ }
+
OTV_OPTIONAL_OFFSET( HorizAxis );
OTV_SIZE_CHECK( HorizAxis );
if ( HorizAxis )
@@ -310,6 +329,14 @@
OTV_SIZE_CHECK( VertAxis );
if ( VertAxis )
otv_Axis_validate( table + VertAxis, otvalid );
+
+ if ( version > 0 )
+ {
+ OTV_OPTIONAL_OFFSET32( itemVarStore );
+ OTV_SIZE_CHECK32( itemVarStore );
+ if ( itemVarStore )
+ OTV_TRACE(( " [omitting itemVarStore validation]\n" )); /* XXX */
+ }
FT_TRACE4(( "\n" ));
}