|
|
|||
Warning, file /include/freetype2/freetype/ftsystem.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /**************************************************************************** 0002 * 0003 * ftsystem.h 0004 * 0005 * FreeType low-level system interface definition (specification). 0006 * 0007 * Copyright (C) 1996-2023 by 0008 * David Turner, Robert Wilhelm, and Werner Lemberg. 0009 * 0010 * This file is part of the FreeType project, and may only be used, 0011 * modified, and distributed under the terms of the FreeType project 0012 * license, LICENSE.TXT. By continuing to use, modify, or distribute 0013 * this file you indicate that you have read the license and 0014 * understand and accept it fully. 0015 * 0016 */ 0017 0018 0019 #ifndef FTSYSTEM_H_ 0020 #define FTSYSTEM_H_ 0021 0022 0023 0024 0025 FT_BEGIN_HEADER 0026 0027 0028 /************************************************************************** 0029 * 0030 * @section: 0031 * system_interface 0032 * 0033 * @title: 0034 * System Interface 0035 * 0036 * @abstract: 0037 * How FreeType manages memory and i/o. 0038 * 0039 * @description: 0040 * This section contains various definitions related to memory management 0041 * and i/o access. You need to understand this information if you want to 0042 * use a custom memory manager or you own i/o streams. 0043 * 0044 */ 0045 0046 0047 /************************************************************************** 0048 * 0049 * M E M O R Y M A N A G E M E N T 0050 * 0051 */ 0052 0053 0054 /************************************************************************** 0055 * 0056 * @type: 0057 * FT_Memory 0058 * 0059 * @description: 0060 * A handle to a given memory manager object, defined with an 0061 * @FT_MemoryRec structure. 0062 * 0063 */ 0064 typedef struct FT_MemoryRec_* FT_Memory; 0065 0066 0067 /************************************************************************** 0068 * 0069 * @functype: 0070 * FT_Alloc_Func 0071 * 0072 * @description: 0073 * A function used to allocate `size` bytes from `memory`. 0074 * 0075 * @input: 0076 * memory :: 0077 * A handle to the source memory manager. 0078 * 0079 * size :: 0080 * The size in bytes to allocate. 0081 * 0082 * @return: 0083 * Address of new memory block. 0~in case of failure. 0084 * 0085 */ 0086 typedef void* 0087 (*FT_Alloc_Func)( FT_Memory memory, 0088 long size ); 0089 0090 0091 /************************************************************************** 0092 * 0093 * @functype: 0094 * FT_Free_Func 0095 * 0096 * @description: 0097 * A function used to release a given block of memory. 0098 * 0099 * @input: 0100 * memory :: 0101 * A handle to the source memory manager. 0102 * 0103 * block :: 0104 * The address of the target memory block. 0105 * 0106 */ 0107 typedef void 0108 (*FT_Free_Func)( FT_Memory memory, 0109 void* block ); 0110 0111 0112 /************************************************************************** 0113 * 0114 * @functype: 0115 * FT_Realloc_Func 0116 * 0117 * @description: 0118 * A function used to re-allocate a given block of memory. 0119 * 0120 * @input: 0121 * memory :: 0122 * A handle to the source memory manager. 0123 * 0124 * cur_size :: 0125 * The block's current size in bytes. 0126 * 0127 * new_size :: 0128 * The block's requested new size. 0129 * 0130 * block :: 0131 * The block's current address. 0132 * 0133 * @return: 0134 * New block address. 0~in case of memory shortage. 0135 * 0136 * @note: 0137 * In case of error, the old block must still be available. 0138 * 0139 */ 0140 typedef void* 0141 (*FT_Realloc_Func)( FT_Memory memory, 0142 long cur_size, 0143 long new_size, 0144 void* block ); 0145 0146 0147 /************************************************************************** 0148 * 0149 * @struct: 0150 * FT_MemoryRec 0151 * 0152 * @description: 0153 * A structure used to describe a given memory manager to FreeType~2. 0154 * 0155 * @fields: 0156 * user :: 0157 * A generic typeless pointer for user data. 0158 * 0159 * alloc :: 0160 * A pointer type to an allocation function. 0161 * 0162 * free :: 0163 * A pointer type to an memory freeing function. 0164 * 0165 * realloc :: 0166 * A pointer type to a reallocation function. 0167 * 0168 */ 0169 struct FT_MemoryRec_ 0170 { 0171 void* user; 0172 FT_Alloc_Func alloc; 0173 FT_Free_Func free; 0174 FT_Realloc_Func realloc; 0175 }; 0176 0177 0178 /************************************************************************** 0179 * 0180 * I / O M A N A G E M E N T 0181 * 0182 */ 0183 0184 0185 /************************************************************************** 0186 * 0187 * @type: 0188 * FT_Stream 0189 * 0190 * @description: 0191 * A handle to an input stream. 0192 * 0193 * @also: 0194 * See @FT_StreamRec for the publicly accessible fields of a given stream 0195 * object. 0196 * 0197 */ 0198 typedef struct FT_StreamRec_* FT_Stream; 0199 0200 0201 /************************************************************************** 0202 * 0203 * @struct: 0204 * FT_StreamDesc 0205 * 0206 * @description: 0207 * A union type used to store either a long or a pointer. This is used 0208 * to store a file descriptor or a `FILE*` in an input stream. 0209 * 0210 */ 0211 typedef union FT_StreamDesc_ 0212 { 0213 long value; 0214 void* pointer; 0215 0216 } FT_StreamDesc; 0217 0218 0219 /************************************************************************** 0220 * 0221 * @functype: 0222 * FT_Stream_IoFunc 0223 * 0224 * @description: 0225 * A function used to seek and read data from a given input stream. 0226 * 0227 * @input: 0228 * stream :: 0229 * A handle to the source stream. 0230 * 0231 * offset :: 0232 * The offset from the start of the stream to seek to. 0233 * 0234 * buffer :: 0235 * The address of the read buffer. 0236 * 0237 * count :: 0238 * The number of bytes to read from the stream. 0239 * 0240 * @return: 0241 * If count >~0, return the number of bytes effectively read by the 0242 * stream (after seeking to `offset`). If count ==~0, return the status 0243 * of the seek operation (non-zero indicates an error). 0244 * 0245 */ 0246 typedef unsigned long 0247 (*FT_Stream_IoFunc)( FT_Stream stream, 0248 unsigned long offset, 0249 unsigned char* buffer, 0250 unsigned long count ); 0251 0252 0253 /************************************************************************** 0254 * 0255 * @functype: 0256 * FT_Stream_CloseFunc 0257 * 0258 * @description: 0259 * A function used to close a given input stream. 0260 * 0261 * @input: 0262 * stream :: 0263 * A handle to the target stream. 0264 * 0265 */ 0266 typedef void 0267 (*FT_Stream_CloseFunc)( FT_Stream stream ); 0268 0269 0270 /************************************************************************** 0271 * 0272 * @struct: 0273 * FT_StreamRec 0274 * 0275 * @description: 0276 * A structure used to describe an input stream. 0277 * 0278 * @input: 0279 * base :: 0280 * For memory-based streams, this is the address of the first stream 0281 * byte in memory. This field should always be set to `NULL` for 0282 * disk-based streams. 0283 * 0284 * size :: 0285 * The stream size in bytes. 0286 * 0287 * In case of compressed streams where the size is unknown before 0288 * actually doing the decompression, the value is set to 0x7FFFFFFF. 0289 * (Note that this size value can occur for normal streams also; it is 0290 * thus just a hint.) 0291 * 0292 * pos :: 0293 * The current position within the stream. 0294 * 0295 * descriptor :: 0296 * This field is a union that can hold an integer or a pointer. It is 0297 * used by stream implementations to store file descriptors or `FILE*` 0298 * pointers. 0299 * 0300 * pathname :: 0301 * This field is completely ignored by FreeType. However, it is often 0302 * useful during debugging to use it to store the stream's filename 0303 * (where available). 0304 * 0305 * read :: 0306 * The stream's input function. 0307 * 0308 * close :: 0309 * The stream's close function. 0310 * 0311 * memory :: 0312 * The memory manager to use to preload frames. This is set internally 0313 * by FreeType and shouldn't be touched by stream implementations. 0314 * 0315 * cursor :: 0316 * This field is set and used internally by FreeType when parsing 0317 * frames. In particular, the `FT_GET_XXX` macros use this instead of 0318 * the `pos` field. 0319 * 0320 * limit :: 0321 * This field is set and used internally by FreeType when parsing 0322 * frames. 0323 * 0324 */ 0325 typedef struct FT_StreamRec_ 0326 { 0327 unsigned char* base; 0328 unsigned long size; 0329 unsigned long pos; 0330 0331 FT_StreamDesc descriptor; 0332 FT_StreamDesc pathname; 0333 FT_Stream_IoFunc read; 0334 FT_Stream_CloseFunc close; 0335 0336 FT_Memory memory; 0337 unsigned char* cursor; 0338 unsigned char* limit; 0339 0340 } FT_StreamRec; 0341 0342 /* */ 0343 0344 0345 FT_END_HEADER 0346 0347 #endif /* FTSYSTEM_H_ */ 0348 0349 0350 /* END */
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|