1 /***************************************************************************/ |
|
2 /* */ |
|
3 /* ttcmap.h */ |
|
4 /* */ |
|
5 /* TrueType character mapping table (cmap) support (specification). */ |
|
6 /* */ |
|
7 /* Copyright 2002, 2003, 2004, 2005 by */ |
|
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
|
9 /* */ |
|
10 /* This file is part of the FreeType project, and may only be used, */ |
|
11 /* modified, and distributed under the terms of the FreeType project */ |
|
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
|
13 /* this file you indicate that you have read the license and */ |
|
14 /* understand and accept it fully. */ |
|
15 /* */ |
|
16 /***************************************************************************/ |
|
17 |
|
18 |
|
19 #ifndef __TTCMAP_H__ |
|
20 #define __TTCMAP_H__ |
|
21 |
|
22 |
|
23 #include <ft2build.h> |
|
24 #include FT_INTERNAL_TRUETYPE_TYPES_H |
|
25 #include FT_INTERNAL_VALIDATE_H |
|
26 #include FT_SERVICE_TT_CMAP_H |
|
27 |
|
28 FT_BEGIN_HEADER |
|
29 |
|
30 |
|
31 #define TT_CMAP_FLAG_UNSORTED 1 |
|
32 #define TT_CMAP_FLAG_OVERLAPPING 2 |
|
33 |
|
34 typedef struct TT_CMapRec_ |
|
35 { |
|
36 FT_CMapRec cmap; |
|
37 FT_Byte* data; /* pointer to in-memory cmap table */ |
|
38 FT_Int flags; /* for format 4 only */ |
|
39 |
|
40 } TT_CMapRec, *TT_CMap; |
|
41 |
|
42 typedef const struct TT_CMap_ClassRec_* TT_CMap_Class; |
|
43 |
|
44 |
|
45 typedef FT_Error |
|
46 (*TT_CMap_ValidateFunc)( FT_Byte* data, |
|
47 FT_Validator valid ); |
|
48 |
|
49 typedef struct TT_CMap_ClassRec_ |
|
50 { |
|
51 FT_CMap_ClassRec clazz; |
|
52 FT_UInt format; |
|
53 TT_CMap_ValidateFunc validate; |
|
54 TT_CMap_Info_GetFunc get_cmap_info; |
|
55 |
|
56 } TT_CMap_ClassRec; |
|
57 |
|
58 #ifndef FT_CONFIG_OPTION_PIC |
|
59 |
|
60 #define FT_DEFINE_TT_CMAP(class_, size_, init_, done_, char_index_, \ |
|
61 char_next_, char_var_index_, char_var_default_, variant_list_, \ |
|
62 charvariant_list_,variantchar_list_, \ |
|
63 format_, validate_, get_cmap_info_) \ |
|
64 FT_CALLBACK_TABLE_DEF \ |
|
65 const TT_CMap_ClassRec class_ = \ |
|
66 { \ |
|
67 {size_, init_, done_, char_index_, \ |
|
68 char_next_, char_var_index_, char_var_default_, variant_list_, \ |
|
69 charvariant_list_, variantchar_list_}, \ |
|
70 format_, validate_, get_cmap_info_ \ |
|
71 }; |
|
72 |
|
73 #else /* FT_CONFIG_OPTION_PIC */ |
|
74 |
|
75 #define FT_DEFINE_TT_CMAP(class_, size_, init_, done_, char_index_, \ |
|
76 char_next_, char_var_index_, char_var_default_, variant_list_, \ |
|
77 charvariant_list_,variantchar_list_, \ |
|
78 format_, validate_, get_cmap_info_) \ |
|
79 void \ |
|
80 FT_Init_Class_##class_( TT_CMap_ClassRec* clazz ) \ |
|
81 { \ |
|
82 clazz->clazz.size = size_; \ |
|
83 clazz->clazz.init = init_; \ |
|
84 clazz->clazz.done = done_; \ |
|
85 clazz->clazz.char_index = char_index_; \ |
|
86 clazz->clazz.char_next = char_next_; \ |
|
87 clazz->clazz.char_var_index = char_var_index_; \ |
|
88 clazz->clazz.char_var_default = char_var_default_; \ |
|
89 clazz->clazz.variant_list = variant_list_; \ |
|
90 clazz->clazz.charvariant_list = charvariant_list_; \ |
|
91 clazz->clazz.variantchar_list = variantchar_list_; \ |
|
92 clazz->format = format_; \ |
|
93 clazz->validate = validate_; \ |
|
94 clazz->get_cmap_info = get_cmap_info_; \ |
|
95 } |
|
96 |
|
97 #endif /* FT_CONFIG_OPTION_PIC */ |
|
98 |
|
99 typedef struct TT_ValidatorRec_ |
|
100 { |
|
101 FT_ValidatorRec validator; |
|
102 FT_UInt num_glyphs; |
|
103 |
|
104 } TT_ValidatorRec, *TT_Validator; |
|
105 |
|
106 |
|
107 #define TT_VALIDATOR( x ) ((TT_Validator)( x )) |
|
108 #define TT_VALID_GLYPH_COUNT( x ) TT_VALIDATOR( x )->num_glyphs |
|
109 |
|
110 |
|
111 FT_LOCAL( FT_Error ) |
|
112 tt_face_build_cmaps( TT_Face face ); |
|
113 |
|
114 /* used in tt-cmaps service */ |
|
115 FT_LOCAL( FT_Error ) |
|
116 tt_get_cmap_info( FT_CharMap charmap, |
|
117 TT_CMapInfo *cmap_info ); |
|
118 |
|
119 |
|
120 FT_END_HEADER |
|
121 |
|
122 #endif /* __TTCMAP_H__ */ |
|
123 |
|
124 |
|
125 /* END */ |
|