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