ReactOS  0.4.15-dev-3456-g4a17d4b
t1cmap.c File Reference
#include "t1cmap.h"
#include "psauxerr.h"
Include dependency graph for t1cmap.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

static void t1_cmap_std_init (T1_CMapStd cmap, FT_Int is_expert)
 
 t1_cmap_std_done (T1_CMapStd cmap)
 
 t1_cmap_std_char_index (T1_CMapStd cmap, FT_UInt32 char_code)
 
 t1_cmap_std_char_next (T1_CMapStd cmap, FT_UInt32 *pchar_code)
 
 t1_cmap_standard_init (T1_CMapStd cmap, FT_Pointer pointer)
 
 t1_cmap_expert_init (T1_CMapStd cmap, FT_Pointer pointer)
 
 t1_cmap_custom_init (T1_CMapCustom cmap, FT_Pointer pointer)
 
 t1_cmap_custom_done (T1_CMapCustom cmap)
 
 t1_cmap_custom_char_index (T1_CMapCustom cmap, FT_UInt32 char_code)
 
 t1_cmap_custom_char_next (T1_CMapCustom cmap, FT_UInt32 *pchar_code)
 
 psaux_get_glyph_name (T1_Face face, FT_UInt idx)
 
 t1_cmap_unicode_init (PS_Unicodes unicodes, FT_Pointer pointer)
 
 t1_cmap_unicode_done (PS_Unicodes unicodes)
 
 t1_cmap_unicode_char_index (PS_Unicodes unicodes, FT_UInt32 char_code)
 
 t1_cmap_unicode_char_next (PS_Unicodes unicodes, FT_UInt32 *pchar_code)
 

Variables

FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec t1_cmap_standard_class_rec
 
FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec t1_cmap_expert_class_rec
 
FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec t1_cmap_custom_class_rec
 
FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec t1_cmap_unicode_class_rec
 

Function Documentation

◆ psaux_get_glyph_name()

psaux_get_glyph_name ( T1_Face  face,
FT_UInt  idx 
)

Definition at line 290 of file t1cmap.c.

292  {
293  return face->type1.glyph_names[idx];
294  }
unsigned int idx
Definition: utils.c:41
GLenum GLuint GLint GLenum face
Definition: glext.h:7025

Referenced by t1_cmap_unicode_init().

◆ t1_cmap_custom_char_index()

t1_cmap_custom_char_index ( T1_CMapCustom  cmap,
FT_UInt32  char_code 
)

Definition at line 221 of file t1cmap.c.

223  {
224  FT_UInt result = 0;
225 
226 
227  if ( ( char_code >= cmap->first ) &&
228  ( char_code < ( cmap->first + cmap->count ) ) )
229  result = cmap->indices[char_code];
230 
231  return result;
232  }
GLuint64EXT * result
Definition: glext.h:11304
FT_UInt count
Definition: t1cmap.h:74
FT_UShort * indices
Definition: t1cmap.h:75
FT_UInt first
Definition: t1cmap.h:73
unsigned int FT_UInt
Definition: fttypes.h:231

◆ t1_cmap_custom_char_next()

t1_cmap_custom_char_next ( T1_CMapCustom  cmap,
FT_UInt32 *  pchar_code 
)

Definition at line 236 of file t1cmap.c.

238  {
239  FT_UInt result = 0;
240  FT_UInt32 char_code = *pchar_code;
241 
242 
243  char_code++;
244 
245  if ( char_code < cmap->first )
246  char_code = cmap->first;
247 
248  for ( ; char_code < ( cmap->first + cmap->count ); char_code++ )
249  {
250  result = cmap->indices[char_code];
251  if ( result != 0 )
252  goto Exit;
253  }
254 
255  char_code = 0;
256 
257  Exit:
258  *pchar_code = char_code;
259  return result;
260  }
GLuint64EXT * result
Definition: glext.h:11304
FT_UInt count
Definition: t1cmap.h:74
FT_UShort * indices
Definition: t1cmap.h:75
const GLint * first
Definition: glext.h:5794
static void Exit(void)
Definition: sock.c:1331
FT_UInt first
Definition: t1cmap.h:73
unsigned int FT_UInt
Definition: fttypes.h:231

◆ t1_cmap_custom_done()

t1_cmap_custom_done ( T1_CMapCustom  cmap)

Definition at line 212 of file t1cmap.c.

213  {
214  cmap->indices = NULL;
215  cmap->first = 0;
216  cmap->count = 0;
217  }
FT_UInt count
Definition: t1cmap.h:74
FT_UShort * indices
Definition: t1cmap.h:75
FT_UInt first
Definition: t1cmap.h:73
#define NULL
Definition: types.h:112

◆ t1_cmap_custom_init()

t1_cmap_custom_init ( T1_CMapCustom  cmap,
FT_Pointer  pointer 
)

Definition at line 191 of file t1cmap.c.

193  {
194  T1_Face face = (T1_Face)FT_CMAP_FACE( cmap );
195  T1_Encoding encoding = &face->type1.encoding;
196 
197  FT_UNUSED( pointer );
198 
199 
200  cmap->first = (FT_UInt)encoding->code_first;
201  cmap->count = (FT_UInt)encoding->code_last - cmap->first;
202  cmap->indices = encoding->char_index;
203 
204  FT_ASSERT( cmap->indices );
205  FT_ASSERT( encoding->code_first <= encoding->code_last );
206 
207  return 0;
208  }
struct T1_FaceRec_ * T1_Face
Definition: t1types.h:196
#define FT_CMAP_FACE(x)
Definition: ftobjs.h:165
FT_UInt count
Definition: t1cmap.h:74
GLsizei const GLvoid * pointer
Definition: glext.h:5848
FT_UShort * indices
Definition: t1cmap.h:75
FT_BEGIN_HEADER struct T1_EncodingRecRec_ * T1_Encoding
#define FT_ASSERT(condition)
Definition: ftdebug.h:211
FT_UInt first
Definition: t1cmap.h:73
ed encoding
Definition: write.c:2825
unsigned int FT_UInt
Definition: fttypes.h:231
#define FT_UNUSED(arg)
Definition: ftconfig.h:101
GLenum GLuint GLint GLenum face
Definition: glext.h:7025

◆ t1_cmap_expert_init()

t1_cmap_expert_init ( T1_CMapStd  cmap,
FT_Pointer  pointer 
)

Definition at line 153 of file t1cmap.c.

155  {
156  FT_UNUSED( pointer );
157 
158 
159  t1_cmap_std_init( cmap, 1 );
160  return 0;
161  }
static void t1_cmap_std_init(T1_CMapStd cmap, FT_Int is_expert)
Definition: t1cmap.c:35
GLsizei const GLvoid * pointer
Definition: glext.h:5848
#define FT_UNUSED(arg)
Definition: ftconfig.h:101

◆ t1_cmap_standard_init()

t1_cmap_standard_init ( T1_CMapStd  cmap,
FT_Pointer  pointer 
)

Definition at line 123 of file t1cmap.c.

125  {
126  FT_UNUSED( pointer );
127 
128 
129  t1_cmap_std_init( cmap, 0 );
130  return 0;
131  }
static void t1_cmap_std_init(T1_CMapStd cmap, FT_Int is_expert)
Definition: t1cmap.c:35
GLsizei const GLvoid * pointer
Definition: glext.h:5848
#define FT_UNUSED(arg)
Definition: ftconfig.h:101

◆ t1_cmap_std_char_index()

t1_cmap_std_char_index ( T1_CMapStd  cmap,
FT_UInt32  char_code 
)

Definition at line 63 of file t1cmap.c.

65  {
66  FT_UInt result = 0;
67 
68 
69  if ( char_code < 256 )
70  {
71  FT_UInt code, n;
72  const char* glyph_name;
73 
74 
75  /* convert character code to Adobe SID string */
76  code = cmap->code_to_sid[char_code];
77  glyph_name = cmap->sid_to_string( code );
78 
79  /* look for the corresponding glyph name */
80  for ( n = 0; n < cmap->num_glyphs; n++ )
81  {
82  const char* gname = cmap->glyph_names[n];
83 
84 
85  if ( gname && gname[0] == glyph_name[0] &&
86  ft_strcmp( gname, glyph_name ) == 0 )
87  {
88  result = n;
89  break;
90  }
91  }
92  }
93 
94  return result;
95  }
GLuint64EXT * result
Definition: glext.h:11304
GLdouble n
Definition: glext.h:7729
Definition: inflate.c:139
int code
Definition: main.c:75
unsigned int FT_UInt
Definition: fttypes.h:231
#define ft_strcmp
Definition: ftstdlib.h:86

Referenced by t1_cmap_std_char_next().

◆ t1_cmap_std_char_next()

t1_cmap_std_char_next ( T1_CMapStd  cmap,
FT_UInt32 *  pchar_code 
)

Definition at line 99 of file t1cmap.c.

101  {
102  FT_UInt result = 0;
103  FT_UInt32 char_code = *pchar_code + 1;
104 
105 
106  while ( char_code < 256 )
107  {
108  result = t1_cmap_std_char_index( cmap, char_code );
109  if ( result != 0 )
110  goto Exit;
111 
112  char_code++;
113  }
114  char_code = 0;
115 
116  Exit:
117  *pchar_code = char_code;
118  return result;
119  }
GLuint64EXT * result
Definition: glext.h:11304
t1_cmap_std_char_index(T1_CMapStd cmap, FT_UInt32 char_code)
Definition: t1cmap.c:63
static void Exit(void)
Definition: sock.c:1331
unsigned int FT_UInt
Definition: fttypes.h:231

◆ t1_cmap_std_done()

t1_cmap_std_done ( T1_CMapStd  cmap)

Definition at line 53 of file t1cmap.c.

54  {
55  cmap->num_glyphs = 0;
56  cmap->glyph_names = NULL;
57  cmap->sid_to_string = NULL;
58  cmap->code_to_sid = NULL;
59  }
#define NULL
Definition: types.h:112

◆ t1_cmap_std_init()

static void t1_cmap_std_init ( T1_CMapStd  cmap,
FT_Int  is_expert 
)
static

Definition at line 35 of file t1cmap.c.

37  {
38  T1_Face face = (T1_Face)FT_CMAP_FACE( cmap );
39  FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames;
40 
41 
42  cmap->num_glyphs = (FT_UInt)face->type1.num_glyphs;
43  cmap->glyph_names = (const char* const*)face->type1.glyph_names;
44  cmap->sid_to_string = psnames->adobe_std_strings;
45  cmap->code_to_sid = is_expert ? psnames->adobe_expert_encoding
46  : psnames->adobe_std_encoding;
47 
48  FT_ASSERT( cmap->code_to_sid );
49  }
struct T1_FaceRec_ * T1_Face
Definition: t1types.h:196
#define FT_CMAP_FACE(x)
Definition: ftobjs.h:165
#define FT_ASSERT(condition)
Definition: ftdebug.h:211
unsigned int FT_UInt
Definition: fttypes.h:231
GLenum GLuint GLint GLenum face
Definition: glext.h:7025

Referenced by t1_cmap_expert_init(), and t1_cmap_standard_init().

◆ t1_cmap_unicode_char_index()

t1_cmap_unicode_char_index ( PS_Unicodes  unicodes,
FT_UInt32  char_code 
)

Definition at line 330 of file t1cmap.c.

332  {
333  T1_Face face = (T1_Face)FT_CMAP_FACE( unicodes );
334  FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames;
335 
336 
337  return psnames->unicodes_char_index( unicodes, char_code );
338  }
struct T1_FaceRec_ * T1_Face
Definition: t1types.h:196
#define FT_CMAP_FACE(x)
Definition: ftobjs.h:165
GLenum GLuint GLint GLenum face
Definition: glext.h:7025

◆ t1_cmap_unicode_char_next()

t1_cmap_unicode_char_next ( PS_Unicodes  unicodes,
FT_UInt32 *  pchar_code 
)

Definition at line 342 of file t1cmap.c.

344  {
345  T1_Face face = (T1_Face)FT_CMAP_FACE( unicodes );
346  FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames;
347 
348 
349  return psnames->unicodes_char_next( unicodes, pchar_code );
350  }
struct T1_FaceRec_ * T1_Face
Definition: t1types.h:196
#define FT_CMAP_FACE(x)
Definition: ftobjs.h:165
GLenum GLuint GLint GLenum face
Definition: glext.h:7025

◆ t1_cmap_unicode_done()

t1_cmap_unicode_done ( PS_Unicodes  unicodes)

Definition at line 318 of file t1cmap.c.

319  {
320  FT_Face face = FT_CMAP_FACE( unicodes );
322 
323 
324  FT_FREE( unicodes->maps );
325  unicodes->num_maps = 0;
326  }
FT_UInt num_maps
Definition: svpscmap.h:67
#define FT_CMAP_FACE(x)
Definition: ftobjs.h:165
static char memory[1024 *256]
Definition: process.c:116
PS_UniMap * maps
Definition: svpscmap.h:68
#define FT_FREE(ptr)
Definition: ftmemory.h:329
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
#define FT_FACE_MEMORY(x)
Definition: ftobjs.h:636
GLenum GLuint GLint GLenum face
Definition: glext.h:7025

◆ t1_cmap_unicode_init()

t1_cmap_unicode_init ( PS_Unicodes  unicodes,
FT_Pointer  pointer 
)

Definition at line 298 of file t1cmap.c.

300  {
301  T1_Face face = (T1_Face)FT_CMAP_FACE( unicodes );
303  FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)face->psnames;
304 
305  FT_UNUSED( pointer );
306 
307 
308  return psnames->unicodes_init( memory,
309  unicodes,
310  (FT_UInt)face->type1.num_glyphs,
313  (FT_Pointer)face );
314  }
struct T1_FaceRec_ * T1_Face
Definition: t1types.h:196
#define FT_CMAP_FACE(x)
Definition: ftobjs.h:165
GLsizei const GLvoid * pointer
Definition: glext.h:5848
static char memory[1024 *256]
Definition: process.c:116
psaux_get_glyph_name(T1_Face face, FT_UInt idx)
Definition: t1cmap.c:290
const char *(* PS_GetGlyphNameFunc)(FT_Pointer data, FT_UInt string_index)
Definition: svpscmap.h:78
void(* PS_FreeGlyphNameFunc)(FT_Pointer data, const char *name)
Definition: svpscmap.h:86
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
#define FT_FACE_MEMORY(x)
Definition: ftobjs.h:636
unsigned int FT_UInt
Definition: fttypes.h:231
#define NULL
Definition: types.h:112
#define FT_UNUSED(arg)
Definition: ftconfig.h:101
GLenum GLuint GLint GLenum face
Definition: glext.h:7025

Variable Documentation

◆ t1_cmap_custom_class_rec

FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec t1_cmap_custom_class_rec
Initial value:
=
{
sizeof ( T1_CMapCustomRec ),
}
t1_cmap_custom_char_next(T1_CMapCustom cmap, FT_UInt32 *pchar_code)
Definition: t1cmap.c:236
FT_UInt(* FT_CMap_CharIndexFunc)(FT_CMap cmap, FT_UInt32 char_code)
Definition: ftobjs.h:177
FT_UInt32 *(* FT_CMap_VariantCharListFunc)(FT_CMap cmap, FT_Memory mem, FT_UInt32 variant_selector)
Definition: ftobjs.h:205
void(* FT_CMap_DoneFunc)(FT_CMap cmap)
Definition: ftobjs.h:174
t1_cmap_custom_char_index(T1_CMapCustom cmap, FT_UInt32 char_code)
Definition: t1cmap.c:221
t1_cmap_custom_init(T1_CMapCustom cmap, FT_Pointer pointer)
Definition: t1cmap.c:191
FT_UInt32 *(* FT_CMap_VariantListFunc)(FT_CMap cmap, FT_Memory mem)
Definition: ftobjs.h:196
struct T1_CMapCustomRec_ T1_CMapCustomRec
t1_cmap_custom_done(T1_CMapCustom cmap)
Definition: t1cmap.c:212
#define NULL
Definition: types.h:112
FT_UInt(* FT_CMap_CharNextFunc)(FT_CMap cmap, FT_UInt32 *achar_code)
Definition: ftobjs.h:181
FT_Error(* FT_CMap_InitFunc)(FT_CMap cmap, FT_Pointer init_data)
Definition: ftobjs.h:170
FT_UInt32 *(* FT_CMap_CharVariantListFunc)(FT_CMap cmap, FT_Memory mem, FT_UInt32 char_code)
Definition: ftobjs.h:200
FT_UInt(* FT_CMap_CharVarIndexFunc)(FT_CMap cmap, FT_CMap unicode_cmap, FT_UInt32 char_code, FT_UInt32 variant_selector)
Definition: ftobjs.h:185
FT_Bool(* FT_CMap_CharVarIsDefaultFunc)(FT_CMap cmap, FT_UInt32 char_code, FT_UInt32 variant_selector)
Definition: ftobjs.h:191

Definition at line 264 of file t1cmap.c.

◆ t1_cmap_expert_class_rec

FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec t1_cmap_expert_class_rec
Initial value:
=
{
sizeof ( T1_CMapStdRec ),
}
FT_UInt(* FT_CMap_CharIndexFunc)(FT_CMap cmap, FT_UInt32 char_code)
Definition: ftobjs.h:177
FT_UInt32 *(* FT_CMap_VariantCharListFunc)(FT_CMap cmap, FT_Memory mem, FT_UInt32 variant_selector)
Definition: ftobjs.h:205
void(* FT_CMap_DoneFunc)(FT_CMap cmap)
Definition: ftobjs.h:174
t1_cmap_std_char_next(T1_CMapStd cmap, FT_UInt32 *pchar_code)
Definition: t1cmap.c:99
t1_cmap_std_char_index(T1_CMapStd cmap, FT_UInt32 char_code)
Definition: t1cmap.c:63
FT_UInt32 *(* FT_CMap_VariantListFunc)(FT_CMap cmap, FT_Memory mem)
Definition: ftobjs.h:196
t1_cmap_expert_init(T1_CMapStd cmap, FT_Pointer pointer)
Definition: t1cmap.c:153
struct T1_CMapStdRec_ T1_CMapStdRec
#define NULL
Definition: types.h:112
FT_UInt(* FT_CMap_CharNextFunc)(FT_CMap cmap, FT_UInt32 *achar_code)
Definition: ftobjs.h:181
t1_cmap_std_done(T1_CMapStd cmap)
Definition: t1cmap.c:53
FT_Error(* FT_CMap_InitFunc)(FT_CMap cmap, FT_Pointer init_data)
Definition: ftobjs.h:170
FT_UInt32 *(* FT_CMap_CharVariantListFunc)(FT_CMap cmap, FT_Memory mem, FT_UInt32 char_code)
Definition: ftobjs.h:200
FT_UInt(* FT_CMap_CharVarIndexFunc)(FT_CMap cmap, FT_CMap unicode_cmap, FT_UInt32 char_code, FT_UInt32 variant_selector)
Definition: ftobjs.h:185
FT_Bool(* FT_CMap_CharVarIsDefaultFunc)(FT_CMap cmap, FT_UInt32 char_code, FT_UInt32 variant_selector)
Definition: ftobjs.h:191

Definition at line 164 of file t1cmap.c.

◆ t1_cmap_standard_class_rec

FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec t1_cmap_standard_class_rec
Initial value:
=
{
sizeof ( T1_CMapStdRec ),
}
FT_UInt(* FT_CMap_CharIndexFunc)(FT_CMap cmap, FT_UInt32 char_code)
Definition: ftobjs.h:177
FT_UInt32 *(* FT_CMap_VariantCharListFunc)(FT_CMap cmap, FT_Memory mem, FT_UInt32 variant_selector)
Definition: ftobjs.h:205
void(* FT_CMap_DoneFunc)(FT_CMap cmap)
Definition: ftobjs.h:174
t1_cmap_std_char_next(T1_CMapStd cmap, FT_UInt32 *pchar_code)
Definition: t1cmap.c:99
t1_cmap_std_char_index(T1_CMapStd cmap, FT_UInt32 char_code)
Definition: t1cmap.c:63
t1_cmap_standard_init(T1_CMapStd cmap, FT_Pointer pointer)
Definition: t1cmap.c:123
FT_UInt32 *(* FT_CMap_VariantListFunc)(FT_CMap cmap, FT_Memory mem)
Definition: ftobjs.h:196
struct T1_CMapStdRec_ T1_CMapStdRec
#define NULL
Definition: types.h:112
FT_UInt(* FT_CMap_CharNextFunc)(FT_CMap cmap, FT_UInt32 *achar_code)
Definition: ftobjs.h:181
t1_cmap_std_done(T1_CMapStd cmap)
Definition: t1cmap.c:53
FT_Error(* FT_CMap_InitFunc)(FT_CMap cmap, FT_Pointer init_data)
Definition: ftobjs.h:170
FT_UInt32 *(* FT_CMap_CharVariantListFunc)(FT_CMap cmap, FT_Memory mem, FT_UInt32 char_code)
Definition: ftobjs.h:200
FT_UInt(* FT_CMap_CharVarIndexFunc)(FT_CMap cmap, FT_CMap unicode_cmap, FT_UInt32 char_code, FT_UInt32 variant_selector)
Definition: ftobjs.h:185
FT_Bool(* FT_CMap_CharVarIsDefaultFunc)(FT_CMap cmap, FT_UInt32 char_code, FT_UInt32 variant_selector)
Definition: ftobjs.h:191

Definition at line 135 of file t1cmap.c.

◆ t1_cmap_unicode_class_rec

FT_CALLBACK_TABLE_DEF const FT_CMap_ClassRec t1_cmap_unicode_class_rec
Initial value:
=
{
sizeof ( PS_UnicodesRec ),
}
FT_UInt(* FT_CMap_CharIndexFunc)(FT_CMap cmap, FT_UInt32 char_code)
Definition: ftobjs.h:177
FT_UInt32 *(* FT_CMap_VariantCharListFunc)(FT_CMap cmap, FT_Memory mem, FT_UInt32 variant_selector)
Definition: ftobjs.h:205
void(* FT_CMap_DoneFunc)(FT_CMap cmap)
Definition: ftobjs.h:174
struct PS_UnicodesRec_ PS_UnicodesRec
FT_UInt32 *(* FT_CMap_VariantListFunc)(FT_CMap cmap, FT_Memory mem)
Definition: ftobjs.h:196
t1_cmap_unicode_done(PS_Unicodes unicodes)
Definition: t1cmap.c:318
t1_cmap_unicode_char_next(PS_Unicodes unicodes, FT_UInt32 *pchar_code)
Definition: t1cmap.c:342
t1_cmap_unicode_char_index(PS_Unicodes unicodes, FT_UInt32 char_code)
Definition: t1cmap.c:330
#define NULL
Definition: types.h:112
FT_UInt(* FT_CMap_CharNextFunc)(FT_CMap cmap, FT_UInt32 *achar_code)
Definition: ftobjs.h:181
t1_cmap_unicode_init(PS_Unicodes unicodes, FT_Pointer pointer)
Definition: t1cmap.c:298
FT_Error(* FT_CMap_InitFunc)(FT_CMap cmap, FT_Pointer init_data)
Definition: ftobjs.h:170
FT_UInt32 *(* FT_CMap_CharVariantListFunc)(FT_CMap cmap, FT_Memory mem, FT_UInt32 char_code)
Definition: ftobjs.h:200
FT_UInt(* FT_CMap_CharVarIndexFunc)(FT_CMap cmap, FT_CMap unicode_cmap, FT_UInt32 char_code, FT_UInt32 variant_selector)
Definition: ftobjs.h:185
FT_Bool(* FT_CMap_CharVarIsDefaultFunc)(FT_CMap cmap, FT_UInt32 char_code, FT_UInt32 variant_selector)
Definition: ftobjs.h:191

Definition at line 354 of file t1cmap.c.