gfx/thebes/MathTableStructures.h

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:8cd1d88100f0
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 // This file contains the structures described in Microsoft's document
6 // "The MATH table and OpenType Features for Math Processing" (not yet public).
7 //
8 // Arrays of varying size are indicated in comments. Typically, gfxMathTable
9 // will read the header of the structure first, verify that there is enough
10 // space for the specified arrays and then use a pointer to browse these arrays.
11
12 #ifndef MATH_TABLE_STRUCTURE_H
13 #define MATH_TABLE_STRUCTURE_H
14
15 #include "gfxFontUtils.h"
16
17 typedef mozilla::AutoSwap_PRUint16 Count16;
18 typedef mozilla::AutoSwap_PRUint16 GlyphID;
19 typedef mozilla::AutoSwap_PRUint16 Offset;
20
21 struct MathValueRecord {
22 mozilla::AutoSwap_PRInt16 mValue;
23 Offset mDeviceTable;
24 };
25
26 struct RangeRecord {
27 GlyphID mStart;
28 GlyphID mEnd;
29 mozilla::AutoSwap_PRUint16 mStartCoverageIndex;
30 };
31
32 struct Coverage {
33 mozilla::AutoSwap_PRUint16 mFormat;
34 };
35
36 struct CoverageFormat1 {
37 mozilla::AutoSwap_PRUint16 mFormat;
38 Count16 mGlyphCount;
39 // GlyphID mGlyphArray[mGlyphCount]
40 };
41
42 struct CoverageFormat2 {
43 mozilla::AutoSwap_PRUint16 mFormat;
44 Count16 mRangeCount;
45 // RangeRecord mRangeArray[mRangeCount];
46 };
47
48 struct MATHTableHeader {
49 mozilla::AutoSwap_PRUint32 mVersion;
50 Offset mMathConstants;
51 Offset mMathGlyphInfo;
52 Offset mMathVariants;
53 };
54
55 struct MathConstants {
56 mozilla::AutoSwap_PRInt16 mInt16[gfxFontEntry::ScriptScriptPercentScaleDown -
57 gfxFontEntry::ScriptPercentScaleDown + 1];
58 mozilla::AutoSwap_PRUint16 mUint16[gfxFontEntry::DisplayOperatorMinHeight -
59 gfxFontEntry::
60 DelimitedSubFormulaMinHeight + 1];
61 MathValueRecord mMathValues[gfxFontEntry::RadicalKernAfterDegree -
62 gfxFontEntry::MathLeading + 1];
63 mozilla::AutoSwap_PRUint16 mRadicalDegreeBottomRaisePercent;
64 };
65
66 struct MathGlyphInfo {
67 Offset mMathItalicsCorrectionInfo;
68 Offset mMathTopAccentAttachment;
69 Offset mExtendedShapeCoverage;
70 Offset mMathKernInfo;
71 };
72
73 struct MathItalicsCorrectionInfo {
74 Offset mCoverage;
75 Count16 mItalicsCorrectionCount;
76 // MathValueRecord mItalicsCorrection[mItalicsCorrectionCount]
77 };
78
79 struct MathVariants {
80 mozilla::AutoSwap_PRUint16 mMinConnectorOverlap;
81 Offset mVertGlyphCoverage;
82 Offset mHorizGlyphCoverage;
83 Count16 mVertGlyphCount;
84 Count16 mHorizGlyphCount;
85 // Offset mVertGlyphConstruction[mVertGlyphCount];
86 // Offset mHorizGlyphConstruction[mHorizGlyphCount];
87 };
88
89 struct MathGlyphVariantRecord {
90 GlyphID mVariantGlyph;
91 mozilla::AutoSwap_PRUint16 mAdvanceMeasurement;
92 };
93
94 struct MathGlyphConstruction {
95 Offset mGlyphAssembly;
96 Count16 mVariantCount;
97 // MathGlyphVariantRecord mMathGlyphVariantRecord[mVariantCount]
98 };
99
100 struct GlyphPartRecord {
101 GlyphID mGlyph;
102 mozilla::AutoSwap_PRUint16 mStartConnectorLength;
103 mozilla::AutoSwap_PRUint16 mEndConnectorLength;
104 mozilla::AutoSwap_PRUint16 mFullAdvance;
105 mozilla::AutoSwap_PRUint16 mPartFlags;
106 };
107
108 // PartFlags enumeration currently uses only one bit:
109 // 0x0001 If set, the part can be skipped or repeated.
110 // 0xFFFE Reserved.
111 enum {
112 PART_FLAG_EXTENDER = 0x01
113 };
114
115 struct GlyphAssembly {
116 MathValueRecord mItalicsCorrection;
117 Count16 mPartCount;
118 // GlyphPartRecord mPartRecords[mPartCount]
119 };
120
121 #endif

mercurial