freetype2/include/freetype/ftmodule.h

308 lines
17 KiB
C
Raw Normal View History

/***************************************************************************/
/* */
/* ftmodule.h */
/* */
/* FreeType modules public interface (specification). */
/* */
/* Copyright 1996-2001 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
2000-07-10 23:41:32 +02:00
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
/* this file you indicate that you have read the license and */
/* understand and accept it fully. */
/* */
/***************************************************************************/
2000-07-10 23:41:32 +02:00
#ifndef __FTMODULE_H__
#define __FTMODULE_H__
#include <ft2build.h>
#include FT_FREETYPE_H
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* module_management */
/* */
/* <Title> */
/* Module Management */
/* */
/* <Abstract> */
/* How to add, upgrade, and remove modules from FreeType. */
/* */
/* <Description> */
/* The definitions below are used to manage modules within FreeType. */
/* Modules can be added, upgraded, and removed at runtime. */
/* */
/*************************************************************************/
/* module bit flags */
2000-07-10 23:41:32 +02:00
typedef enum FT_Module_Flags_
{
2000-07-10 23:41:32 +02:00
ft_module_font_driver = 1, /* this module is a font driver */
ft_module_renderer = 2, /* this module is a renderer */
ft_module_hinter = 4, /* this module is a glyph hinter */
ft_module_styler = 8, /* this module is a styler */
ft_module_driver_scalable = 0x100, /* the driver supports scalable */
/* fonts */
ft_module_driver_no_outlines = 0x200, /* the driver does not support */
/* vector outlines */
ft_module_driver_has_hinter = 0x400 /* the driver provides its own */
/* hinter */
} FT_Module_Flags;
2001-06-28 09:17:51 +02:00
typedef void
(*FT_Module_Interface)( void );
2001-06-28 09:17:51 +02:00
typedef FT_Error
(*FT_Module_Constructor)( FT_Module module );
2001-06-28 09:17:51 +02:00
typedef void
(*FT_Module_Destructor)( FT_Module module );
2001-06-28 09:17:51 +02:00
typedef FT_Module_Interface
(*FT_Module_Requester)( FT_Module module,
const char* name );
2000-07-10 23:41:32 +02:00
/*************************************************************************/
/* */
/* <Struct> */
/* FT_Module_Class */
/* */
/* <Description> */
/* The module class descriptor. */
/* */
/* <Fields> */
/* module_flags :: Bit flags describing the module. */
/* */
/* module_size :: The size of one module object/instance in */
/* bytes. */
/* */
/* module_name :: The name of the module. */
/* */
/* module_version :: The version, as a 16.16 fixed number */
/* (major.minor). */
/* */
/* module_requires :: The version of FreeType this module requires */
/* (starts at version 2.0, i.e 0x20000) */
/* */
/* module_init :: A function used to initialize (not create) a */
/* new module object. */
/* */
/* module_done :: A function used to finalize (not destroy) a */
/* given module object */
/* */
/* get_interface :: Queries a given module for a specific */
/* interface by name. */
/* */
typedef struct FT_Module_Class_
{
FT_ULong module_flags;
* src/sfnt/ttpost.c (load_post_names, tt_face_free_ps_names, tt_face_get_ps_name): Replace switch statement with if clauses to make it more portable. * src/cff/cffobjs.c (cff_face_init): Ditto. * include/freetype/ftmodule.h (FT_Module_Class): Use `FT_Long' for `module_size'. * include/freetype/ftrender.h (FT_Glyph_Class_): Use `FT_Long' for `glyph_size'. * src/base/ftobjs.c (FT_Render_Glyph): Change second parameter to `FT_Render_Mode'. (FT_Render_Glyph_Internal): Change third parameter to `FT_Render_Mode'. * src/base/ftglyph.c (FT_Glyph_To_Bitmap): Change second parameter to `FT_Render_Mode'. * src/raster/ftrend1.c (ft_raster1_render): Change third parameter to `FT_Render_Mode'. * src/smooth/ftsmooth.c (ft_smooth_render, ft_smooth_render_lcd, ft_smooth_render_lcd_v): Ditto. (ft_smooth_render_generic): Change third and fifth parameter to `FT_Render_Mode'. * include/freetype/freetype.h, include/freetype/internal/ftobjs.h, include/freetype/ftglyph.h: Updated. * src/cff/cffdrivr.c (Load_Glyph), src/pcf/pcfdriver.c (PCF_Glyph_Load), src/pfr/pfrobjs.c (pfr_slot_load), src/winfonts/winfnt.c (FNT_Load_Glyph), src/t42/t42objs.c (T42_GlyphSlot_Load), src/bdf/bdfdrivr.c (BDF_Glyph_Load): Change fourth parameter to `FT_Int32'. * src/pfr/pfrobjs.c (pfr_face_init): Add two missing parameters and declare them as unused. * src/cid/cidparse.h (CID_Parser): Use FT_Long for `postscript_len'. * src/psnames/psnames.h (PS_Unicode_Value_Func): Change return value to FT_UInt32. * src/psnames/psmodule.c (ps_unicode_value, ps_build_unicode_table): Updated accordingly. * src/cff/cffdrivr.c (Get_Kerning): Use FT_Long for `middle'. (cff_get_glyph_name): Use cast for result of ft_strlen. * src/cff/cffparse.c (cff_parse_real): User cast for assigning `exp'. * src/cff/cffload.c (cff_index_get_pointers): Use FT_ULong for some local variables. (cff_charset_load, cff_encoding_load): Use casts to FT_UInt for some switch statements. (cff_font_load): Use cast in call to CFF_Load_FD_Select. * src/cff/cffobjs.c (cff_size_init): Use more casts. (cff_face_init): Use FT_Int32 for `flags'. * src/cff/cffgload.c (cff_operator_seac): Use cast for assigning `adx' and `ady'. (cff_decoder_parse_charstrings): Use FT_ULong for third parameter. Use more casts. * src/cff/cffcmap.c (cff_cmap_unicode_init): Use cast for `count'. * src/cid/cidload.c (cid_read_subrs): Use FT_ULong for `len'. * src/cid/cidgload.c (cid_load_glyph): Add missing cast for `cid_get_offset'. * src/psaux/t1decode.c (t1_decoder_parse_charstrings) <18>: Use cast for `num_points'. (t1_decoder_init): Use cast for assigning `decoder->num_glyphs'. * src/base/ftdebug.c (ft_debug_init): Use FT_Int. * include/freetype/internal/ftdriver.h (FT_Slot_LoadFunc): Use `FT_Int32' for fourth parameter. * src/base/ftobjs.c (open_face): Use cast for calling clazz->init_face. * src/raster/ftraster.c (Set_High_Precision): Use `1' instead of `1L'. (Finalize_Profile_Table, Line_Up, ft_black_init): Use casts. * src/raster/ftrend1.c (ft_raster1_render): Ditto. * src/sfnt/sfnt_dir_check: Compare `magic' with unsigned long constant. * builds/amiga/include/freetype/config/ftmodule.h: Updated.
2002-09-27 13:09:23 +02:00
FT_Long module_size;
const FT_String* module_name;
FT_Fixed module_version;
FT_Fixed module_requires;
const void* module_interface;
FT_Module_Constructor module_init;
FT_Module_Destructor module_done;
FT_Module_Requester get_interface;
} FT_Module_Class;
2000-07-10 23:41:32 +02:00
/*************************************************************************/
/* */
/* <Function> */
/* FT_Add_Module */
/* */
/* <Description> */
/* Adds a new module to a given library instance. */
/* */
/* <InOut> */
2000-07-10 23:41:32 +02:00
/* library :: A handle to the library object. */
/* */
/* <Input> */
2000-07-10 23:41:32 +02:00
/* clazz :: A pointer to class descriptor for the module. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* An error will be returned if a module already exists by that name, */
/* or if the module requires a version of FreeType that is too great. */
/* */
2001-06-28 09:17:51 +02:00
FT_EXPORT( FT_Error )
FT_Add_Module( FT_Library library,
const FT_Module_Class* clazz );
2000-07-10 23:41:32 +02:00
/*************************************************************************/
/* */
/* <Function> */
/* FT_Get_Module */
/* */
/* <Description> */
/* Finds a module by its name. */
/* */
/* <Input> */
/* library :: A handle to the library object. */
/* */
/* module_name :: The module's name (as an ASCII string). */
/* */
/* <Return> */
/* A module handle. 0 if none was found. */
/* */
/* <Note> */
/* You should better be familiar with FreeType internals to know */
/* which module to look for :-) */
/* */
2001-06-28 09:17:51 +02:00
FT_EXPORT( FT_Module )
FT_Get_Module( FT_Library library,
const char* module_name );
2000-07-10 23:41:32 +02:00
/*************************************************************************/
/* */
/* <Function> */
/* FT_Remove_Module */
/* */
/* <Description> */
/* Removes a given module from a library instance. */
/* */
/* <InOut> */
2000-07-10 23:41:32 +02:00
/* library :: A handle to a library object. */
/* */
/* <Input> */
2000-07-10 23:41:32 +02:00
/* module :: A handle to a module object. */
/* */
/* <Return> */
/* FreeType error code. 0 means success. */
/* */
/* <Note> */
/* The module object is destroyed by the function in case of success. */
/* */
2001-06-28 09:17:51 +02:00
FT_EXPORT( FT_Error )
FT_Remove_Module( FT_Library library,
FT_Module module );
2000-07-10 23:41:32 +02:00
/*************************************************************************/
/* */
/* <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. */
/* */
2001-06-28 09:17:51 +02:00
FT_EXPORT( FT_Error )
FT_New_Library( FT_Memory memory,
FT_Library *alibrary );
2000-07-10 23:41:32 +02:00
/*************************************************************************/
/* */
/* <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. */
/* */
2001-06-28 09:17:51 +02:00
FT_EXPORT( FT_Error )
FT_Done_Library( FT_Library library );
2000-07-10 23:41:32 +02:00
2001-06-28 09:17:51 +02:00
typedef void
(*FT_DebugHook_Func)( void* arg );
2000-07-10 23:41:32 +02:00
/*************************************************************************/
/* */
/* <Function> */
/* FT_Set_Debug_Hook */
/* */
/* <Description> */
/* Sets a debug hook function for debugging the interpreter of a font */
/* format. */
/* */
/* <InOut> */
2000-07-10 23:41:32 +02:00
/* library :: A handle to the library object. */
/* */
/* <Input> */
2000-07-10 23:41:32 +02:00
/* hook_index :: The index of the debug hook. You should use the */
/* values defined in ftobjs.h, e.g. */
/* FT_DEBUG_HOOK_TRUETYPE. */
2000-07-10 23:41:32 +02:00
/* */
/* 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. */
/* */
2001-06-28 09:17:51 +02:00
FT_EXPORT( void )
FT_Set_Debug_Hook( FT_Library library,
FT_UInt hook_index,
FT_DebugHook_Func debug_hook );
/*************************************************************************/
/* */
/* <Function> */
/* FT_Add_Default_Modules */
/* */
/* <Description> */
2000-07-10 23:41:32 +02:00
/* Adds the set of default drivers to a given library object. */
/* This is only useful when you create a library object with */
2000-07-10 23:41:32 +02:00
/* FT_New_Library() (usually to plug a custom memory manager). */
/* */
2000-07-10 23:41:32 +02:00
/* <InOut> */
/* library :: A handle to a new library object. */
/* */
2001-06-28 09:17:51 +02:00
FT_EXPORT( void )
FT_Add_Default_Modules( FT_Library library );
/* */
FT_END_HEADER
#endif /* __FTMODULE_H__ */
/* END */