1
#ifndef __FT_SYSTEM_IO_H__
2
#define __FT_SYSTEM_IO_H__
4
/************************************************************************/
5
/************************************************************************/
7
/***** NOTE: THE CONTENT OF THIS FILE IS NOT CURRENTLY USED *****/
8
/***** IN NORMAL BUILDS. CONSIDER IT EXPERIMENTAL. *****/
10
/************************************************************************/
11
/************************************************************************/
14
/********************************************************************
16
* designing custom streams is a bit different now
44
#include FT_INTERNAL_OBJECT_H
48
/*@*******************************************************************
53
* handle to an input stream object. These are also @FT_Object handles
55
typedef struct FT_StreamRec_* FT_Stream;
58
/*@*******************************************************************
60
* @type: FT_Stream_Class
63
* opaque handle to a @FT_Stream_ClassRec class structure describing
64
* the methods of input streams
66
typedef const struct FT_Stream_ClassRec_* FT_Stream_Class;
69
/*@*******************************************************************
71
* @functype: FT_Stream_ReadFunc
74
* a method used to read bytes from an input stream into memory
77
* stream :: target stream handle
78
* buffer :: target buffer address
79
* size :: number of bytes to read
82
* number of bytes effectively read. Must be <= 'size'.
84
typedef FT_ULong (*FT_Stream_ReadFunc)( FT_Stream stream,
89
/*@*******************************************************************
91
* @functype: FT_Stream_SeekFunc
94
* a method used to seek to a new position within a stream
97
* stream :: target stream handle
98
* pos :: new read position, from start of stream
101
* error code. 0 means success
103
typedef FT_Error (*FT_Stream_SeekFunc)( FT_Stream stream,
107
/*@*******************************************************************
109
* @struct: FT_Stream_ClassRec
112
* a structure used to describe an input stream class
115
* clazz :: root @FT_ClassRec fields
116
* stream_read :: stream byte read method
117
* stream_seek :: stream seek method
119
typedef struct FT_Stream_ClassRec_
122
FT_Stream_ReadFunc stream_read;
123
FT_Stream_SeekFunc stream_seek;
125
} FT_Stream_ClassRec;
129
#define FT_STREAM_CLASS(x) ((FT_Stream_Class)(x))
130
#define FT_STREAM_CLASS__READ(x) FT_STREAM_CLASS(x)->stream_read
131
#define FT_STREAM_CLASS__SEEK(x) FT_STREAM_CLASS(x)->stream_seek;
133
/*@*******************************************************************
135
* @struct: FT_StreamRec
138
* the input stream object structure. See @FT_Stream_ClassRec for
139
* its class descriptor
142
* object :: root @FT_ObjectRec fields
143
* size :: size of stream in bytes (0 if unknown)
144
* pos :: current position within stream
145
* base :: for memory-based streams, the address of the stream's
146
* first data byte in memory. NULL otherwise
148
* cursor :: the current cursor position within an input stream
149
* frame. Only valid within a FT_FRAME_ENTER .. FT_FRAME_EXIT
150
* block; NULL otherwise
152
* limit :: the current frame limit within a FT_FRAME_ENTER ..
153
* FT_FRAME_EXIT block. NULL otherwise
155
typedef struct FT_StreamRec_
161
const FT_Byte* cursor;
162
const FT_Byte* limit;
166
/* some useful macros */
167
#define FT_STREAM(x) ((FT_Stream)(x))
168
#define FT_STREAM_P(x) ((FT_Stream*)(x))
170
#define FT_STREAM__READ(x) FT_STREAM_CLASS__READ(FT_OBJECT__CLASS(x))
171
#define FT_STREAM__SEEK(x) FT_STREAM_CLASS__SEEK(FT_OBJECT__CLASS(x))
173
#define FT_STREAM_IS_BASED(x) ( FT_STREAM(x)->base != NULL )
177
/* create new memory-based stream */
178
FT_BASE( FT_Error ) ft_stream_new_memory( const FT_Byte* stream_base,
179
FT_ULong stream_size,
181
FT_Stream *astream );
183
FT_BASE( FT_Error ) ft_stream_new_iso( const char* pathanme,
185
FT_Stream *astream );
188
/* handle to default stream class implementation for a given build */
189
/* this is used by "FT_New_Face" */
191
FT_APIVAR( FT_Type ) ft_stream_default_type;
195
#endif /* __FT_SYSTEM_STREAM_H__ */