?? psaux.h
字號:
/***************************************************************************//* *//* psaux.h *//* *//* Auxiliary functions and data structures related to PostScript fonts *//* (specification). *//* *//* Copyright 1996-2001, 2002 by *//* David Turner, Robert Wilhelm, and Werner Lemberg. *//* *//* 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. *//* *//***************************************************************************/#ifndef __PSAUX_H__#define __PSAUX_H__#include <ft2build.h>#include FT_INTERNAL_OBJECTS_H#include FT_INTERNAL_TYPE1_TYPES_HFT_BEGIN_HEADER /*************************************************************************/ /*************************************************************************/ /***** *****/ /***** T1_TABLE *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ typedef struct PS_TableRec_* PS_Table; typedef const struct PS_Table_FuncsRec_* PS_Table_Funcs; /*************************************************************************/ /* */ /* <Struct> */ /* PS_Table_FuncsRec */ /* */ /* <Description> */ /* A set of function pointers to manage PS_Table objects. */ /* */ /* <Fields> */ /* table_init :: Used to initialize a table. */ /* */ /* table_done :: Finalizes resp. destroy a given table. */ /* */ /* table_add :: Adds a new object to a table. */ /* */ /* table_release :: Releases table data, then finalizes it. */ /* */ typedef struct PS_Table_FuncsRec_ { FT_Error (*init)( PS_Table table, FT_Int count, FT_Memory memory ); void (*done)( PS_Table table ); FT_Error (*add)( PS_Table table, FT_Int index, void* object, FT_Int length ); void (*release)( PS_Table table ); } PS_Table_FuncsRec; /*************************************************************************/ /* */ /* <Struct> */ /* PS_TableRec */ /* */ /* <Description> */ /* A PS_Table is a simple object used to store an array of objects in */ /* a single memory block. */ /* */ /* <Fields> */ /* block :: The address in memory of the growheap's block. This */ /* can change between two object adds, due to */ /* reallocation. */ /* */ /* cursor :: The current top of the grow heap within its block. */ /* */ /* capacity :: The current size of the heap block. Increments by */ /* 1kByte chunks. */ /* */ /* max_elems :: The maximum number of elements in table. */ /* */ /* num_elems :: The current number of elements in table. */ /* */ /* elements :: A table of element addresses within the block. */ /* */ /* lengths :: A table of element sizes within the block. */ /* */ /* memory :: The object used for memory operations */ /* (alloc/realloc). */ /* */ /* funcs :: A table of method pointers for this object. */ /* */ typedef struct PS_TableRec_ { FT_Byte* block; /* current memory block */ FT_Offset cursor; /* current cursor in memory block */ FT_Offset capacity; /* current size of memory block */ FT_Long init; FT_Int max_elems; FT_Int num_elems; FT_Byte** elements; /* addresses of table elements */ FT_Int* lengths; /* lengths of table elements */ FT_Memory memory; PS_Table_FuncsRec funcs; } PS_TableRec; /*************************************************************************/ /*************************************************************************/ /***** *****/ /***** T1 FIELDS & TOKENS *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ typedef struct PS_ParserRec_* PS_Parser; typedef struct T1_TokenRec_* T1_Token; typedef struct T1_FieldRec_* T1_Field; /* simple enumeration type used to identify token types */ typedef enum T1_TokenType_ { T1_TOKEN_TYPE_NONE = 0, T1_TOKEN_TYPE_ANY, T1_TOKEN_TYPE_STRING, T1_TOKEN_TYPE_ARRAY, /* do not remove */ T1_TOKEN_TYPE_MAX } T1_TokenType; /* a simple structure used to identify tokens */ typedef struct T1_TokenRec_ { FT_Byte* start; /* first character of token in input stream */ FT_Byte* limit; /* first character after the token */ T1_TokenType type; /* type of token */ } T1_TokenRec; /* enumeration type used to identify object fields */ typedef enum T1_FieldType_ { T1_FIELD_TYPE_NONE = 0, T1_FIELD_TYPE_BOOL, T1_FIELD_TYPE_INTEGER, T1_FIELD_TYPE_FIXED, T1_FIELD_TYPE_STRING, T1_FIELD_TYPE_BBOX, T1_FIELD_TYPE_INTEGER_ARRAY, T1_FIELD_TYPE_FIXED_ARRAY, T1_FIELD_TYPE_CALLBACK, /* do not remove */ T1_FIELD_TYPE_MAX } T1_FieldType; typedef enum T1_FieldLocation_ { T1_FIELD_LOCATION_CID_INFO, T1_FIELD_LOCATION_FONT_DICT, T1_FIELD_LOCATION_FONT_INFO, T1_FIELD_LOCATION_PRIVATE, T1_FIELD_LOCATION_BBOX, /* do not remove */ T1_FIELD_LOCATION_MAX } T1_FieldLocation; typedef void (*T1_Field_ParseFunc)( FT_Face face, FT_Pointer parser ); /* structure type used to model object fields */ typedef struct T1_FieldRec_ { const char* ident; /* field identifier */ T1_FieldLocation location; T1_FieldType type; /* type of field */ T1_Field_ParseFunc reader; FT_UInt offset; /* offset of field in object */ FT_Byte size; /* size of field in bytes */ FT_UInt array_max; /* maximal number of elements for */ /* array */ FT_UInt count_offset; /* offset of element count for */ /* arrays */ } T1_FieldRec;#define T1_NEW_SIMPLE_FIELD( _ident, _type, _fname ) \ { \ _ident, T1CODE, _type, \ 0, \ FT_FIELD_OFFSET( _fname ), \ FT_FIELD_SIZE( _fname ), \ 0, 0 \ },#define T1_NEW_CALLBACK_FIELD( _ident, _reader ) \ { \ _ident, T1CODE, T1_FIELD_TYPE_CALLBACK, \ (T1_Field_ParseFunc)_reader, \ 0, 0, \ 0, 0 \ },#define T1_NEW_TABLE_FIELD( _ident, _type, _fname, _max ) \ { \ _ident, T1CODE, _type, \ 0, \ FT_FIELD_OFFSET( _fname ), \ FT_FIELD_SIZE_DELTA( _fname ), \ _max, \ FT_FIELD_OFFSET( num_ ## _fname ) \ },#define T1_NEW_TABLE_FIELD2( _ident, _type, _fname, _max ) \ { \ _ident, T1CODE, _type, \ 0, \ FT_FIELD_OFFSET( _fname ), \ FT_FIELD_SIZE_DELTA( _fname ), \ _max, 0 \ },#define T1_FIELD_TYPE_BOOL( _ident, _fname ) \ T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BOOL, _fname )#define T1_FIELD_NUM( _ident, _fname ) \ T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER, _fname )#define T1_FIELD_FIXED( _ident, _fname ) \ T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_FIXED, _fname )#define T1_FIELD_STRING( _ident, _fname ) \ T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_STRING, _fname )#define T1_FIELD_BBOX( _ident, _fname ) \ T1_NEW_SIMPLE_FIELD( _ident, T1_FIELD_TYPE_BBOX, _fname )#define T1_FIELD_NUM_TABLE( _ident, _fname, _fmax ) \ T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, \ _fname, _fmax )#define T1_FIELD_FIXED_TABLE( _ident, _fname, _fmax ) \ T1_NEW_TABLE_FIELD( _ident, T1_FIELD_TYPE_FIXED_ARRAY, \ _fname, _fmax )#define T1_FIELD_NUM_TABLE2( _ident, _fname, _fmax ) \ T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_INTEGER_ARRAY, \ _fname, _fmax )#define T1_FIELD_FIXED_TABLE2( _ident, _fname, _fmax ) \ T1_NEW_TABLE_FIELD2( _ident, T1_FIELD_TYPE_FIXED_ARRAY, \ _fname, _fmax )#define T1_FIELD_CALLBACK( _ident, _name ) \ T1_NEW_CALLBACK_FIELD( _ident, _name ) /*************************************************************************/ /*************************************************************************/ /***** *****/ /***** T1 PARSER *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ typedef const struct PS_Parser_FuncsRec_* PS_Parser_Funcs; typedef struct PS_Parser_FuncsRec_ { void (*init)( PS_Parser parser, FT_Byte* base, FT_Byte* limit, FT_Memory memory ); void (*done)( PS_Parser parser ); void (*skip_spaces)( PS_Parser parser ); void (*skip_alpha)( PS_Parser parser ); FT_Long (*to_int)( PS_Parser parser ); FT_Fixed (*to_fixed)( PS_Parser parser, FT_Int power_ten ); FT_Int (*to_coord_array)( PS_Parser parser, FT_Int max_coords, FT_Short* coords ); FT_Int (*to_fixed_array)( PS_Parser parser, FT_Int max_values, FT_Fixed* values, FT_Int power_ten ); void (*to_token)( PS_Parser parser, T1_Token token ); void (*to_token_array)( PS_Parser parser, T1_Token tokens, FT_UInt max_tokens, FT_Int* pnum_tokens ); FT_Error (*load_field)( PS_Parser parser, const T1_Field field, void** objects, FT_UInt max_objects, FT_ULong* pflags ); FT_Error (*load_field_table)( PS_Parser parser, const T1_Field field,
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -