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

📄 ftobjs.c

📁 Qt/Embedded是一个多平台的C++图形用户界面应用程序框架
💻 C
📖 第 1 页 / 共 5 页
字号:
  /*************************************************************************/  /* destructor for sizes list */  static  void  destroy_size( FT_Memory  memory,                      FT_Size    size,                      FT_Driver  driver )  {    /* finalize format-specific stuff */    driver->interface.done_size( size );    FREE( size );  }  /* destructor for faces list */  static  void  destroy_face( FT_Memory  memory,                      FT_Face    face,                      FT_Driver  driver )  {    /* Discard glyph slots for this face                                */    /* XXX: Beware!  FT_Done_GlyphSlot() changes the field `face->slot' */    while ( face->glyph )      FT_Done_GlyphSlot( face->glyph );    /* Discard all sizes for this face */    FT_List_Finalize( &face->sizes_list,                     (FT_List_Destructor)destroy_size,                     memory,                     driver );    face->size = 0;    /* finalize format-specific stuff */    driver->interface.done_face( face );    /* Now discard client data */    if ( face->generic.finalizer )      face->generic.finalizer( face );    /* close the stream for this face */    ft_done_stream( &face->stream );        /* get rid of it */    FREE( face );  }  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    Destroy_Driver                                                     */  /*                                                                       */  /* <Description>                                                         */  /*    Destroys a given driver object.  This also destroys all child      */  /*    faces.                                                             */  /*                                                                       */  /* <InOut>                                                               */  /*     driver :: A handle to the target driver object.                   */  /*                                                                       */  /* <Note>                                                                */  /*     The driver _must_ be LOCKED!                                      */  /*                                                                       */  static  void  Destroy_Driver( FT_Driver  driver )  {    FT_Memory  memory = driver->memory;    /* now, finalize all faces in the driver list */    FT_List_Finalize( &driver->faces_list,                      (FT_List_Destructor)destroy_face,                      memory,                      driver );    /* finalize the driver object */    if ( driver->interface.done_driver )      driver->interface.done_driver( driver );    /* finalize client-data */    if ( driver->generic.finalizer )      driver->generic.finalizer( driver );    /* discard it */    FREE( driver );  }  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    FT_Get_Glyph_Format                                                */  /*                                                                       */  /* <Description>                                                         */  /*    Gets the glyph format for a given format tag.                      */  /*                                                                       */  /* <Input>                                                               */  /*    library    :: A handle to the library object.                      */  /*    format_tag :: A tag identifying the glyph format.                  */  /*                                                                       */  /* <Return>                                                              */  /*    A pointer to a glyph format.  0 if `format_tag' isn't defined.     */  /*                                                                       */  BASE_FUNC  FT_Glyph_Format*  FT_Get_Glyph_Format( FT_Library    library,                                         FT_Glyph_Tag  format_tag )  {    FT_Glyph_Format*  cur   = library->glyph_formats;    FT_Glyph_Format*  limit = cur + FT_MAX_GLYPH_FORMATS;    for ( ; cur < limit; cur ++ )    {      if ( cur->format_tag == format_tag )        return cur;    }    return 0;  }  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    FT_Set_Raster                                                      */  /*                                                                       */  /* <Description>                                                         */  /*    This function changes the raster module used to convert from a     */  /*    given memory object.  It is thus possible to use libraries with    */  /*    distinct memory allocators within the same program.                */  /*                                                                       */  /* <Input>                                                               */  /*    library   :: A handle to the library object.                       */  /*    interface :: A pointer to the interface of the new raster module.  */  /*                                                                       */  /* <Output>                                                              */  /*    raster    :: A handle to the raster object.                        */  /*                                                                       */  /* <Return>                                                              */  /*    FreeType error code.  0 means success.                             */  /*                                                                       */  EXPORT_FUNC  FT_Error  FT_Set_Raster( FT_Library            library,                           FT_Raster_Interface*  interface,                           FT_Raster             raster )  {    FT_Memory         memory = library->memory;    FT_Error          error  = FT_Err_Ok;    FT_Glyph_Format*  format;    /* allocate the render pool if necessary */    if ( !library->raster_pool &&         ALLOC( library->raster_pool, FT_RENDER_POOL_SIZE ) )      goto Exit;    /* find the glyph formatter for the raster's format */    format = FT_Get_Glyph_Format( library, interface->format_tag );    if ( !format )    {      error = FT_Err_Invalid_Argument;      goto Exit;    }    /* free previous raster object if necessary */    if ( format->raster_allocated )    {      FREE( format->raster );      format->raster_allocated = 0;    }    /* allocate new raster object is necessary */    if ( !raster )    {      if ( ALLOC( raster, interface->size ) )        goto Exit;      format->raster_allocated = 1;    }    format->raster           = raster;    format->raster_interface = interface;    /* initialize the raster object */    error = interface->init( raster,                             (char*)library->raster_pool,                             FT_RENDER_POOL_SIZE );    if ( error )    {      if ( format->raster_allocated )      {        FREE( format->raster );        format->raster_allocated = 0;      }    }  Exit:    return error;  }  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    FT_Set_Debug_Hook                                                  */  /*                                                                       */  /* <Description>                                                         */  /*    Sets a debug hook function for debugging the interpreter of a      */  /*    font format.                                                       */  /*                                                                       */  /* <Input>                                                               */  /*    library    :: A handle to the library object.                      */  /*    hook_index :: The index of the debug hook.  You should use the     */  /*                  values defined in ftobjs.h, e.g.                     */  /*                  FT_DEBUG_HOOK_TRUETYPE                               */  /*    debug_hook :: The function used to debug the interpreter.          */  /*                                                                       */  /* <Note>                                                                */  /*    Currently, four debug hook slots are available, but only two (for  */  /*    the TrueType and the Type 1 interpreter) are defined.              */  /*                                                                       */  EXPORT_FUNC  void  FT_Set_Debug_Hook( FT_Library         library,                           FT_UInt            hook_index,                           FT_DebugHook_Func  debug_hook )  {    if ( hook_index < ( sizeof ( library->debug_hooks ) / sizeof ( void* ) ) )      library->debug_hooks[hook_index] = debug_hook;  }  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    FT_Add_Glyph_Format                                                */  /*                                                                       */  /* <Description>                                                         */  /*    Adds a glyph format to the library.                                */  /*                                                                       */  /* <InOut>                                                               */  /*    library :: A handle to the library object.                         */  /*                                                                       */  /* <Input>                                                               */  /*    format  :: A pointer to the new glyph format.                      */  /*                                                                       */  /* <Return>                                                              */  /*    FreeType error code.  0 means success.                             */  /*                                                                       */  BASE_FUNC  FT_Error  FT_Add_Glyph_Format( FT_Library        library,                                 FT_Glyph_Format*  format )  {    FT_Glyph_Format*  new = 0;    {      FT_Glyph_Format*  cur   = library->glyph_formats;      FT_Glyph_Format*  limit = cur + FT_MAX_GLYPH_FORMATS;      for ( ; cur < limit; cur++ )      {        /* return an error if the format is already registered */        if ( cur->format_tag == format->format_tag )          return FT_Err_Invalid_Glyph_Format;        if ( cur->format_tag == 0 && new == 0 )          new = cur;      }    }    /* if there is no place to hold the new format, return an error */    if ( !new )      return FT_Err_Too_Many_Glyph_Formats;    *new = *format;    /* now, create a raster object if we need to */    return FT_Set_Raster( library,                          format->raster_interface,                          format->raster );  }  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    FT_Remove_Glyph_Format                                             */  /*                                                                       */  /* <Description>                                                         */  /*    Removes a glyph format from the library.                           */  /*                                                                       */  /* <InOut>                                                               */  /*    library    :: A handle to the library object.                      */  /*                                                                       */  /* <Input>                                                               */  /*    format_tag :: A tag identifying the format to be removed.          */  /*                                                                       */  /* <Return>                                                              */  /*    FreeType error code.  0 means success.                             */  /*                                                                       */  BASE_FUNC  FT_Error  FT_Remove_Glyph_Format( FT_Library    library,                                    FT_Glyph_Tag  format_tag )

⌨️ 快捷键说明

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