Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4973 right-hear 1
/*******************************************************************
2
 *
3
 *  ttcmap.h                                                    1.0
4
 *
5
 *    TrueType Character Mappings
6
 *
7
 *  Copyright 1996-1999 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
#include "ttconfig.h"
23
#include "tttypes.h"
24
 
25
 
26
#ifdef __cplusplus
27
  extern "C" {
28
#endif
29
 
30
  /* format 0 */
31
 
32
  struct  TCMap0_
33
  {
34
    PByte  glyphIdArray;
35
  };
36
 
37
  typedef struct TCMap0_  TCMap0;
38
  typedef TCMap0*         PCMap0;
39
 
40
 
41
  /* format 2 */
42
 
43
  struct  TCMap2SubHeader_
44
  {
45
    UShort  firstCode;      /* first valid low byte         */
46
    UShort  entryCount;     /* number of valid low bytes    */
47
    Short   idDelta;        /* delta value to glyphIndex    */
48
    UShort  idRangeOffset;  /* offset from here to 1st code */
49
  };
50
 
51
  typedef struct TCMap2SubHeader_  TCMap2SubHeader;
52
  typedef TCMap2SubHeader*         PCMap2SubHeader;
53
 
54
  struct  TCMap2_
55
  {
56
    PUShort subHeaderKeys;
57
    /* high byte mapping table     */
58
    /* value = subHeader index * 8 */
59
 
60
    PCMap2SubHeader  subHeaders;
61
    PUShort          glyphIdArray;
62
    UShort           numGlyphId;        /* control value */
63
  };
64
 
65
  typedef struct TCMap2_  TCMap2;
66
  typedef TCMap2*         PCMap2;
67
 
68
 
69
  /* format 4 */
70
 
71
  struct  TCMap4Segment_
72
  {
73
    UShort  endCount;
74
    UShort  startCount;
75
    Short   idDelta;        /* in the specs defined as UShort but the
76
                               example there gives negative values... */
77
    UShort  idRangeOffset;
78
  };
79
 
80
  typedef struct TCMap4Segment_  TCMap4Segment;
81
  typedef TCMap4Segment*         PCMap4Segment;
82
 
83
  struct  TCMap4_
84
  {
85
    UShort  segCountX2;     /* number of segments * 2       */
86
    UShort  searchRange;    /* these parameters can be used */
87
    UShort  entrySelector;  /* for a binary search          */
88
    UShort  rangeShift;
89
 
90
    PCMap4Segment  segments;
91
    PUShort        glyphIdArray;
92
    UShort         numGlyphId;          /* control value */
93
  };
94
 
95
  typedef struct TCMap4_  TCMap4;
96
  typedef TCMap4*         PCMap4;
97
 
98
 
99
  /* format 6 */
100
 
101
  struct  TCMap6_
102
  {
103
    UShort   firstCode;      /* first character code of subrange      */
104
    UShort   entryCount;     /* number of character codes in subrange */
105
 
106
    PUShort  glyphIdArray;
107
  };
108
 
109
  typedef struct TCMap6_  TCMap6;
110
  typedef TCMap6*         PCMap6;
111
 
112
 
113
  /* charmap table */
114
 
115
  struct  TCMapTable_
116
  {
117
    UShort  platformID;
118
    UShort  platformEncodingID;
119
    UShort  format;
120
    UShort  length;
121
    UShort  version;
122
 
123
    Bool    loaded;
124
    ULong   offset;
125
 
126
    union
127
    {
128
      TCMap0  cmap0;
129
      TCMap2  cmap2;
130
      TCMap4  cmap4;
131
      TCMap6  cmap6;
132
    } c;
133
  };
134
 
135
  typedef struct TCMapTable_  TCMapTable;
136
  typedef TCMapTable*         PCMapTable;
137
 
138
 
139
 
140
  /* Load character mappings directory when face is loaded. */
141
  /* The mappings themselves are only loaded on demand.     */
142
 
143
  LOCAL_DEF
144
  TT_Error  CharMap_Load( PCMapTable  table,
145
                          TT_Stream  input );
146
 
147
 
148
  /* Destroy one character mapping table */
149
 
150
  LOCAL_DEF
151
  TT_Error  CharMap_Free( PCMapTable  table );
152
 
153
 
154
  /* Use character mapping table to perform mapping */
155
 
156
  LOCAL_DEF
157
  UShort  CharMap_Index( PCMapTable  cmap,
158
                         UShort      charCode );
159
 
160
  /* NOTE: The PFace type isn't defined at this point */
161
 
162
#ifdef __cplusplus
163
  }
164
#endif
165
 
166
#endif /* TTCMAP_H */
167
 
168
 
169
/* END */