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

📄 ftobjs.c

📁 Qt/Embedded是一个多平台的C++图形用户界面应用程序框架
💻 C
📖 第 1 页 / 共 5 页
字号:
      return FT_Err_Invalid_Driver_Handle;    library = driver->library;    memory  = driver->memory;    if ( !library || !memory )      return FT_Err_Invalid_Driver_Handle;    /* look-up driver entry in library table */    error = FT_Err_Invalid_Driver_Handle;    cur   = library->drivers;    last  = cur + library->num_drivers - 1;    for ( ; cur <= last; cur++ )    {      if ( *cur == driver )      {        /* destroy the driver object */        Destroy_Driver( driver );        /* now move the last driver in the table to the vacant slot */        if ( cur < last )        {          *cur  = *last;          *last = 0;        }        library->num_drivers--;        /* exit loop */        error = FT_Err_Ok;        break;      }    }    return error;  }  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    FT_Get_Driver                                                      */  /*                                                                       */  /* <Description>                                                         */  /*    Returns the handle of the driver responsible for a given format    */  /*    (or service) according to its `name'.                              */  /*                                                                       */  /* <Input>                                                               */  /*    library     :: A handle to the library object.                     */  /*    driver_name :: The name of the driver to look up.                  */  /*                                                                       */  /* <Return>                                                              */  /*    A handle to the driver object, 0 otherwise.                        */  /*                                                                       */  EXPORT_FUNC  FT_Driver  FT_Get_Driver( FT_Library  library,                            char*       driver_name )  {    FT_Driver  *cur, *limit;    if ( !library || !driver_name )      return 0;    cur   = library->drivers;    limit = cur + library->num_drivers;    for ( ; cur < limit; cur++ )    {      if ( strcmp( (*cur)->interface.driver_name, driver_name ) == 0 )        return *cur;    }    return 0;  }  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    open_face                                                          */  /*                                                                       */  /* <Description>                                                         */  /*    This function does some work for FT_Open_Face().                   */  /*                                                                       */  static  FT_Error  open_face( FT_Driver  driver,                       FT_Stream  stream,                       FT_Long    face_index,                       FT_Face*   aface )  {    FT_Memory            memory;    FT_DriverInterface*  interface;    FT_Face              face = 0;    FT_Error             error;    interface = &driver->interface;    memory    = driver->memory;    /* allocate the face object, and perform basic initialization */    if ( ALLOC( face, interface->face_object_size ) )      goto Fail;    face->driver = driver;    face->memory = memory;    face->stream = stream;    error = interface->init_face( stream, face_index, face );    if ( error )      goto Fail;    *aface = face;  Fail:    if ( error )    {      interface->done_face( face );      FREE( face );      *aface = 0;    }    return error;  }  static  const FT_Open_Args  ft_default_open_args =     { 0, 0, 0, 0, 0 };  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    FT_New_Face                                                        */  /*                                                                       */  /* <Description>                                                         */  /*    Creates a new face object from a given resource and typeface index */  /*    using a pathname to the font file.                                 */  /*                                                                       */  /* <InOut>                                                               */  /*    library    :: A handle to the library resource.                    */  /*                                                                       */  /* <Input>                                                               */  /*    pathname   :: A path to the font file.                             */  /*    face_index :: The index of the face within the resource.  The      */  /*                  first face has index 0.                              */  /* <Output>                                                              */  /*    face       :: A handle to a new face object.                       */  /*                                                                       */  /* <Return>                                                              */  /*    FreeType error code.  0 means success.                             */  /*                                                                       */  /* <Note>                                                                */  /*    Unlike FreeType 1.x, this function automatically creates a glyph   */  /*    slot for the face object which can be accessed directly through    */  /*    `face->glyph'.                                                     */  /*                                                                       */  /*    Note that additional slots can be added to each face with the      */  /*    FT_New_GlyphSlot() API function.  Slots are linked in a single     */  /*    list through their `next' field.                                   */  /*                                                                       */  /*    FT_New_Face() can be used to determine and/or check the font       */  /*    format of a given font resource.  If the `face_index' field is     */  /*    negative, the function will _not_ return any face handle in        */  /*    `*face'.  Its return value should be 0 if the resource is          */  /*    recognized, or non-zero if not.                                    */  /*                                                                       */  EXPORT_FUNC  FT_Error  FT_New_Face( FT_Library   library,                         const char*  pathname,                         FT_Long      face_index,                         FT_Face*     aface )  {    FT_Open_Args  args = ft_default_open_args;        args.pathname = (char*)pathname;    return FT_Open_Face( library, &args, face_index, aface );  }  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    FT_New_Memory_Face                                                 */  /*                                                                       */  /* <Description>                                                         */  /*    Creates a new face object from a given resource and typeface index */  /*    using a font file already loaded into memory.                      */  /*                                                                       */  /* <InOut>                                                               */  /*    library    :: A handle to the library resource.                    */  /*                                                                       */  /* <Input>                                                               */  /*    file_base  :: A pointer to the beginning of the font data.         */  /*    file_size  :: The size of the memory chunk used by the font data.  */  /*    face_index :: The index of the face within the resource.  The      */  /*                  first face has index 0.                              */  /* <Output>                                                              */  /*    face       :: A handle to a new face object.                       */  /*                                                                       */  /* <Return>                                                              */  /*    FreeType error code.  0 means success.                             */  /*                                                                       */  /* <Note>                                                                */  /*    Unlike FreeType 1.x, this function automatically creates a glyph   */  /*    slot for the face object which can be accessed directly through    */  /*    `face->glyph'.                                                     */  /*                                                                       */  /*    Note that additional slots can be added to each face with the      */  /*    FT_New_GlyphSlot() API function.  Slots are linked in a single     */  /*    list through their `next' field.                                   */  /*                                                                       */  /*    FT_New_Memory_Face() can be used to determine and/or check the     */  /*    font format of a given font resource.  If the `face_index' field   */  /*    is negative, the function will _not_ return any face handle in     */  /*    `*face'.  Its return value should be 0 if the resource is          */  /*    recognized, or non-zero if not.                                    */  /*                                                                       */  EXPORT_FUNC  FT_Error  FT_New_Memory_Face( FT_Library   library,                                void*        file_base,                                FT_Long      file_size,                                FT_Long      face_index,                                FT_Face*     face )  {    FT_Open_Args  args = ft_default_open_args;    args.memory_base = file_base;    args.memory_size = file_size;    return FT_Open_Face( library, &args, face_index, face );  }  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    FT_Open_Face                                                       */  /*                                                                       */  /* <Description>                                                         */  /*    Opens a face object from a given resource and typeface index using */  /*    an `FT_Open_Args' structure.  If the face object doesn't exist, it */  /*    will be created.                                                   */  /*                                                                       */  /* <InOut>                                                               */  /*    library    :: A handle to the library resource.                    */  /*                                                                       */  /* <Input>                                                               */  /*    args       :: A pointer to an `FT_Open_Args' structure which must  */  /*                  be filled by the caller.                             */  /*    face_index :: The index of the face within the resource.  The      */  /*                  first face has index 0.                              */  /* <Output>                                                              */  /*    face       :: A handle to a new face object.                       */  /*                                                                       */  /* <Return>                                                              */  /*    FreeType error code.  0 means success.                             */  /*                                                                       */  /* <Note>                                                                */  /*    Unlike FreeType 1.x, this function automatically creates a glyph   */  /*    slot for the face object which can be accessed directly through    */  /*    `face->glyph'.                                                     */  /*                                                                       */  /*    Note that additional slots can be added to each face with the      */  /*    FT_New_GlyphSlot() API function.  Slots are linked in a single     */  /*    list through their `next' field.                                   */  /*                                                                       */  /*    FT_Open_Face() can be used to determine and/or check the font      */  /*    format of a given font resource.  If the `face_index' field is     */  /*    negative, the function will _not_ return any face handle in        */  /*    `*face'.  Its return value should be 0 if the resource is          */  /*    recognized, or non-zero if not.                                    */  /*                                                                       */  EXPORT_FUNC  FT_Error  FT_Open_Face( FT_Library     library,                          FT_Open_Args*  args,                          FT_Long        face_index,                          FT_Face*       aface )  {    FT_Error     error;    FT_Driver    driver;    FT_Memory    memory;    FT_Stream    stream;    FT_Face      face = 0;    FT_ListNode  node = 0;    *aface = 0;    if ( !library )      return FT_Err_Invalid_Handle;    /* create input stream */    error = ft_new_input_stream( library, args, &stream );    if ( error )      goto Exit;    memory = library->memory;    /* if the font driver is specified in the `args' structure, use */    /* it.  Otherwise, we'll scan the list of registered drivers.   */    if ( args->driver )

⌨️ 快捷键说明

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