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

📄 t1objs.c

📁 奇趣公司比较新的qt/emd版本
💻 C
📖 第 1 页 / 共 2 页
字号:
  /*    FreeType error code.  0 means success.                             */  /*                                                                       */  FT_LOCAL_DEF( FT_Error )  T1_Face_Init( FT_Stream      stream,                T1_Face        face,                FT_Int         face_index,                FT_Int         num_params,                FT_Parameter*  params )  {    FT_Error            error;    FT_Service_PsCMaps  psnames;    PSAux_Service       psaux;    T1_Font             type1 = &face->type1;    PS_FontInfo         info = &type1->font_info;    FT_UNUSED( num_params );    FT_UNUSED( params );    FT_UNUSED( face_index );    FT_UNUSED( stream );    face->root.num_faces = 1;    FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS );    face->psnames = psnames;    face->psaux = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ),                                           "psaux" );    psaux = (PSAux_Service)face->psaux;    face->pshinter = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ),                                              "pshinter" );    /* open the tokenizer; this will also check the font format */    error = T1_Open_Face( face );    if ( error )      goto Exit;    /* if we just wanted to check the format, leave successfully now */    if ( face_index < 0 )      goto Exit;    /* check the face index */    if ( face_index != 0 )    {      FT_ERROR(( "T1_Face_Init: invalid face index\n" ));      error = T1_Err_Invalid_Argument;      goto Exit;    }    /* now load the font program into the face object */    /* initialize the face object fields */    /* set up root face fields */    {      FT_Face  root = (FT_Face)&face->root;      root->num_glyphs = type1->num_glyphs;      root->face_index = face_index;      root->face_flags = FT_FACE_FLAG_SCALABLE    |                         FT_FACE_FLAG_HORIZONTAL  |                         FT_FACE_FLAG_GLYPH_NAMES |                         FT_FACE_FLAG_HINTER;      if ( info->is_fixed_pitch )        root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;      if ( face->blend )        root->face_flags |= FT_FACE_FLAG_MULTIPLE_MASTERS;      /* XXX: TODO -- add kerning with .afm support */      /* get style name -- be careful, some broken fonts only */      /* have a `/FontName' dictionary entry!                 */      root->family_name = info->family_name;      /* assume "Regular" style if we don't know better */      root->style_name = (char *)"Regular";      if ( root->family_name )      {        char*  full   = info->full_name;        char*  family = root->family_name;        if ( full )        {          while ( *full )          {            if ( *full == *family )            {              family++;              full++;            }            else            {              if ( *full == ' ' || *full == '-' )                full++;              else if ( *family == ' ' || *family == '-' )                family++;              else              {                if ( !*family )                  root->style_name = full;                break;              }            }          }        }      }      else      {        /* do we have a `/FontName'? */        if ( type1->font_name )          root->family_name = type1->font_name;      }      /* compute style flags */      root->style_flags = 0;      if ( info->italic_angle )        root->style_flags |= FT_STYLE_FLAG_ITALIC;      if ( info->weight )      {        if ( !ft_strcmp( info->weight, "Bold"  ) ||             !ft_strcmp( info->weight, "Black" ) )          root->style_flags |= FT_STYLE_FLAG_BOLD;      }      /* no embedded bitmap support */      root->num_fixed_sizes = 0;      root->available_sizes = 0;      root->bbox.xMin =   type1->font_bbox.xMin             >> 16;      root->bbox.yMin =   type1->font_bbox.yMin             >> 16;      root->bbox.xMax = ( type1->font_bbox.xMax + 0xFFFFU ) >> 16;      root->bbox.yMax = ( type1->font_bbox.yMax + 0xFFFFU ) >> 16;      /* Set units_per_EM if we didn't set it in parse_font_matrix. */      if ( !root->units_per_EM )        root->units_per_EM = 1000;      root->ascender  = (FT_Short)( root->bbox.yMax );      root->descender = (FT_Short)( root->bbox.yMin );      root->height = (FT_Short)( ( root->units_per_EM * 12 ) / 10 );      if ( root->height < root->ascender - root->descender )        root->height = (FT_Short)( root->ascender - root->descender );      /* now compute the maximum advance width */      root->max_advance_width =        (FT_Short)( root->bbox.xMax );      {        FT_Pos  max_advance;        error = T1_Compute_Max_Advance( face, &max_advance );        /* in case of error, keep the standard width */        if ( !error )          root->max_advance_width = (FT_Short)max_advance;        else          error = 0;   /* clear error */      }      root->max_advance_height = root->height;      root->underline_position  = (FT_Short)info->underline_position;      root->underline_thickness = (FT_Short)info->underline_thickness;    }    {      FT_Face  root = &face->root;      if ( psnames && psaux )      {        FT_CharMapRec    charmap;        T1_CMap_Classes  cmap_classes = psaux->t1_cmap_classes;        FT_CMap_Class    clazz;        charmap.face = root;        /* first of all, try to synthetize a Unicode charmap */        charmap.platform_id = 3;        charmap.encoding_id = 1;        charmap.encoding    = FT_ENCODING_UNICODE;        FT_CMap_New( cmap_classes->unicode, NULL, &charmap, NULL );        /* now, generate an Adobe Standard encoding when appropriate */        charmap.platform_id = 7;        clazz               = NULL;        switch ( type1->encoding_type )        {        case T1_ENCODING_TYPE_STANDARD:          charmap.encoding    = FT_ENCODING_ADOBE_STANDARD;          charmap.encoding_id = TT_ADOBE_ID_STANDARD;          clazz               = cmap_classes->standard;          break;        case T1_ENCODING_TYPE_EXPERT:          charmap.encoding    = FT_ENCODING_ADOBE_EXPERT;          charmap.encoding_id = TT_ADOBE_ID_EXPERT;          clazz               = cmap_classes->expert;          break;        case T1_ENCODING_TYPE_ARRAY:          charmap.encoding    = FT_ENCODING_ADOBE_CUSTOM;          charmap.encoding_id = TT_ADOBE_ID_CUSTOM;          clazz               = cmap_classes->custom;          break;        case T1_ENCODING_TYPE_ISOLATIN1:          charmap.encoding    = FT_ENCODING_ADOBE_LATIN_1;          charmap.encoding_id = TT_ADOBE_ID_LATIN_1;          clazz               = cmap_classes->unicode;          break;        default:          ;        }        if ( clazz )          FT_CMap_New( clazz, NULL, &charmap, NULL );#if 0        /* Select default charmap */        if (root->num_charmaps)          root->charmap = root->charmaps[0];#endif      }    }  Exit:    return error;  }  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    T1_Driver_Init                                                     */  /*                                                                       */  /* <Description>                                                         */  /*    Initializes a given Type 1 driver object.                          */  /*                                                                       */  /* <Input>                                                               */  /*    driver :: A handle to the target driver object.                    */  /*                                                                       */  /* <Return>                                                              */  /*    FreeType error code.  0 means success.                             */  /*                                                                       */  FT_LOCAL_DEF( FT_Error )  T1_Driver_Init( T1_Driver  driver )  {    FT_UNUSED( driver );    return T1_Err_Ok;  }  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    T1_Driver_Done                                                     */  /*                                                                       */  /* <Description>                                                         */  /*    Finalizes a given Type 1 driver.                                   */  /*                                                                       */  /* <Input>                                                               */  /*    driver :: A handle to the target Type 1 driver.                    */  /*                                                                       */  FT_LOCAL_DEF( void )  T1_Driver_Done( T1_Driver  driver )  {    FT_UNUSED( driver );  }/* END */

⌨️ 快捷键说明

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