⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ftxgpos.c

📁 神龙卡开发原代码
💻 C
📖 第 1 页 / 共 5 页
字号:
    count = m2a->Mark2Count = GET_UShort();        FORGET_Frame();    m2a->Mark2Record = NULL;    if ( ALLOC_ARRAY( m2a->Mark2Record, count, TTO_Mark2Record ) )      return error;    m2r = m2a->Mark2Record;    for ( m = 0; m < count; m++ )    {      m2r[m].Mark2Anchor = NULL;      if ( ALLOC_ARRAY( m2r[m].Mark2Anchor, num_classes, TTO_Anchor ) )        goto Fail;      m2an = m2r[m].Mark2Anchor;      for ( n = 0; n < num_classes; n++ )      {        if ( ACCESS_Frame( 2L ) )          goto Fail;        new_offset = GET_UShort() + base_offset;        FORGET_Frame();        cur_offset = FILE_Pos();        if ( FILE_Seek( new_offset ) ||             ( error = Load_Anchor( &m2an[n], input ) ) != TT_Err_Ok )          goto Fail;        (void)FILE_Seek( cur_offset );      }    }    return TT_Err_Ok;  Fail:    for ( m = 0; m < count; m++ )    {      m2an = m2r[m].Mark2Anchor;            for ( n = 0; n < num_classes; n++ )        Free_Anchor( &m2an[n] );      FREE( m2an );    }    FREE( m2r );    return error;  }  static void  Free_Mark2Array( TTO_Mark2Array*  m2a,                                UShort           num_classes )  {    UShort            m, n, count;    TTO_Mark2Record*  m2r;    TTO_Anchor*       m2an;    if ( m2a->Mark2Record )    {      count = m2a->Mark2Count;      m2r   = m2a->Mark2Record;      for ( m = 0; m < count; m++ )      {        m2an = m2r[m].Mark2Anchor;        for ( n = 0; n < num_classes; n++ )          Free_Anchor( &m2an[n] );        FREE( m2an );      }      FREE( m2r );    }  }  /* MarkMarkPosFormat1 */  TT_Error  Load_MarkMarkPos( TTO_MarkMarkPos*  mmp,                              PFace             input )  {    DEFINE_LOAD_LOCALS( input->stream );    ULong  cur_offset, new_offset, base_offset;    base_offset = FILE_Pos();    if ( ACCESS_Frame( 4L ) )      return error;    mmp->PosFormat = GET_UShort();    new_offset     = GET_UShort() + base_offset;    FORGET_Frame();    cur_offset = FILE_Pos();    if ( FILE_Seek( new_offset ) ||         ( error = Load_Coverage( &mmp->Mark1Coverage,                                  input ) ) != TT_Err_Ok )      return error;    (void)FILE_Seek( cur_offset );    if ( ACCESS_Frame( 2L ) )      goto Fail3;    new_offset = GET_UShort() + base_offset;    FORGET_Frame();    cur_offset = FILE_Pos();    if ( FILE_Seek( new_offset ) ||         ( error = Load_Coverage( &mmp->Mark2Coverage,                                  input ) ) != TT_Err_Ok )      goto Fail3;    (void)FILE_Seek( cur_offset );    if ( ACCESS_Frame( 4L ) )      goto Fail2;    mmp->ClassCount = GET_UShort();    new_offset      = GET_UShort() + base_offset;    FORGET_Frame();    cur_offset = FILE_Pos();    if ( FILE_Seek( new_offset ) ||         ( error = Load_MarkArray( &mmp->Mark1Array, input ) ) != TT_Err_Ok )      goto Fail2;    (void)FILE_Seek( cur_offset );    if ( ACCESS_Frame( 2L ) )      goto Fail1;    new_offset = GET_UShort() + base_offset;    FORGET_Frame();    cur_offset = FILE_Pos();    if ( FILE_Seek( new_offset ) ||         ( error = Load_Mark2Array( &mmp->Mark2Array, mmp->ClassCount,                                    input ) ) != TT_Err_Ok )      goto Fail1;    return TT_Err_Ok;  Fail1:    Free_MarkArray( &mmp->Mark1Array );  Fail2:    Free_Coverage( &mmp->Mark2Coverage );  Fail3:    Free_Coverage( &mmp->Mark1Coverage );    return error;  }  void  Free_MarkMarkPos( TTO_MarkMarkPos*  mmp )  {    Free_Mark2Array( &mmp->Mark2Array, mmp->ClassCount );    Free_MarkArray( &mmp->Mark1Array );    Free_Coverage( &mmp->Mark2Coverage );    Free_Coverage( &mmp->Mark1Coverage );  }  /* LookupType 7 */  /* PosRule */  static TT_Error  Load_PosRule( TTO_PosRule*  pr,                                 PFace         input )  {    DEFINE_LOAD_LOCALS( input->stream );    UShort                n, count;    UShort*               i;    TTO_PosLookupRecord*  plr;    if ( ACCESS_Frame( 4L ) )      return error;    pr->GlyphCount = GET_UShort();    pr->PosCount   = GET_UShort();    FORGET_Frame();    pr->Input = NULL;    count = pr->GlyphCount - 1;         /* only GlyphCount - 1 elements */    if ( ALLOC_ARRAY( pr->Input, count, UShort ) )      return error;    i = pr->Input;    if ( ACCESS_Frame( count * 2L ) )      goto Fail2;    for ( n = 0; n < count; n++ )      i[n] = GET_UShort();    FORGET_Frame();    pr->PosLookupRecord = NULL;    count = pr->PosCount;    if ( ALLOC_ARRAY( pr->PosLookupRecord, count, TTO_PosLookupRecord ) )      goto Fail2;    plr = pr->PosLookupRecord;    if ( ACCESS_Frame( count * 4L ) )      goto Fail1;    for ( n = 0; n < count; n++ )    {      plr[n].SequenceIndex   = GET_UShort();      plr[n].LookupListIndex = GET_UShort();    }    FORGET_Frame();    return TT_Err_Ok;  Fail1:    FREE( plr );  Fail2:    FREE( i );    return error;  }  static void  Free_PosRule( TTO_PosRule*  pr )  {    FREE( pr->PosLookupRecord );    FREE( pr->Input );  }  /* PosRuleSet */  static TT_Error  Load_PosRuleSet( TTO_PosRuleSet*  prs,                                    PFace            input )  {    DEFINE_LOAD_LOCALS( input->stream );    UShort        n, count;    ULong         cur_offset, new_offset, base_offset;    TTO_PosRule*  pr;    base_offset = FILE_Pos();    if ( ACCESS_Frame( 2L ) )      return error;    count = prs->PosRuleCount = GET_UShort();    FORGET_Frame();    prs->PosRule = NULL;    if ( ALLOC_ARRAY( prs->PosRule, count, TTO_PosRule ) )      return error;    pr = prs->PosRule;    for ( n = 0; n < count; n++ )    {      if ( ACCESS_Frame( 2L ) )        goto Fail;      new_offset = GET_UShort() + base_offset;      FORGET_Frame();      cur_offset = FILE_Pos();      if ( FILE_Seek( new_offset ) ||           ( error = Load_PosRule( &pr[n], input ) ) != TT_Err_Ok )        goto Fail;      (void)FILE_Seek( cur_offset );    }    return TT_Err_Ok;  Fail:    for ( n = 0; n < count; n++ )      Free_PosRule( &pr[n] );    FREE( pr );    return error;  }  static void  Free_PosRuleSet( TTO_PosRuleSet*  prs )  {    UShort        n, count;    TTO_PosRule*  pr;    if ( prs->PosRule )    {      count = prs->PosRuleCount;      pr    = prs->PosRule;      for ( n = 0; n < count; n++ )        Free_PosRule( &pr[n] );      FREE( pr );    }  }  /* ContextPosFormat1 */  static TT_Error  Load_ContextPos1( TTO_ContextPosFormat1*  cpf1,                                     PFace                   input )  {    DEFINE_LOAD_LOCALS( input->stream );    UShort           n, count;    ULong            cur_offset, new_offset, base_offset;    TTO_PosRuleSet*  prs;    base_offset = FILE_Pos() - 2L;    if ( ACCESS_Frame( 2L ) )      return error;    new_offset = GET_UShort() + base_offset;    FORGET_Frame();    cur_offset = FILE_Pos();    if ( FILE_Seek( new_offset ) ||         ( error = Load_Coverage( &cpf1->Coverage, input ) ) != TT_Err_Ok )      return error;    (void)FILE_Seek( cur_offset );    if ( ACCESS_Frame( 2L ) )      goto Fail2;    count = cpf1->PosRuleSetCount = GET_UShort();    FORGET_Frame();    cpf1->PosRuleSet = NULL;    if ( ALLOC_ARRAY( cpf1->PosRuleSet, count, TTO_PosRuleSet ) )      goto Fail2;    prs = cpf1->PosRuleSet;    for ( n = 0; n < count; n++ )    {      if ( ACCESS_Frame( 2L ) )        goto Fail1;      new_offset = GET_UShort() + base_offset;      FORGET_Frame();      cur_offset = FILE_Pos();      if ( FILE_Seek( new_offset ) ||           ( error = Load_PosRuleSet( &prs[n], input ) ) != TT_Err_Ok )        goto Fail1;      (void)FILE_Seek( cur_offset );    }    return TT_Err_Ok;  Fail1:    for ( n = 0; n < count; n++ )      Free_PosRuleSet( &prs[n] );    FREE( prs );  Fail2:    Free_Coverage( &cpf1->Coverage );    return error;  }  static void  Free_Context1( TTO_ContextPosFormat1*  cpf1 )  {    UShort           n, count;    TTO_PosRuleSet*  prs;    if ( cpf1->PosRuleSet )    {      count = cpf1->PosRuleSetCount;      prs   = cpf1->PosRuleSet;      for ( n = 0; n < count; n++ )        Free_PosRuleSet( &prs[n] );      FREE( prs );    }    Free_Coverage( &cpf1->Coverage );  }  /* PosClassRule */  static TT_Error  Load_PosClassRule( TTO_ContextPosFormat2*  cpf2,                                      TTO_PosClassRule*       pcr,                                      PFace                   input )  {    DEFINE_LOAD_LOCALS( input->stream );    UShort                n, count;    UShort*               c;    TTO_PosLookupRecord*  plr;    Bool*                 d;    if ( ACCESS_Frame( 4L ) )      return error;    pcr->GlyphCount = GET_UShort();    pcr->PosCount   = GET_UShort();    FORGET_Frame();    if ( pcr->GlyphCount > cpf2->MaxContextLength )      cpf2->MaxContextLength = pcr->GlyphCount;    pcr->Class = NULL;    count = pcr->GlyphCount - 1;        /* only GlyphCount - 1 elements */    if ( ALLOC_ARRAY( pcr->Class, count, UShort ) )      return error;    c = pcr->Class;    d = cpf2->ClassDef.Defined;    if ( ACCESS_Frame( count * 2L ) )      goto Fail2;    for ( n = 0; n < count; n++ )    {      c[n] = GET_UShort();      /* We check whether the specific class is used at all.  If not,         class 0 is used instead.                                     */      if ( !d[c[n]] )        c[n] = 0;    }    FORGET_Frame();    pcr->PosLookupRecord = NULL;    count = pcr->PosCount;    if ( ALLOC_ARRAY( pcr->PosLookupRecord, count, TTO_PosLookupRecord ) )      goto Fail2;    plr = pcr->PosLookupRecord;    if ( ACCESS_Frame( count * 4L ) )      goto Fail1;    for ( n = 0; n < count; n++ )    {      plr[n].SequenceIndex   = GET_UShort();      plr[n].LookupListIndex = GET_UShort();    }    FORGET_Frame();    return TT_Err_Ok;  Fail1:    FREE( plr );  Fail2:    FREE( c );    return error;  }  static void  Free_PosClassRule( TTO_PosClassRule*  pcr )  {    FREE( pcr->PosLookupRecord );    FREE( pcr->Class );  }  /* PosClassSet */  static TT_Error  Load_PosClassSet( TTO_ContextPosFormat2*  cpf2,                                     TTO_PosClassSet*        pcs,                                     PFace                   input )  {    DEFINE_LOAD_LOCALS( input->stream );    UShort             n, count;    ULong              cur_offset, new_offset, base_offset;    TTO_PosClassRule*  pcr;    base_offset = FILE_Pos();    if ( ACCESS_Frame( 2L ) )      return error;    count = pcs->PosClassRuleCount = GET_UShort();    FORGET_Frame();    pcs->PosClassRule = NULL;    if ( ALLOC_ARRAY( pcs->PosClassRule, count, TTO_PosClassRule ) )      return error;    pcr = pcs->PosClassRule;    for ( n = 0; n < count; n++ )    {      if ( ACCESS_Frame( 2L ) )        goto Fail;      new_offset = GET_UShort() + base_offset;      FORGET_Frame();      cur_offset = FILE_Pos();      if ( FILE_Seek( new_offset ) ||           ( error = Load_PosClassRule( cpf2, &pcr[n],                                        input ) ) != TT_Err_Ok )        goto Fail;      (void)FILE_Seek( cur_offset );    }    return TT_Err_Ok;  Fail:    for ( n = 0; n < count; n++ )      Free_PosClassRule( &pcr[n] );    FREE( pcr );    return error;  }  static void  Free_PosClassSet( TTO_PosClassSet*  pcs )  {    UShort             n, count;    TTO_PosClassRule*  pcr;    if ( pcs->PosClassRule )    {      count = pcs->PosClassRuleCount;      pcr   = pcs->PosClassRule;      for ( n = 0; n < count; n++ )        Free_PosClassRule( &pcr[n] );      FREE( pcr );    }  }  /* ContextPosFormat2 */  static TT_Error  Load_ContextPos2( TTO_ContextPosFormat2*  cpf2,                                     PFace                   input )  {    DEFINE_LOAD_LOCALS( input->stream );    UShort            n, count;    ULong             cur_offset, new_offset, base_offset;    TTO_PosClassSet*  pcs;    base_offset = FILE_Pos() - 2;    if ( ACCESS_Frame( 2L ) )      return error;    new_offset = GET_UShort() + base_offset;    FORGET_Frame();    cur_offset = FILE_Pos();    if ( FILE_Seek( new_offset ) ||         ( error = Load_Coverage( &cpf2->Coverage, input ) ) != TT_Err_Ok )      return error;    (void)FILE_Seek( cur_offset );    if ( ACCESS_Frame( 4L ) )      goto Fail3;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -