ReactOS 0.4.16-dev-336-gb667d82
ftccmap.c File Reference
#include <ft2build.h>
#include "ftcmanag.h"
#include "ftccback.h"
#include "ftcerror.h"
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   trace_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   trace_cache

Definition at line 31 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:49

Definition at line 52 of file ftccmap.c.

◆ FTC_CMAP_INDICES_MAX

#define FTC_CMAP_INDICES_MAX   128

Definition at line 49 of file ftccmap.c.

◆ FTC_CMAP_NODE

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

Definition at line 78 of file ftccmap.c.

◆ FTC_CMAP_QUERY

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

Definition at line 65 of file ftccmap.c.

◆ FTC_CMAP_UNKNOWN

#define FTC_CMAP_UNKNOWN   (FT_UInt16)~0

Definition at line 82 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 150 of file ftccmap.c.

154 {
155 FTC_CMapNode node = (FTC_CMapNode)ftcnode;
157 FT_UNUSED( cache );
158
159
160 if ( list_changed )
161 *list_changed = FALSE;
162 if ( node->face_id == query->face_id &&
163 node->cmap_index == query->cmap_index )
164 {
165 FT_UInt32 offset = (FT_UInt32)( query->char_code - node->first );
166
167
169 }
170
171 return 0;
172 }
#define FALSE
Definition: types.h:117
struct FTC_CMapQueryRec_ * FTC_CMapQuery
struct FTC_CMapNodeRec_ * FTC_CMapNode
#define FT_UNUSED(arg)
Definition: ftconfig.h:101
#define FT_BOOL(x)
Definition: fttypes.h:578
GLintptr offset
Definition: glext.h:5920
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 95 of file ftccmap.c.

97 {
99 FT_Memory memory = cache->memory;
100
101
102 FT_FREE( node );
103 }
#define FT_FREE(ptr)
Definition: ftmemory.h:329
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
static char memory[1024 *256]
Definition: process.c:116

◆ ftc_cmap_node_new()

ftc_cmap_node_new ( FTC_Node ftcanode,
FT_Pointer  ftcquery,
FTC_Cache  cache 
)

Definition at line 108 of file ftccmap.c.

111 {
112 FTC_CMapNode *anode = (FTC_CMapNode*)ftcanode;
115 FT_Memory memory = cache->memory;
117 FT_UInt nn;
118
119
120 if ( !FT_NEW( node ) )
121 {
122 node->face_id = query->face_id;
123 node->cmap_index = query->cmap_index;
124 node->first = (query->char_code / FTC_CMAP_INDICES_MAX) *
126
127 for ( nn = 0; nn < FTC_CMAP_INDICES_MAX; nn++ )
128 node->indices[nn] = FTC_CMAP_UNKNOWN;
129 }
130
131 *anode = node;
132 return error;
133 }
#define NULL
Definition: types.h:112
#define FTC_CMAP_UNKNOWN
Definition: ftccmap.c:82
#define FT_NEW(ptr)
Definition: ftmemory.h:331
int FT_Error
Definition: fttypes.h:300
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 176 of file ftccmap.c.

180 {
181 FTC_CMapNode node = (FTC_CMapNode)ftcnode;
182 FTC_FaceID face_id = (FTC_FaceID)ftcface_id;
183 FT_UNUSED( cache );
184
185
186 if ( list_changed )
187 *list_changed = FALSE;
188 return FT_BOOL( node->face_id == face_id );
189 }
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 138 of file ftccmap.c.

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

◆ 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 231 of file ftccmap.c.

235 {
236 FTC_Cache cache = FTC_CACHE( cmap_cache );
240 FT_UInt gindex = 0;
242 FT_Int no_cmap_change = 0;
243
244
245 if ( cmap_index < 0 )
246 {
247 /* Treat a negative cmap index as a special value, meaning that you */
248 /* don't want to change the FT_Face's character map through this */
249 /* call. This can be useful if the face requester callback already */
250 /* sets the face's charmap to the appropriate value. */
251
252 no_cmap_change = 1;
253 cmap_index = 0;
254 }
255
256 if ( !cache )
257 {
258 FT_TRACE0(( "FTC_CMapCache_Lookup: bad arguments, returning 0\n" ));
259 return 0;
260 }
261
262 query.face_id = face_id;
263 query.cmap_index = (FT_UInt)cmap_index;
264 query.char_code = char_code;
265
266 hash = FTC_CMAP_HASH( face_id, (FT_UInt)cmap_index, char_code );
267
268#if 1
270 node, error );
271#else
272 error = FTC_Cache_Lookup( cache, hash, &query, &node );
273#endif
274 if ( error )
275 goto Exit;
276
277 FT_ASSERT( (FT_UInt)( char_code - FTC_CMAP_NODE( node )->first ) <
279
280 /* something rotten can happen with rogue clients */
281 if ( (FT_UInt)( char_code - FTC_CMAP_NODE( node )->first >=
283 return 0; /* XXX: should return appropriate error */
284
285 gindex = FTC_CMAP_NODE( node )->indices[char_code -
286 FTC_CMAP_NODE( node )->first];
287 if ( gindex == FTC_CMAP_UNKNOWN )
288 {
290
291
292 gindex = 0;
293
295 FTC_CMAP_NODE( node )->face_id,
296 &face );
297 if ( error )
298 goto Exit;
299
300 if ( (FT_UInt)cmap_index < (FT_UInt)face->num_charmaps )
301 {
302 FT_CharMap old, cmap = NULL;
303
304
305 old = face->charmap;
306 cmap = face->charmaps[cmap_index];
307
308 if ( old != cmap && !no_cmap_change )
309 FT_Set_Charmap( face, cmap );
310
311 gindex = FT_Get_Char_Index( face, char_code );
312
313 if ( old != cmap && !no_cmap_change )
314 FT_Set_Charmap( face, old );
315 }
316
317 FTC_CMAP_NODE( node )->indices[char_code -
318 FTC_CMAP_NODE( node )->first]
319 = (FT_UShort)gindex;
320 }
321
322 Exit:
323 return gindex;
324 }
WORD face[3]
Definition: mesh.c:4747
FT_Get_Char_Index(FT_Face face, FT_ULong charcode)
Definition: ftobjs.c:3668
FT_Set_Charmap(FT_Face face, FT_CharMap charmap)
Definition: ftobjs.c:3499
FTC_Manager_LookupFace(FTC_Manager manager, FTC_FaceID face_id, FT_Face *aface)
Definition: ftcmanag.c:310
#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:150
#define FTC_CMAP_NODE(x)
Definition: ftccmap.c:78
#define FTC_CMAP_HASH(faceid, index, charcode)
Definition: ftccmap.c:52
#define FT_ASSERT(condition)
Definition: ftdebug.h:211
#define FT_TRACE0(varformat)
Definition: ftdebug.h:157
unsigned short FT_UShort
Definition: fttypes.h:209
size_t FT_Offset
Definition: fttypes.h:324
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 219 of file ftccmap.c.

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

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:335
ftc_cache_done(FTC_Cache cache)
Definition: ftccache.c:389
struct FTC_CacheRec_ FTC_CacheRec
ftc_cmap_node_free(FTC_Node ftcnode, FTC_Cache cache)
Definition: ftccmap.c:95
ftc_cmap_node_remove_faceid(FTC_Node ftcnode, FT_Pointer ftcface_id, FTC_Cache cache, FT_Bool *list_changed)
Definition: ftccmap.c:176
ftc_cmap_node_new(FTC_Node *ftcanode, FT_Pointer ftcquery, FTC_Cache cache)
Definition: ftccmap.c:108
ftc_cmap_node_weight(FTC_Node cnode, FTC_Cache cache)
Definition: ftccmap.c:138

Definition at line 202 of file ftccmap.c.

Referenced by FTC_CMapCache_New().