Exemplo n.º 1
0
  static void
  otl_gsub_lookup4_validate( OTL_Bytes      table,
                             OTL_Validator  valid )
  {
    OTL_Bytes  p = table;
    OTL_UInt   format, coverage;

    OTL_CHECK( 2 );
    format = OTL_NEXT_USHORT( p );
    switch ( format )
    {
      case 1:
        {
          OTL_UInt  coverage, count;

          OTL_CHECK( 4 );
          coverage = OTL_NEXT_USHORT( p );
          count    = OTL_NEXT_USHORT( p );

          otl_coverage_validate( table + coverage, valid );

          OTL_CHECK( 2*count );
          for ( ; count > 0; count-- )
            otl_ligature_set_validate( table + OTL_NEXT_USHORT( p ), valid );
        }
        break;

      default:
        OTL_INVALID_DATA;
    }
  }
Exemplo n.º 2
0
  static void
  otl_gsub_lookup1_validate( OTL_Bytes      table,
                             OTL_Validator  valid )
  {
    OTL_Bytes  p = table;
    OTL_UInt   format;

    OTL_CHECK( 2 );
    format = OTL_NEXT_USHORT( p );
    switch ( format )
    {
      case 1:
        {
          OTL_UInt  coverage;

          OTL_CHECK( 4 );
          coverage = OTL_NEXT_USHORT( p );

          otl_coverage_validate( table + coverage, valid );
        }
        break;

      case 2:
        {
          OTL_UInt  coverage, count;

          OTL_CHECK( 4 );
          coverage = OTL_NEXT_USHORT( p );
          count    = OTL_NEXT_USHORT( p );

          otl_coverage_validate( table + coverage, valid );

          OTL_CHECK( 2*count );

          /* NB: we don't check that there are at most 'count'   */
          /*     elements in the coverage table. This is delayed */
          /*     to the lookup function...                       */
        }
        break;

      default:
        OTL_INVALID_DATA;
    }
  }
Exemplo n.º 3
0
Arquivo: otlgdef.c Projeto: 8l/inferno
  static void
  otl_attach_list_validate( OTL_Bytes      table,
                            OTL_Validator  valid )
  {
    OTL_Bytes  p = table;
    OTL_Bytes  coverage;
    OTL_UInt   count;

    if ( p + 4 > valid->limit )
      OTL_INVALID_TOO_SHORT;

    coverage = table + OTL_NEXT_USHORT( p );
    count    = OTL_NEXT_USHORT( p );

    otl_coverage_validate( coverage, valid );
    if ( count != otl_coverage_get_count( coverage ) )
      OTL_INVALID_DATA;

    if ( p + count*2 > valid->limit )
      OTL_INVALID_TOO_SHORT;

    for ( ; count > 0; count-- )
      otl_attach_point_validate( table + OTL_NEXT_USHORT( p ) );
  }
Exemplo n.º 4
0
  static void
  otl_gsub_lookup6_validate( OTL_Bytes      table,
                             OTL_Validator  valid )
  {
    OTL_Bytes  p = table;
    OTL_UInt   format, coverage;

    OTL_CHECK( 2 );
    format = OTL_NEXT_USHORT( p );
    switch ( format )
    {
      case 1:
        {
          OTL_UInt  coverage, count;

          OTL_CHECK( 4 );
          coverage = OTL_NEXT_USHORT( p );
          count    = OTL_NEXT_USHORT( p );

          otl_coverage_validate( table + coverage, valid );

          OTL_CHECK( 2*count );
          for ( ; count > 0; count-- )
            otl_chain_sub_rule_set_validate( table + coverage, valid );
        }
        break;

      case 2:
        {
          OTL_UInt  coverage, back_class, input_class, ahead_class, count;

          OTL_CHECK( 10 );
          coverage    = OTL_NEXT_USHORT( p );
          back_class  = OTL_NEXT_USHORT( p );
          input_class = OTL_NEXT_USHORT( p );
          ahead_class = OTL_NEXT_USHORT( p );
          count       = OTL_NEXT_USHORT( p );

          otl_coverage_validate( table + coverage, valid );

          otl_class_definition_validate( table + back_class,  valid );
          otl_class_definition_validate( table + input_class, valid );
          otl_class_definition_validate( table + ahead_class, valid );

          OTL_CHECK( 2*count );
          for ( ; count > 0; count-- )
            otl_chain_sub_class_set( table + OTL_NEXT_USHORT( p ), valid );
        }
        break;

      case 3:
        {
          OTL_UInt  back_count, input_count, ahead_count, subst_count, count;

          OTL_CHECK( 2 );
          back_count = OTL_NEXT_USHORT( p );

          OTL_CHECK( 2*back_count+2 );
          for ( count = back_count; count > 0; count-- )
            otl_coverage_validate( table + OTL_NEXT_USHORT( p ), valid );

          input_count = OTL_NEXT_USHORT( p );

          OTL_CHECK( 2*input_count+2 );
          for ( count = input_count; count > 0; count-- )
            otl_coverage_validate( table + OTL_NEXT_USHORT( p ), valid );

          ahead_count = OTL_NEXT_USHORT( p );

          OTL_CHECK( 2*ahead_count+2 );
          for ( count = ahead_count; count > 0; count-- )
            otl_coverage_validate( table + OTL_NEXT_USHORT( p ), valid );

          subst_count = OTL_NEXT_USHORT( p );
          OTL_CHECK( subst_count*4 );
        }
        break;

      default:
        OTL_INVALID_DATA;
    }
  }
Exemplo n.º 5
0
  static void
  otl_gsub_lookup5_validate( OTL_Bytes      table,
                             OTL_Validator  valid )
  {
    OTL_Bytes  p = table;
    OTL_UInt   format, coverage;

    OTL_CHECK( 2 );
    format = OTL_NEXT_USHORT( p );
    switch ( format )
    {
      case 1:
        {
          OTL_UInt  coverage, count;

          OTL_CHECK( 4 );
          coverage = OTL_NEXT_USHORT( p );
          count    = OTL_NEXT_USHORT( p );

          otl_coverage_validate( table + coverage, valid );

          OTL_CHECK( 2*count );
          for ( ; count > 0; count-- )
            otl_sub_rule_set_validate( table + coverage, valid );
        }
        break;

      case 2:
        {
          OTL_UInt  coverage, class_def, count;

          OTL_CHECK( 6 );
          coverage  = OTL_NEXT_USHORT( p );
          class_def = OTL_NEXT_USHORT( p );
          count     = OTL_NEXT_USHORT( p );

          otl_coverage_validate        ( table + coverage, valid );
          otl_class_definition_validate( table + class_def, valid );

          OTL_CHECK( 2*count );
          for ( ; count > 0; count-- )
            otl_sub_class_rule_set_validate( table + coveragen valid );
        }
        break;

      case 3:
        {
          OTL_UInt  glyph_count, subst_count, count;

          OTL_CHECK( 4 );
          glyph_count = OTL_NEXT_USHORT( p );
          subst_count = OTL_NEXT_USHORT( p );

          OTL_CHECK( 2*glyph_count + 4*subst_count );
          for ( count = glyph_count; count > 0; count-- )
            otl_coverage_validate( table + OTL_NEXT_USHORT( p ), valid );
        }
        break;

      default:
        OTL_INVALID_DATA;
    }
  }