ReactOS 0.4.16-dev-2354-g16de117
ftccmap.c File Reference
Include dependency graph for ftccmap.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  FTC_CMapQueryRec_
 
struct  FTC_CMapNodeRec_
 

Macros

#define FT_COMPONENT   cache
 
#define FTC_CMAP_INDICES_MAX   128
 
#define FTC_CMAP_HASH(faceid, index, charcode)
 
#define FTC_CMAP_QUERY(x)   ((FTC_CMapQuery)(x))
 
#define FTC_CMAP_NODE(x)   ( (FTC_CMapNode)( x ) )
 
#define FTC_CMAP_UNKNOWN   (FT_UInt16)~0
 

Typedefs

typedef struct FTC_CMapQueryRec_ FTC_CMapQueryRec
 
typedef struct FTC_CMapQueryRec_FTC_CMapQuery
 
typedef struct FTC_CMapNodeRec_ FTC_CMapNodeRec
 
typedef struct FTC_CMapNodeRec_FTC_CMapNode
 

Functions

 ftc_cmap_node_free (FTC_Node ftcnode, FTC_Cache cache)
 
 ftc_cmap_node_new (FTC_Node *ftcanode, FT_Pointer ftcquery, FTC_Cache cache)
 
 ftc_cmap_node_weight (FTC_Node cnode, FTC_Cache cache)
 
 ftc_cmap_node_compare (FTC_Node ftcnode, FT_Pointer ftcquery, FTC_Cache cache, FT_Bool *list_changed)
 
 ftc_cmap_node_remove_faceid (FTC_Node ftcnode, FT_Pointer ftcface_id, FTC_Cache cache, FT_Bool *list_changed)
 
 FTC_CMapCache_New (FTC_Manager manager, FTC_CMapCache *acache)
 
 FTC_CMapCache_Lookup (FTC_CMapCache cmap_cache, FTC_FaceID face_id, FT_Int cmap_index, FT_UInt32 char_code)
 

Variables

static const FTC_CacheClassRec ftc_cmap_cache_class
 

Macro Definition Documentation

◆ FT_COMPONENT

#define FT_COMPONENT   cache

Definition at line 30 of file ftccmap.c.

◆ FTC_CMAP_HASH

#define FTC_CMAP_HASH (   faceid,
  index,
  charcode 
)
Value:
( FTC_FACE_ID_HASH( faceid ) + 211 * (index) + \
( (charcode) / FTC_CMAP_INDICES_MAX ) )
#define index(s, c)
Definition: various.h:29
#define FTC_FACE_ID_HASH(i)
Definition: ftccache.h:27
#define FTC_CMAP_INDICES_MAX
Definition: ftccmap.c:48

Definition at line 51 of file ftccmap.c.

◆ FTC_CMAP_INDICES_MAX

#define FTC_CMAP_INDICES_MAX   128

Definition at line 48 of file ftccmap.c.

◆ FTC_CMAP_NODE

#define FTC_CMAP_NODE (   x)    ( (FTC_CMapNode)( x ) )

Definition at line 77 of file ftccmap.c.

◆ FTC_CMAP_QUERY

#define FTC_CMAP_QUERY (   x)    ((FTC_CMapQuery)(x))

Definition at line 64 of file ftccmap.c.

◆ FTC_CMAP_UNKNOWN

#define FTC_CMAP_UNKNOWN   (FT_UInt16)~0

Definition at line 81 of file ftccmap.c.

Typedef Documentation

◆ FTC_CMapNode

◆ FTC_CMapNodeRec

◆ FTC_CMapQuery

◆ FTC_CMapQueryRec

Function Documentation

◆ ftc_cmap_node_compare()

ftc_cmap_node_compare ( FTC_Node  ftcnode,
FT_Pointer  ftcquery,
FTC_Cache  cache,
FT_Bool list_changed 
)

Definition at line 149 of file ftccmap.c.

153 {
154 FTC_CMapNode node = (FTC_CMapNode)ftcnode;
156 FT_UNUSED( cache );
157
158
159 if ( list_changed )
160 *list_changed = FALSE;
161 if ( node->face_id == query->face_id &&
162 node->cmap_index == query->cmap_index )
163 {
164 FT_UInt32 offset = (FT_UInt32)( query->char_code - node->first );
165
166
168 }
169
170 return 0;
171 }
#define FALSE
Definition: types.h:117
struct FTC_CMapQueryRec_ * FTC_CMapQuery
struct FTC_CMapNodeRec_ * FTC_CMapNode
#define FT_BOOL(x)
Definition: fttypes.h:591
GLintptr offset
Definition: glext.h:5920
#define FT_UNUSED(arg)
Definition: cache.c:49
Definition: dlist.c:348

Referenced by FTC_CMapCache_Lookup().

◆ ftc_cmap_node_free()

ftc_cmap_node_free ( FTC_Node  ftcnode,
FTC_Cache  cache 
)

Definition at line 94 of file ftccmap.c.

96 {
98 FT_Memory memory = cache->memory;
99
100
101 FT_FREE( node );
102 }
#define FT_FREE(ptr)
Definition: ftmemory.h:337
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:64
static char memory[1024 *256]
Definition: process.c:122

◆ ftc_cmap_node_new()

ftc_cmap_node_new ( FTC_Node ftcanode,
FT_Pointer  ftcquery,
FTC_Cache  cache 
)

Definition at line 107 of file ftccmap.c.

110 {
111 FTC_CMapNode *anode = (FTC_CMapNode*)ftcanode;
114 FT_Memory memory = cache->memory;
116 FT_UInt nn;
117
118
119 if ( !FT_NEW( node ) )
120 {
121 node->face_id = query->face_id;
122 node->cmap_index = query->cmap_index;
123 node->first = (query->char_code / FTC_CMAP_INDICES_MAX) *
125
126 for ( nn = 0; nn < FTC_CMAP_INDICES_MAX; nn++ )
127 node->indices[nn] = FTC_CMAP_UNKNOWN;
128 }
129
130 *anode = node;
131 return error;
132 }
#define NULL
Definition: types.h:112
#define FTC_CMAP_UNKNOWN
Definition: ftccmap.c:81
#define FT_NEW(ptr)
Definition: ftmemory.h:339
int FT_Error
Definition: fttypes.h:299
unsigned int FT_UInt
Definition: fttypes.h:231
#define error(str)
Definition: mkdosfs.c:1605

◆ ftc_cmap_node_remove_faceid()

ftc_cmap_node_remove_faceid ( FTC_Node  ftcnode,
FT_Pointer  ftcface_id,
FTC_Cache  cache,
FT_Bool list_changed 
)

Definition at line 175 of file ftccmap.c.

179 {
180 FTC_CMapNode node = (FTC_CMapNode)ftcnode;
181 FTC_FaceID face_id = (FTC_FaceID)ftcface_id;
182 FT_UNUSED( cache );
183
184
185 if ( list_changed )
186 *list_changed = FALSE;
187 return FT_BOOL( node->face_id == face_id );
188 }
FT_BEGIN_HEADER typedef FT_Pointer FTC_FaceID
Definition: ftcache.h:171

◆ ftc_cmap_node_weight()

ftc_cmap_node_weight ( FTC_Node  cnode,
FTC_Cache  cache 
)

Definition at line 137 of file ftccmap.c.

139 {
140 FT_UNUSED( cnode );
141 FT_UNUSED( cache );
142
143 return sizeof ( *cnode );
144 }

◆ FTC_CMapCache_Lookup()

FTC_CMapCache_Lookup ( FTC_CMapCache  cmap_cache,
FTC_FaceID  face_id,
FT_Int  cmap_index,
FT_UInt32  char_code 
)

Definition at line 230 of file ftccmap.c.

234 {
235 FTC_Cache cache = FTC_CACHE( cmap_cache );
239 FT_UInt gindex = 0;
241 FT_Int no_cmap_change = 0;
242
243
244 if ( cmap_index < 0 )
245 {
246 /* Treat a negative cmap index as a special value, meaning that you */
247 /* don't want to change the FT_Face's character map through this */
248 /* call. This can be useful if the face requester callback already */
249 /* sets the face's charmap to the appropriate value. */
250
251 no_cmap_change = 1;
252 cmap_index = 0;
253 }
254
255 if ( !cache )
256 {
257 FT_TRACE0(( "FTC_CMapCache_Lookup: bad arguments, returning 0\n" ));
258 return 0;
259 }
260
261 query.face_id = face_id;
262 query.cmap_index = (FT_UInt)cmap_index;
263 query.char_code = char_code;
264
265 hash = FTC_CMAP_HASH( face_id, (FT_UInt)cmap_index, char_code );
266
267#if 1
269 node, error );
270#else
271 error = FTC_Cache_Lookup( cache, hash, &query, &node );
272#endif
273 if ( error )
274 goto Exit;
275
276 FT_ASSERT( (FT_UInt)( char_code - FTC_CMAP_NODE( node )->first ) <
278
279 /* something rotten can happen with rogue clients */
280 if ( (FT_UInt)( char_code - FTC_CMAP_NODE( node )->first >=
282 return 0; /* XXX: should return appropriate error */
283
284 gindex = FTC_CMAP_NODE( node )->indices[char_code -
285 FTC_CMAP_NODE( node )->first];
286 if ( gindex == FTC_CMAP_UNKNOWN )
287 {
289
290
291 gindex = 0;
292
294 FTC_CMAP_NODE( node )->face_id,
295 &face );
296 if ( error )
297 goto Exit;
298
299 if ( (FT_UInt)cmap_index < (FT_UInt)face->num_charmaps )
300 {
301 FT_CharMap old, cmap = NULL;
302
303
304 old = face->charmap;
305 cmap = face->charmaps[cmap_index];
306
307 if ( old != cmap && !no_cmap_change )
308 FT_Set_Charmap( face, cmap );
309
310 gindex = FT_Get_Char_Index( face, char_code );
311
312 if ( old != cmap && !no_cmap_change )
313 FT_Set_Charmap( face, old );
314 }
315
316 FTC_CMAP_NODE( node )->indices[char_code -
317 FTC_CMAP_NODE( node )->first]
318 = (FT_UShort)gindex;
319 }
320
321 Exit:
322 return gindex;
323 }
WORD face[3]
Definition: mesh.c:4747
FT_Get_Char_Index(FT_Face face, FT_ULong charcode)
Definition: ftobjs.c:3731
FT_Set_Charmap(FT_Face face, FT_CharMap charmap)
Definition: ftobjs.c:3564
FTC_Manager_LookupFace(FTC_Manager manager, FTC_FaceID face_id, FT_Face *aface)
Definition: ftcmanag.c:305
#define FTC_CACHE(x)
Definition: ftccache.h:161
#define FTC_CACHE_LOOKUP_CMP(cache, nodecmp, hash, query, node, error)
Definition: ftccache.h:210
ftc_cmap_node_compare(FTC_Node ftcnode, FT_Pointer ftcquery, FTC_Cache cache, FT_Bool *list_changed)
Definition: ftccmap.c:149
#define FTC_CMAP_NODE(x)
Definition: ftccmap.c:77
#define FTC_CMAP_HASH(faceid, index, charcode)
Definition: ftccmap.c:51
#define FT_ASSERT(condition)
Definition: ftdebug.h:241
#define FT_TRACE0(varformat)
Definition: ftdebug.h:187
unsigned short FT_UShort
Definition: fttypes.h:209
size_t FT_Offset
Definition: fttypes.h:323
signed int FT_Int
Definition: fttypes.h:220
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
const GLint * first
Definition: glext.h:5794
static void Exit(void)
Definition: sock.c:1330
Definition: _hash_fun.h:40

◆ FTC_CMapCache_New()

FTC_CMapCache_New ( FTC_Manager  manager,
FTC_CMapCache acache 
)

Definition at line 218 of file ftccmap.c.

220 {
221 return FTC_Manager_RegisterCache( manager,
223 FTC_CACHE_P( acache ) );
224 }
#define FTC_CACHE_P(x)
Definition: ftccache.h:162
static const FTC_CacheClassRec ftc_cmap_cache_class
Definition: ftccmap.c:201
FTC_Manager_RegisterCache(FTC_Manager manager, FTC_CacheClass clazz, FTC_Cache *acache)
Definition: ftcmanag.c:575

Variable Documentation

◆ ftc_cmap_cache_class

const FTC_CacheClassRec ftc_cmap_cache_class
static
Initial value:
=
{
sizeof ( FTC_CacheRec ),
}
ftc_cache_init(FTC_Cache cache)
Definition: ftccache.c:334
ftc_cache_done(FTC_Cache cache)
Definition: ftccache.c:388
struct FTC_CacheRec_ FTC_CacheRec
ftc_cmap_node_free(FTC_Node ftcnode, FTC_Cache cache)
Definition: ftccmap.c:94
ftc_cmap_node_remove_faceid(FTC_Node ftcnode, FT_Pointer ftcface_id, FTC_Cache cache, FT_Bool *list_changed)
Definition: ftccmap.c:175
ftc_cmap_node_new(FTC_Node *ftcanode, FT_Pointer ftcquery, FTC_Cache cache)
Definition: ftccmap.c:107
ftc_cmap_node_weight(FTC_Node cnode, FTC_Cache cache)
Definition: ftccmap.c:137

Definition at line 201 of file ftccmap.c.

Referenced by FTC_CMapCache_New().