Skip to content
0.2.0-dev Download ZIP
134 lines ·3.9 KB Raw
1/****************************************************************************
2 *
3 * ttcmap.h
4 *
5 * TrueType character mapping table (cmap) support (specification).
6 *
7 * Copyright (C) 2002-2026 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 <freetype/internal/tttypes.h>
24#include <freetype/internal/ftvalid.h>
25#include <freetype/internal/services/svttcmap.h>
26
27FT_BEGIN_HEADER
28
29
30#define TT_CMAP_FLAG_UNSORTED 1
31#define TT_CMAP_FLAG_OVERLAPPING 2
32
33 typedef struct TT_CMapRec_
34 {
35 FT_CMapRec cmap;
36 FT_Byte* data; /* pointer to in-memory cmap table */
37 FT_Int flags; /* for format 4 only */
38 FT_CMap_Class cmap_class; /* class before applying 'DMAP' */
39 FT_CMap dmap; /* overriding 'DMAP' subtable */
40
41 } TT_CMapRec, *TT_CMap;
42
43 typedef const struct TT_CMap_ClassRec_* TT_CMap_Class;
44
45
46 typedef FT_Error
47 (*TT_CMap_ValidateFunc)( FT_Byte* data,
48 FT_Validator valid );
49
50 typedef struct TT_CMap_ClassRec_
51 {
52 FT_CMap_ClassRec clazz;
53 FT_UInt format;
54 TT_CMap_ValidateFunc validate;
55 TT_CMap_Info_GetFunc get_cmap_info;
56
57 } TT_CMap_ClassRec;
58
59
60#define FT_DEFINE_TT_CMAP( class_, \
61 size_, \
62 init_, \
63 done_, \
64 char_index_, \
65 char_next_, \
66 char_var_index_, \
67 char_var_default_, \
68 variant_list_, \
69 charvariant_list_, \
70 variantchar_list_, \
71 format_, \
72 validate_, \
73 get_cmap_info_ ) \
74 FT_CALLBACK_TABLE_DEF \
75 const TT_CMap_ClassRec class_ = \
76 { \
77 { size_, \
78 init_, \
79 done_, \
80 char_index_, \
81 char_next_, \
82 char_var_index_, \
83 char_var_default_, \
84 variant_list_, \
85 charvariant_list_, \
86 variantchar_list_ \
87 }, \
88 \
89 format_, \
90 validate_, \
91 get_cmap_info_ \
92 };
93
94
95#undef TTCMAPCITEM
96#define TTCMAPCITEM( a ) FT_CALLBACK_TABLE const TT_CMap_ClassRec a;
97#include "ttcmapc.h"
98
99
100 typedef struct TT_ValidatorRec_
101 {
102 FT_ValidatorRec validator;
103 FT_UInt num_glyphs;
104
105 } TT_ValidatorRec, *TT_Validator;
106
107
108#define TT_VALIDATOR( x ) ( (TT_Validator)( x ) )
109#define TT_VALID_GLYPH_COUNT( x ) TT_VALIDATOR( x )->num_glyphs
110
111
112 FT_CALLBACK_TABLE const TT_CMap_ClassRec tt_cmap_unicode_class_rec;
113
114 FT_LOCAL( FT_Error )
115 tt_face_build_cmaps( TT_Face face );
116
117 FT_LOCAL( FT_Error )
118 tt_face_build_dmaps( TT_Face face );
119
120 FT_LOCAL( void )
121 tt_face_done_dmaps( TT_Face face );
122
123 /* used in tt-cmaps service */
124 FT_LOCAL( FT_Error )
125 tt_get_cmap_info( FT_CharMap charmap,
126 TT_CMapInfo *cmap_info );
127
128
129FT_END_HEADER
130
131#endif /* TTCMAP_H_ */
132
133
134/* END */