michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: // This file contains the structures described in Microsoft's document michael@0: // "The MATH table and OpenType Features for Math Processing" (not yet public). michael@0: // michael@0: // Arrays of varying size are indicated in comments. Typically, gfxMathTable michael@0: // will read the header of the structure first, verify that there is enough michael@0: // space for the specified arrays and then use a pointer to browse these arrays. michael@0: michael@0: #ifndef MATH_TABLE_STRUCTURE_H michael@0: #define MATH_TABLE_STRUCTURE_H michael@0: michael@0: #include "gfxFontUtils.h" michael@0: michael@0: typedef mozilla::AutoSwap_PRUint16 Count16; michael@0: typedef mozilla::AutoSwap_PRUint16 GlyphID; michael@0: typedef mozilla::AutoSwap_PRUint16 Offset; michael@0: michael@0: struct MathValueRecord { michael@0: mozilla::AutoSwap_PRInt16 mValue; michael@0: Offset mDeviceTable; michael@0: }; michael@0: michael@0: struct RangeRecord { michael@0: GlyphID mStart; michael@0: GlyphID mEnd; michael@0: mozilla::AutoSwap_PRUint16 mStartCoverageIndex; michael@0: }; michael@0: michael@0: struct Coverage { michael@0: mozilla::AutoSwap_PRUint16 mFormat; michael@0: }; michael@0: michael@0: struct CoverageFormat1 { michael@0: mozilla::AutoSwap_PRUint16 mFormat; michael@0: Count16 mGlyphCount; michael@0: // GlyphID mGlyphArray[mGlyphCount] michael@0: }; michael@0: michael@0: struct CoverageFormat2 { michael@0: mozilla::AutoSwap_PRUint16 mFormat; michael@0: Count16 mRangeCount; michael@0: // RangeRecord mRangeArray[mRangeCount]; michael@0: }; michael@0: michael@0: struct MATHTableHeader { michael@0: mozilla::AutoSwap_PRUint32 mVersion; michael@0: Offset mMathConstants; michael@0: Offset mMathGlyphInfo; michael@0: Offset mMathVariants; michael@0: }; michael@0: michael@0: struct MathConstants { michael@0: mozilla::AutoSwap_PRInt16 mInt16[gfxFontEntry::ScriptScriptPercentScaleDown - michael@0: gfxFontEntry::ScriptPercentScaleDown + 1]; michael@0: mozilla::AutoSwap_PRUint16 mUint16[gfxFontEntry::DisplayOperatorMinHeight - michael@0: gfxFontEntry:: michael@0: DelimitedSubFormulaMinHeight + 1]; michael@0: MathValueRecord mMathValues[gfxFontEntry::RadicalKernAfterDegree - michael@0: gfxFontEntry::MathLeading + 1]; michael@0: mozilla::AutoSwap_PRUint16 mRadicalDegreeBottomRaisePercent; michael@0: }; michael@0: michael@0: struct MathGlyphInfo { michael@0: Offset mMathItalicsCorrectionInfo; michael@0: Offset mMathTopAccentAttachment; michael@0: Offset mExtendedShapeCoverage; michael@0: Offset mMathKernInfo; michael@0: }; michael@0: michael@0: struct MathItalicsCorrectionInfo { michael@0: Offset mCoverage; michael@0: Count16 mItalicsCorrectionCount; michael@0: // MathValueRecord mItalicsCorrection[mItalicsCorrectionCount] michael@0: }; michael@0: michael@0: struct MathVariants { michael@0: mozilla::AutoSwap_PRUint16 mMinConnectorOverlap; michael@0: Offset mVertGlyphCoverage; michael@0: Offset mHorizGlyphCoverage; michael@0: Count16 mVertGlyphCount; michael@0: Count16 mHorizGlyphCount; michael@0: // Offset mVertGlyphConstruction[mVertGlyphCount]; michael@0: // Offset mHorizGlyphConstruction[mHorizGlyphCount]; michael@0: }; michael@0: michael@0: struct MathGlyphVariantRecord { michael@0: GlyphID mVariantGlyph; michael@0: mozilla::AutoSwap_PRUint16 mAdvanceMeasurement; michael@0: }; michael@0: michael@0: struct MathGlyphConstruction { michael@0: Offset mGlyphAssembly; michael@0: Count16 mVariantCount; michael@0: // MathGlyphVariantRecord mMathGlyphVariantRecord[mVariantCount] michael@0: }; michael@0: michael@0: struct GlyphPartRecord { michael@0: GlyphID mGlyph; michael@0: mozilla::AutoSwap_PRUint16 mStartConnectorLength; michael@0: mozilla::AutoSwap_PRUint16 mEndConnectorLength; michael@0: mozilla::AutoSwap_PRUint16 mFullAdvance; michael@0: mozilla::AutoSwap_PRUint16 mPartFlags; michael@0: }; michael@0: michael@0: // PartFlags enumeration currently uses only one bit: michael@0: // 0x0001 If set, the part can be skipped or repeated. michael@0: // 0xFFFE Reserved. michael@0: enum { michael@0: PART_FLAG_EXTENDER = 0x01 michael@0: }; michael@0: michael@0: struct GlyphAssembly { michael@0: MathValueRecord mItalicsCorrection; michael@0: Count16 mPartCount; michael@0: // GlyphPartRecord mPartRecords[mPartCount] michael@0: }; michael@0: michael@0: #endif