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

📄 ftobjs.c

📁 Qt/Embedded是一个多平台的C++图形用户界面应用程序框架
💻 C
📖 第 1 页 / 共 5 页
字号:
  {    FT_Memory         memory;    FT_Glyph_Format*  cur   = library->glyph_formats;    FT_Glyph_Format*  limit = cur + FT_MAX_GLYPH_FORMATS;    memory = library->memory;    for ( ; cur < limit; cur++ )    {      if ( cur->format_tag == format_tag )      {        if ( cur->raster_allocated )        {          FREE( cur->raster );          cur->raster_allocated = 0;        }        cur->format_tag = 0;        return FT_Err_Ok;      }    }    return FT_Err_Invalid_Argument;  }  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    FT_New_Library                                                     */  /*                                                                       */  /* <Description>                                                         */  /*    This function is used to create a new FreeType library instance    */  /*    from a given memory object.  It is thus possible to use libraries  */  /*    with distinct memory allocators within the same program.           */  /*                                                                       */  /* <Input>                                                               */  /*    memory   :: A handle to the original memory object.                */  /*                                                                       */  /* <Output>                                                              */  /*    alibrary :: A pointer to handle of a new library object.           */  /*                                                                       */  /* <Return>                                                              */  /*    FreeType error code.  0 means success.                             */  /*                                                                       */  EXPORT_FUNC  FT_Error  FT_New_Library( FT_Memory    memory,                            FT_Library*  alibrary )  {    FT_Library library = 0;    FT_Error   error;    /* first of all, allocate the library object */    if ( ALLOC( library, sizeof ( *library ) ) )      return error;    library->memory = memory;    /* now register the default raster for the `outline' glyph image format */    {      FT_Glyph_Format  outline_format =      {        ft_glyph_format_outline,        &ft_default_raster,        0,        0      };      error = FT_Add_Glyph_Format( library, &outline_format );    }    /* That's ok now */    *alibrary = library;    return FT_Err_Ok;  }  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    FT_Done_Library                                                    */  /*                                                                       */  /* <Description>                                                         */  /*    Discards a given library object.  This closes all drivers and      */  /*    discards all resource objects.                                     */  /*                                                                       */  /* <Input>                                                               */  /*    library :: A handle to the target library                          */  /*                                                                       */  /* <Return>                                                              */  /*    FreeType error code.  0 means success.                             */  /*                                                                       */  EXPORT_FUNC  FT_Error  FT_Done_Library( FT_Library  library )  {    FT_Memory  memory;    FT_Int     n;    if ( !library )      return FT_Err_Invalid_Library_Handle;    memory = library->memory;    /* Discard client-data */    if ( library->generic.finalizer )      library->generic.finalizer( library );    /* Close all drivers in the library */    for ( n = 0; n < library->num_drivers; n++ )    {      FT_Driver  driver = library->drivers[n];      if ( driver )      {        Destroy_Driver( driver );        library->drivers[n] = 0;      }    }    /* Destroy raster object */    FREE( library->raster_pool );    {      FT_Glyph_Format*  cur   = library->glyph_formats;      FT_Glyph_Format*  limit = cur + FT_MAX_GLYPH_FORMATS;      for ( ; cur < limit; cur++ )      {        if ( cur->raster_allocated )        {          FREE( cur->raster );          cur->raster_allocated = 0;        }      }    }    FREE( library );    return FT_Err_Ok;  }  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    FT_Set_Raster_Mode                                                 */  /*                                                                       */  /* <Description>                                                         */  /*    Sets a raster-specific mode.                                       */  /*                                                                       */  /* <InOut>                                                               */  /*    library :: A handle to a target library object.                    */  /*                                                                       */  /* <Input>                                                               */  /*    format  :: The glyph format used to select the raster.             */  /*    mode    :: The raster-specific mode descriptor.                    */  /*    args    :: The mode arguments.                                     */  /*                                                                       */  /* <Return>                                                              */  /*    FreeType error code.  0 means success.                             */  /*                                                                       */  EXPORT_FUNC  FT_Error  FT_Set_Raster_Mode( FT_Library    library,                                FT_Glyph_Tag  format_tag,                                const char*   mode,                                const char*   args )  {    FT_Memory         memory;    FT_Error          error;    FT_Glyph_Format*  format = 0;    {      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 )        {          format = cur;          break;        }      }    }    if ( !format )      return FT_Err_Invalid_Argument;    memory = library->memory;    error = FT_Err_Ok;    if ( format->raster )      error = format->raster_interface->set_mode( format->raster,                                                  mode, args );    return error;  }  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    FT_Add_Driver                                                      */  /*                                                                       */  /* <Description>                                                         */  /*    Registers a new driver in a given library object.  This function   */  /*    takes only a pointer to a driver interface; it uses it to create   */  /*    the new driver, then sets up some important fields.                */  /*                                                                       */  /* <InOut>                                                               */  /*    library          :: A handle to the target library object.         */  /*                                                                       */  /* <Input>                                                               */  /*    driver_interface :: A pointer to a driver interface table.         */  /*                                                                       */  /* <Return>                                                              */  /*    FreeType error code.  0 means success.                             */  /*                                                                       */  /* <Note>                                                                */  /*    This function doesn't check whether the driver is already          */  /*    installed!                                                         */  /*                                                                       */  EXPORT_FUNC  FT_Error  FT_Add_Driver( FT_Library                 library,                           const FT_DriverInterface*  driver_interface )  {    FT_Error   error;    FT_Driver  driver;    FT_Memory  memory;    if ( !library || !driver_interface )      return FT_Err_Invalid_Library_Handle;    memory = library->memory;    error  = FT_Err_Ok;    if ( library->num_drivers >= FT_MAX_DRIVERS )      error = FT_Err_Too_Many_Drivers;    else    {      if ( ALLOC( driver, driver_interface->driver_object_size ) )        goto Exit;      driver->library   = library;      driver->memory    = memory;      driver->interface = *driver_interface;      if ( driver_interface->init_driver )      {        error = driver_interface->init_driver( driver );        if ( error )          goto Fail;      }      library->drivers[library->num_drivers++] = driver;      goto Exit;    Fail:      FREE( driver );    }  Exit:    return error;  }  /*************************************************************************/  /*                                                                       */  /* <Function>                                                            */  /*    FT_Remove_Driver                                                   */  /*                                                                       */  /* <Description>                                                         */  /*    Unregisters a given driver.  This closes the driver, which in turn */  /*    destroys all faces, sizes, slots, etc. associated with it.         */  /*                                                                       */  /*    This function also DESTROYS the driver object.                     */  /*                                                                       */  /* <Input>                                                               */  /*    driver :: A handle to target driver object.                        */  /*                                                                       */  /* <Return>                                                              */  /*    FreeType error code.  0 means success.                             */  /*                                                                       */  EXPORT_FUNC  FT_Error  FT_Remove_Driver( FT_Driver  driver )  {    FT_Library  library;    FT_Memory   memory;    FT_Driver   *cur, *last;    FT_Error    error;    if ( !driver )

⌨️ 快捷键说明

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