1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
|
/****************************************************************************\
Part of the XeTeX typesetting system
Copyright (c) 1994-2008 by SIL International
Copyright (c) 2009 by Jonathan Kew
Copyright (c) 2012 by Khaled Hosny
SIL Author(s): Jonathan Kew
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of the copyright holders
shall not be used in advertising or otherwise to promote the sale,
use or other dealings in this Software without prior written
authorization from the copyright holders.
\****************************************************************************/
#ifndef __MATHTABLE_H__
#define __MATHTABLE_H__
#ifndef ANY_NUMBER
#define ANY_NUMBER 1
#endif
typedef uint16_t Offset;
typedef struct {
int16_t value;
Offset deviceTable;
} MathValueRecord;
typedef struct {
GlyphID start;
GlyphID end;
int16_t startCoverageIndex;
} RangeRecord;
typedef struct {
uint32_t version;
Offset mathConstants;
Offset mathGlyphInfo;
Offset mathVariants;
} MathTableHeader;
typedef struct {
uint16_t scriptPercentScaleDown;
uint16_t scriptScriptPercentScaleDown;
uint16_t delimitedSubFormulaMinHeight;
uint16_t displayOperatorMinHeight;
MathValueRecord mathLeading;
MathValueRecord axisHeight;
MathValueRecord accentBaseHeight;
MathValueRecord flattenedAccentBaseHeight;
MathValueRecord subscriptShiftDown;
MathValueRecord subscriptTopMax;
MathValueRecord subscriptBaselineDropMin;
MathValueRecord superscriptShiftUp;
MathValueRecord superscriptShiftUpCramped;
MathValueRecord superscriptBottomMin;
MathValueRecord superscriptBaselineDropMax;
MathValueRecord subSuperscriptGapMin;
MathValueRecord superscriptBottomMaxWithSubscript;
MathValueRecord spaceAfterScript;
MathValueRecord upperLimitGapMin;
MathValueRecord upperLimitBaselineRiseMin;
MathValueRecord lowerLimitGapMin;
MathValueRecord lowerLimitBaselineDropMin;
MathValueRecord stackTopShiftUp;
MathValueRecord stackTopDisplayStyleShiftUp;
MathValueRecord stackBottomShiftDown;
MathValueRecord stackBottomDisplayStyleShiftDown;
MathValueRecord stackGapMin;
MathValueRecord stackDisplayStyleGapMin;
MathValueRecord stretchStackTopShiftUp;
MathValueRecord stretchStackBottomShiftDown;
MathValueRecord stretchStackGapAboveMin;
MathValueRecord stretchStackGapBelowMin;
MathValueRecord fractionNumeratorShiftUp;
MathValueRecord fractionNumeratorDisplayStyleShiftUp;
MathValueRecord fractionDenominatorShiftDown;
MathValueRecord fractionDenominatorDisplayStyleShiftDown;
MathValueRecord fractionNumeratorGapMin;
MathValueRecord fractionNumDiisplayStyleGapMin;
MathValueRecord fractionRuleThickness;
MathValueRecord fractionDenominatorGapMin;
MathValueRecord fractionDenomDisplayStyleGapMin;
MathValueRecord skewedFractionHorizontalGap;
MathValueRecord skewedFractionVerticalGap;
MathValueRecord overbarVerticalGap;
MathValueRecord overbarRuleThickness;
MathValueRecord overbarExtraAscender;
MathValueRecord underbarVerticalGap;
MathValueRecord underbarRuleThickness;
MathValueRecord underbarExtraDescender;
MathValueRecord radicalVerticalGap;
MathValueRecord radicalDisplayStyleVerticalGap;
MathValueRecord radicalRuleThickness;
MathValueRecord radicalExtraAscender;
MathValueRecord radicalKernBeforeDegree;
MathValueRecord radicalKernAfterDegree;
uint16_t radicalDegreeBottomRaisePercent;
} MathConstants;
typedef enum {
unknown = -1,
scriptPercentScaleDown = 0,
scriptScriptPercentScaleDown,
delimitedSubFormulaMinHeight,
displayOperatorMinHeight,
mathLeading,
firstMathValueRecord = mathLeading,
axisHeight,
accentBaseHeight,
flattenedAccentBaseHeight,
subscriptShiftDown,
subscriptTopMax,
subscriptBaselineDropMin,
superscriptShiftUp,
superscriptShiftUpCramped,
superscriptBottomMin,
superscriptBaselineDropMax,
subSuperscriptGapMin,
superscriptBottomMaxWithSubscript,
spaceAfterScript,
upperLimitGapMin,
upperLimitBaselineRiseMin,
lowerLimitGapMin,
lowerLimitBaselineDropMin,
stackTopShiftUp,
stackTopDisplayStyleShiftUp,
stackBottomShiftDown,
stackBottomDisplayStyleShiftDown,
stackGapMin,
stackDisplayStyleGapMin,
stretchStackTopShiftUp,
stretchStackBottomShiftDown,
stretchStackGapAboveMin,
stretchStackGapBelowMin,
fractionNumeratorShiftUp,
fractionNumeratorDisplayStyleShiftUp,
fractionDenominatorShiftDown,
fractionDenominatorDisplayStyleShiftDown,
fractionNumeratorGapMin,
fractionNumDisplayStyleGapMin,
fractionRuleThickness,
fractionDenominatorGapMin,
fractionDenomDisplayStyleGapMin,
skewedFractionHorizontalGap,
skewedFractionVerticalGap,
overbarVerticalGap,
overbarRuleThickness,
overbarExtraAscender,
underbarVerticalGap,
underbarRuleThickness,
underbarExtraDescender,
radicalVerticalGap,
radicalDisplayStyleVerticalGap,
radicalRuleThickness,
radicalExtraAscender,
radicalKernBeforeDegree,
radicalKernAfterDegree,
lastMathValueRecord = radicalKernAfterDegree,
radicalDegreeBottomRaisePercent,
lastMathConstant = radicalDegreeBottomRaisePercent
} mathConstantIndex;
typedef struct {
uint16_t minConnectorOverlap;
Offset vertGlyphCoverage;
Offset horizGlyphCoverage;
uint16_t vertGlyphCount;
uint16_t horizGlyphCount;
Offset vertGlyphConstruction[ANY_NUMBER];
Offset horizGlyphConstruction[ANY_NUMBER];
} MathVariants;
typedef struct {
GlyphID variantGlyph;
uint16_t advanceMeasurement;
} MathGlyphVariantRecord;
typedef struct {
Offset glyphAssembly;
uint16_t variantCount;
MathGlyphVariantRecord mathGlyphVariantRecord[ANY_NUMBER];
} MathGlyphConstruction;
typedef struct {
GlyphID glyph;
uint16_t startConnectorLength;
uint16_t endConnectorLength;
uint16_t fullAdvance;
uint16_t partFlags;
} GlyphPartRecord;
#define fExtender 0x0001
typedef struct {
MathValueRecord italicsCorrection;
uint16_t partCount;
GlyphPartRecord partRecords[ANY_NUMBER];
} GlyphAssembly;
typedef struct {
Offset mathItalicsCorrectionInfo;
Offset mathTopAccentAttachment;
Offset extendedShapeCoverage;
Offset mathKernInfo;
} MathGlyphInfo;
typedef struct {
Offset coverage;
uint16_t italicsCorrectionCount;
MathValueRecord italicsCorrection[ANY_NUMBER];
} MathItalicsCorrectionInfo;
typedef struct {
Offset coverage;
uint16_t topAccentAttachmentCount;
MathValueRecord topAccentAttachment[ANY_NUMBER];
} MathTopAccentAttachment;
typedef struct {
Offset topRight;
Offset topLeft;
Offset bottomRight;
Offset bottomLeft;
} MathKernInfoRecord;
typedef struct {
Offset coverage;
uint16_t kernInfoCount;
MathKernInfoRecord kernInfo[ANY_NUMBER];
} MathKernInfo;
typedef struct {
uint16_t heightCount;
MathValueRecord height[ANY_NUMBER];
MathValueRecord kern[ANY_NUMBER];
} MathKernTable;
typedef struct {
uint16_t format;
} Coverage;
typedef struct {
uint16_t format;
uint16_t glyphCount;
GlyphID glyphArray[ANY_NUMBER];
} CoverageFormat1;
typedef struct {
uint16_t format;
uint16_t rangeCount;
RangeRecord rangeArray[ANY_NUMBER];
} CoverageFormat2;
#endif
|