nuclear@0: /***************************************************************************/ nuclear@0: /* */ nuclear@0: /* ftrfork.h */ nuclear@0: /* */ nuclear@0: /* Embedded resource forks accessor (specification). */ nuclear@0: /* */ nuclear@0: /* Copyright 2004, 2006, 2007 by */ nuclear@0: /* Masatake YAMATO and Redhat K.K. */ nuclear@0: /* */ nuclear@0: /* This file is part of the FreeType project, and may only be used, */ nuclear@0: /* modified, and distributed under the terms of the FreeType project */ nuclear@0: /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ nuclear@0: /* this file you indicate that you have read the license and */ nuclear@0: /* understand and accept it fully. */ nuclear@0: /* */ nuclear@0: /***************************************************************************/ nuclear@0: nuclear@0: /***************************************************************************/ nuclear@0: /* Development of the code in this file is support of */ nuclear@0: /* Information-technology Promotion Agency, Japan. */ nuclear@0: /***************************************************************************/ nuclear@0: nuclear@0: nuclear@0: #ifndef __FTRFORK_H__ nuclear@0: #define __FTRFORK_H__ nuclear@0: nuclear@0: nuclear@0: #include nuclear@0: #include FT_INTERNAL_OBJECTS_H nuclear@0: nuclear@0: nuclear@0: FT_BEGIN_HEADER nuclear@0: nuclear@0: nuclear@0: /* Number of guessing rules supported in `FT_Raccess_Guess'. */ nuclear@0: /* Don't forget to increment the number if you add a new guessing rule. */ nuclear@0: #define FT_RACCESS_N_RULES 9 nuclear@0: nuclear@0: nuclear@0: /* A structure to describe a reference in a resource by its resource ID */ nuclear@0: /* and internal offset. The `POST' resource expects to be concatenated */ nuclear@0: /* by the order of resource IDs instead of its appearance in the file. */ nuclear@0: nuclear@0: typedef struct FT_RFork_Ref_ nuclear@0: { nuclear@0: FT_UShort res_id; nuclear@0: FT_ULong offset; nuclear@0: nuclear@0: } FT_RFork_Ref; nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* FT_Raccess_Guess */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* Guess a file name and offset where the actual resource fork is */ nuclear@0: /* stored. The macro FT_RACCESS_N_RULES holds the number of */ nuclear@0: /* guessing rules; the guessed result for the Nth rule is */ nuclear@0: /* represented as a triplet: a new file name (new_names[N]), a file */ nuclear@0: /* offset (offsets[N]), and an error code (errors[N]). */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* library :: */ nuclear@0: /* A FreeType library instance. */ nuclear@0: /* */ nuclear@0: /* stream :: */ nuclear@0: /* A file stream containing the resource fork. */ nuclear@0: /* */ nuclear@0: /* base_name :: */ nuclear@0: /* The (base) file name of the resource fork used for some */ nuclear@0: /* guessing rules. */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* new_names :: */ nuclear@0: /* An array of guessed file names in which the resource forks may */ nuclear@0: /* exist. If `new_names[N]' is NULL, the guessed file name is */ nuclear@0: /* equal to `base_name'. */ nuclear@0: /* */ nuclear@0: /* offsets :: */ nuclear@0: /* An array of guessed file offsets. `offsets[N]' holds the file */ nuclear@0: /* offset of the possible start of the resource fork in file */ nuclear@0: /* `new_names[N]'. */ nuclear@0: /* */ nuclear@0: /* errors :: */ nuclear@0: /* An array of FreeType error codes. `errors[N]' is the error */ nuclear@0: /* code of Nth guessing rule function. If `errors[N]' is not */ nuclear@0: /* FT_Err_Ok, `new_names[N]' and `offsets[N]' are meaningless. */ nuclear@0: /* */ nuclear@0: FT_BASE( void ) nuclear@0: FT_Raccess_Guess( FT_Library library, nuclear@0: FT_Stream stream, nuclear@0: char* base_name, nuclear@0: char** new_names, nuclear@0: FT_Long* offsets, nuclear@0: FT_Error* errors ); nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* FT_Raccess_Get_HeaderInfo */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* Get the information from the header of resource fork. The */ nuclear@0: /* information includes the file offset where the resource map */ nuclear@0: /* starts, and the file offset where the resource data starts. */ nuclear@0: /* `FT_Raccess_Get_DataOffsets' requires these two data. */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* library :: */ nuclear@0: /* A FreeType library instance. */ nuclear@0: /* */ nuclear@0: /* stream :: */ nuclear@0: /* A file stream containing the resource fork. */ nuclear@0: /* */ nuclear@0: /* rfork_offset :: */ nuclear@0: /* The file offset where the resource fork starts. */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* map_offset :: */ nuclear@0: /* The file offset where the resource map starts. */ nuclear@0: /* */ nuclear@0: /* rdata_pos :: */ nuclear@0: /* The file offset where the resource data starts. */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* FreeType error code. FT_Err_Ok means success. */ nuclear@0: /* */ nuclear@0: FT_BASE( FT_Error ) nuclear@0: FT_Raccess_Get_HeaderInfo( FT_Library library, nuclear@0: FT_Stream stream, nuclear@0: FT_Long rfork_offset, nuclear@0: FT_Long *map_offset, nuclear@0: FT_Long *rdata_pos ); nuclear@0: nuclear@0: nuclear@0: /*************************************************************************/ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* FT_Raccess_Get_DataOffsets */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* Get the data offsets for a tag in a resource fork. Offsets are */ nuclear@0: /* stored in an array because, in some cases, resources in a resource */ nuclear@0: /* fork have the same tag. */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* library :: */ nuclear@0: /* A FreeType library instance. */ nuclear@0: /* */ nuclear@0: /* stream :: */ nuclear@0: /* A file stream containing the resource fork. */ nuclear@0: /* */ nuclear@0: /* map_offset :: */ nuclear@0: /* The file offset where the resource map starts. */ nuclear@0: /* */ nuclear@0: /* rdata_pos :: */ nuclear@0: /* The file offset where the resource data starts. */ nuclear@0: /* */ nuclear@0: /* tag :: */ nuclear@0: /* The resource tag. */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* offsets :: */ nuclear@0: /* The stream offsets for the resource data specified by `tag'. */ nuclear@0: /* This array is allocated by the function, so you have to call */ nuclear@0: /* @ft_mem_free after use. */ nuclear@0: /* */ nuclear@0: /* count :: */ nuclear@0: /* The length of offsets array. */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* FreeType error code. FT_Err_Ok means success. */ nuclear@0: /* */ nuclear@0: /* */ nuclear@0: /* Normally you should use `FT_Raccess_Get_HeaderInfo' to get the */ nuclear@0: /* value for `map_offset' and `rdata_pos'. */ nuclear@0: /* */ nuclear@0: FT_BASE( FT_Error ) nuclear@0: FT_Raccess_Get_DataOffsets( FT_Library library, nuclear@0: FT_Stream stream, nuclear@0: FT_Long map_offset, nuclear@0: FT_Long rdata_pos, nuclear@0: FT_Long tag, nuclear@0: FT_Long **offsets, nuclear@0: FT_Long *count ); nuclear@0: nuclear@0: nuclear@0: FT_END_HEADER nuclear@0: nuclear@0: #endif /* __FTRFORK_H__ */ nuclear@0: nuclear@0: nuclear@0: /* END */