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

📄 t1load.c

📁 Qt/Embedded是一个多平台的C++图形用户界面应用程序框架
💻 C
📖 第 1 页 / 共 4 页
字号:
      case imm_Weight:        info->weight = CopyString( parser );        break;      case imm_ItalicAngle:        info->italic_angle = CopyInteger( parser );        break;      case imm_isFixedPitch:        info->is_fixed_pitch = CopyBoolean( parser );        break;      case imm_UnderlinePosition:        info->underline_position = (T1_Short)CopyInteger( parser );        break;      case imm_UnderlineThickness:        info->underline_thickness = (T1_Short)CopyInteger( parser );        break;      default:        /* ignore all other things */        parser->error = T1_Err_Ok;    }    return parser->error;  }/**************************************************************************//*                                                                        *//* <Function> Do_Def_Private                                              *//*                                                                        *//* <Description>                                                          *//*    This function performs a 'def' when in the Private dictionary       *//*    Its purpose is to build the T1_Private structure directly from      *//*    the stream..                                                        *//*                                                                        *//* <Input>                                                                *//*    parser :: handle to current parser.                                 *//*                                                                        *//* <Return>                                                               *//*    Error code. 0 means success                                         *//*                                                                        */  static  T1_Error  Do_Def_Private( T1_Parser*  parser )  {    T1_Token*   top   = parser->top;    T1_Font*    priv  = &parser->face->type1;    switch ( top[0].kind2 )    {      case imm_RD: case imm_RD_alternate:    /* Ignore the definitions  */      case imm_ND: case imm_ND_alternate:    /* of RD, NP, ND and their */      case imm_NP: case imm_NP_alternate:    /* alternate forms ...     */        parser->error = T1_Err_Ok;        break;      case imm_BlueValues:        CopyArray( parser, &priv->num_blues,                   priv->blue_values, 14 );        break;      case imm_OtherBlues:        CopyArray( parser, &priv->num_other_blues,                   priv->other_blues, 10 );        break;      case imm_FamilyBlues:        CopyArray( parser, &priv->num_family_blues,                   priv->family_blues, 14 );        break;      case imm_FamilyOtherBlues:        CopyArray( parser, &priv->num_family_other_blues,                   priv->family_other_blues, 10 );        break;      case imm_BlueScale:        priv->blue_scale = CopyFloat( parser, 0x10000 );        break;      case imm_BlueShift:        priv->blue_shift = CopyInteger( parser );        break;      case imm_BlueFuzz:        priv->blue_fuzz = CopyInteger( parser );        break;      case imm_StdHW:        CopyArray( parser, 0, (T1_Short*)&priv->standard_width, 1 );        break;      case imm_StdVW:        CopyArray( parser, 0, (T1_Short*)&priv->standard_height, 1 );        break;      case imm_StemSnapH:        CopyArray( parser, &priv->num_snap_widths,                   priv->stem_snap_widths, 12 );        break;      case imm_StemSnapV:        CopyArray( parser, &priv->num_snap_heights,                   priv->stem_snap_heights, 12 );        break;      case imm_ForceBold:        priv->force_bold = CopyBoolean( parser );        break;      case imm_LanguageGroup:        priv->language_group = CopyInteger( parser );        break;      case imm_password:        priv->password = CopyInteger( parser );        break;      case imm_UniqueID:        priv->unique_id = CopyInteger( parser );        break;      case imm_lenIV:        priv->lenIV = CopyInteger( parser );        break;      case imm_MinFeature:        CopyArray( parser, 0, priv->min_feature, 2 );        break;      default:        /* ignore all other things */        parser->error = T1_Err_Ok;    }    return parser->error;  }/**************************************************************************//*                                                                        *//* <Function> Do_Def_Error                                                *//*                                                                        *//* <Description>                                                          *//*    This function returns a simple syntax error when invoked. It is     *//*    ued for the "def" keyword when in the "encoding", "subrs",          *//*    "othersubrs" and "charstrings" dictionary states..                  *//*                                                                        *//* <Input>                                                                *//*    parser :: handle to current parser.                                 *//*                                                                        *//* <Return>                                                               *//*    Error code. 0 means success                                         *//*                                                                        */  static  T1_Error  Do_Def_Error( T1_Parser*  parser )  {    FT_ERROR(( "T1.Load : 'def' keyword encountered in bad dictionary/array\n" ));    parser->error = T1_Err_Syntax_Error;    return parser->error;  }  static  T1_Error  Do_Def_Ignore( T1_Parser*  parser )  {    (void)parser;    return T1_Err_Ok;  }  static  T1_Parse_Func   def_funcs[ dict_max ] =  {    Do_Def_Error,    Do_Def_Font,    Do_Def_FontInfo,    Do_Def_Ignore,    Do_Def_Private,    Do_Def_Ignore,    Do_Def_Ignore,    Do_Def_Ignore,    Do_Def_Ignore,    Do_Def_Ignore,    Do_Def_Ignore,  };  /**********************************************************************/  /*                                                                    */  /*                                                                    */  /*        IMPLEMENTATION OF THE "PUT" KEYWORD DEPENDING ON            */  /*                     CURRENT DICTIONARY STATE                       */  /*                                                                    */  /*                                                                    */  /**********************************************************************//**************************************************************************//*                                                                        *//* <Function> Do_Put_Encoding                                             *//*                                                                        *//* <Description>                                                          *//*    This function performs a 'put' when in the Encoding array           *//*    The glyph name is copied into the T1 recorder, and the charcode     *//*    and glyph name pointer are written into the face object encoding    *//*                                                                        *//* <Input>                                                                *//*    parser :: handle to current parser.                                 *//*                                                                        *//* <Return>                                                               *//*    Error code. 0 means success                                         *//*                                                                        */  static  T1_Error  Do_Put_Encoding( T1_Parser*  parser )  {    T1_Error      error  = T1_Err_Ok;    T1_Face       face   = parser->face;    T1_Token*     top    = parser->top;    T1_Encoding*  encode = &face->type1.encoding;    T1_Int        index;    /* record and check the character code */    if ( top[0].kind != tok_number )    {      FT_TRACE4(( "T1.Parse.put: number expected\n" ));      goto Syntax_Error;    }    index = (T1_Int)CopyInteger( parser );    if (parser->error) return parser->error;    if ( index < 0 || index >= encode->num_chars )    {      FT_TRACE4(( "T1.Parse.put: invalid character code\n" ));      goto Syntax_Error;    }    /* record the immediate name */    if ( top[1].kind != tok_immediate )    {      FT_TRACE4(( "T1.Parse.put: immediate name expected\n" ));      goto Syntax_Error;    }    /* if the glyph name is '.notdef', store a NULL char name */    /* otherwise, record the glyph name..                     */    if ( top[1].kind == imm_notdef )    {      parser->table.elements[ index ] = 0;      parser->table.lengths [ index ] = 0;    }    else    {      T1_String  temp_name[128];      T1_Token*  token = top+1;      T1_Int     len   = token->len-1;      /* copy immediate name */      if (len > 127) len = 127;      MEM_Copy( temp_name, parser->tokenizer->base + token->start+1, len );      temp_name[len] = '\0';      error = T1_Add_Table( &parser->table, index, (T1_Byte*)temp_name, len+1 );	  /* adjust code_first and code_last */	  if ( index < encode->code_first )  encode->code_first = index;	  if ( index > encode->code_last  )  encode->code_last  = index;    }    return error;  Syntax_Error:    /* ignore the error, and simply clear the stack */    FT_TRACE4(( "T1.Put.Encoding: invalid syntax encountered\n" ));    parser->top = parser->stack;    return T1_Err_Ok;  }  /**********************************************************************/  /*                                                                    */  /*                                                                    */  /*        IMPLEMENTATION OF THE "RD" KEYWORD DEPENDING ON             */  /*                     CURRENT DICTIONARY STATE                       */  /*                                                                    */  /*                                                                    */  /**********************************************************************//**************************************************************************//*                                                                        *//* <Function> Do_RD_Subrs                                                 *//*                                                                        *//* <Description>                                                          *//*    This function performs a 'RD' when in the Subrs dictionary          *//*    It simply records the array of bytecodes/charstrings corresponding  *//*    to the sub-routine..                                                *//*                                                                        *//* <Input>                                                                *//*    parser :: handle to current parser.                                 *//*                                                                        *//* <Return>                                                               *//*    Error code. 0 means success                                         *//*                                                                        */  static  T1_Error  Do_RD_Subrs( T1_Parser*  parser )  {    T1_Error      error  = T1_Err_Ok;    T1_Face       face   = parser->face;    T1_Token*     top    = parser->top;    T1_Tokenizer  tokzer = parser->tokenizer;    T1_Int        index, count;    /* record and check the character code */    if ( top[0].kind != tok_number ||         top[1].kind != tok_number )    {      FT_ERROR(( "T1.Parse.put: number expected\n" ));      goto Syntax_Error;    }    index = (T1_Int)CopyInteger( parser );    error = parser->error; if (error) goto Exit;    count = (T1_Int)CopyInteger( parser );    error = parser->error; if (error) goto Exit;    if ( index < 0 || index >= face->type1.num_subrs )    {      FT_ERROR(( "T1.Parse.put: invalid character code\n" ));      goto Syntax_Error;    }    /* decrypt charstring and skip them */    {      T1_Byte*  base = tokzer->base + tokzer->cursor;      t1_decrypt( base, count, 4330 );      tokzer->cursor += count;      base  += face->type1.lenIV;      count -= face->type1.lenIV;      error = T1_Add_Table( &parser->table, index, base, count );    }    /* consume the closing NP or 'put' */    error = Expect_Keyword2( parser, key_NP, key_put );  Exit:    return error;  Syntax_Error:    return T1_Err_Syntax_Error;  }

⌨️ 快捷键说明

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