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

📄 ftobjs.c

📁 Qt/Embedded是一个多平台的C++图形用户界面应用程序框架
💻 C
📖 第 1 页 / 共 5 页
字号:
    {      driver = args->driver;      /* not all drivers directly support face objects, so check... */      if ( driver->interface.face_object_size )      {        error = open_face( driver, stream, face_index, &face );        if ( !error )          goto Success;      }      else        error = FT_Err_Invalid_Handle;      goto Fail;    }    else    {      /* check each font driver for an appropriate format */      FT_Driver*  cur   = library->drivers;      FT_Driver*  limit = cur + library->num_drivers;      for ( ; cur < limit; cur++ )      {        driver = *cur;        /* not all drivers directly support face objects, so check... */        if ( driver->interface.face_object_size )        {          error = open_face( driver, stream, face_index, &face );          if ( !error )            goto Success;          if ( error != FT_Err_Unknown_File_Format )            goto Fail;        }      }      /* no driver is able to handle this format */      error = FT_Err_Unknown_File_Format;      goto Fail;    }  Success:    FT_TRACE4(( "FT_New_Face: New face object, adding to list\n" ));    /* add the face object to its driver's list */    if ( ALLOC( node, sizeof ( *node ) ) )      goto Fail;    node->data = face;    /* don't assume driver is the same as face->driver, so use        face->driver instead. (JvR 3/5/2000) */    FT_List_Add( &face->driver->faces_list, node );    /* now allocate a glyph slot object for the face */    {      FT_GlyphSlot  slot;      FT_TRACE4(( "FT_Open_Face: Creating glyph slot\n" ));      error = FT_New_GlyphSlot( face, &slot );      if ( error )        goto Fail;    }    /* finally allocate a size object for the face */    {      FT_Size  size;      FT_TRACE4(( "FT_Open_Face: Creating size object\n" ));      error = FT_New_Size( face, &size );      if ( error )        goto Fail;    }    *aface = face;    goto Exit;  Fail:    FT_Done_Face( face );  Exit:    FT_TRACE4(( "FT_Open_Face: Return %d\n", error ));    return error;  }  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    FT_Attach_File                                                     */  /*                                                                       */  /* <Description>                                                         */  /*    `Attaches' a given font file to an existing face.  This is usually */  /*    to read additional information for a single face object.  For      */  /*    example, it is used to read the AFM files that come with Type 1    */  /*    fonts in order to add kerning data and other metrics.              */  /*                                                                       */  /* <InOut>                                                               */  /*    face         :: The target face object.                            */  /*                                                                       */  /* <Input>                                                               */  /*    filepathname :: An 8-bit pathname naming the `metrics' file.       */  /*                                                                       */  /* <Return>                                                              */  /*    FreeType error code.  0 means success.                             */  /*                                                                       */  /* <Note>                                                                */  /*    If your font file is in memory, or if you want to provide your     */  /*    own input stream object, use FT_Attach_Stream().                   */  /*                                                                       */  /*    The meaning of the `attach' action (i.e., what really happens when */  /*    the new file is read) is not fixed by FreeType itself.  It really  */  /*    depends on the font format (and thus the font driver).             */  /*                                                                       */  /*    Client applications are expected to know what they are doing       */  /*    when invoking this function. Most  drivers simply do not implement */  /*    file attachments.                                                  */  /*                                                                       */  EXPORT_FUNC  FT_Error  FT_Attach_File( FT_Face      face,                            const char*  filepathname )  {    FT_Open_Args  open = ft_default_open_args;    open.pathname = (char*)filepathname;    return FT_Attach_Stream( face, &open );  }                              /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    FT_Attach_Stream                                                   */  /*                                                                       */  /* <Description>                                                         */  /*    This function is similar to FT_Attach_File with the exception      */  /*    that it reads the attachment from an arbitrary stream.             */  /*                                                                       */  /* <Input>                                                               */  /*    face :: target face object                                         */  /*                                                                       */  /*    args :: a pointer to an FT_Open_Args structure used to describe    */  /*            the input stream to FreeType                               */  /* <Return>                                                              */  /*    Error code.  0 means success.                                      */  /*                                                                       */  /*    The meaning of the "attach" (i.e. what really happens when the     */  /*    new file is read) is not fixed by FreeType itself. It really       */  /*    depends on the font format (and thus the font driver).             */  /*                                                                       */  /*    Client applications are expected to know what they're doing        */  /*    when invoking this function. Most drivers simply do not implement  */  /*    file attachments..                                                 */  /*                                                                       */  EXPORT_DEF  FT_Error  FT_Attach_Stream( FT_Face       face,                              FT_Open_Args* parameters )  {    FT_Stream  stream;    FT_Error   error;    FT_Driver  driver;        FTDriver_getInterface  get_interface;        if ( !face || !face->driver )      return FT_Err_Invalid_Handle;          driver = face->driver;    error = ft_new_input_stream( driver->library, parameters, &stream );    if (error) goto Exit;        /* we implement FT_Attach_Stream in each driver through the */    /* "attach_file" interface..                                */    error = FT_Err_Unimplemented_Feature;    get_interface = driver->interface.get_interface;    if (get_interface)        {      FT_Attach_Reader  reader;            reader = (FT_Attach_Reader)(get_interface( driver, "attach_file" ));      if (reader)        error = reader( face, stream );    }        /* close the attached stream */    ft_done_stream( &stream );      Exit:    return error;  }  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    FT_Done_Face                                                       */  /*                                                                       */  /* <Description>                                                         */  /*    Discards a given face object, as well as all of its child slots    */  /*    and sizes.                                                         */  /*                                                                       */  /* <Input>                                                               */  /*    face :: A handle to a target face object.                          */  /*                                                                       */  /* <Return>                                                              */  /*    Error code.  0 means success.                                      */  /*                                                                       */  EXPORT_FUNC  FT_Error  FT_Done_Face( FT_Face  face )  {    FT_Error             error;    FT_Driver            driver;    FT_Memory            memory;    FT_DriverInterface*  interface;    FT_ListNode          node;    if (!face || !face->driver )      return FT_Err_Invalid_Face_Handle;    driver    = face->driver;    interface = &driver->interface;    memory    = driver->memory;    /* find face in driver's list */    node = FT_List_Find( &driver->faces_list, face );    if ( node )    {      /* remove face object from the driver's list */      FT_List_Remove( &driver->faces_list, node );      FREE( node );      /* now destroy the object proper */      destroy_face( memory, face, driver );      error = FT_Err_Ok;    }    else      error = FT_Err_Invalid_Face_Handle;    return error;  }  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    FT_New_Size                                                        */  /*                                                                       */  /* <Description>                                                         */  /*    Creates a new size object from a given face object.                */  /*                                                                       */  /* <Input>                                                               */  /*    face :: A handle to a parent face object.                          */  /*                                                                       */  /* <Output>                                                              */  /*    size :: A handle to a new size object.                             */  /*                                                                       */  /* <Return>                                                              */  /*    Error code.  0 means success.                                      */  /*                                                                       */  EXPORT_FUNC  FT_Error  FT_New_Size( FT_Face   face,                         FT_Size*  asize )  {    FT_Error             error;    FT_Memory            memory;    FT_Driver            driver;    FT_DriverInterface*  interface;    FT_Size              size = 0;    FT_ListNode          node = 0;    if ( !face || !face->driver )      return FT_Err_Invalid_Face_Handle;    *asize    = 0;    driver    = face->driver;    interface = &driver->interface;    memory    = face->memory;    /* Allocate new size object and perform basic initialisation */    if ( ALLOC( size, interface->size_object_size ) ||         ALLOC( node, sizeof ( FT_ListNodeRec )   ) )      goto Exit;    size->face = face;    error = interface->init_size( size );    /* in case of success, add to the face's list */    if ( !error )    {      *asize     = size;      node->data = size;      FT

⌨️ 快捷键说明

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