DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (dcc6d7a0dc00)

VCS Links

Line Code
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
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

// This file contains the structures described in Microsoft's document
// "The MATH table and OpenType Features for Math Processing" (not yet public).
//
// Arrays of varying size are indicated in comments. Typically, gfxMathTable
// will read the header of the structure first, verify that there is enough
// space for the specified arrays and then use a pointer to browse these arrays.

#ifndef MATH_TABLE_STRUCTURE_H
#define MATH_TABLE_STRUCTURE_H

#include "gfxFontUtils.h"

typedef mozilla::AutoSwap_PRUint16 Count16;
typedef mozilla::AutoSwap_PRUint16 GlyphID;
typedef mozilla::AutoSwap_PRUint16 Offset;

struct MathValueRecord {
  mozilla::AutoSwap_PRInt16  mValue;
  Offset                     mDeviceTable;
};

struct RangeRecord {
  GlyphID                    mStart;
  GlyphID                    mEnd;
  mozilla::AutoSwap_PRUint16 mStartCoverageIndex;
};

struct Coverage {
  mozilla::AutoSwap_PRUint16 mFormat;
};

struct CoverageFormat1 {
  mozilla::AutoSwap_PRUint16 mFormat;
  Count16                    mGlyphCount;
  // GlyphID                 mGlyphArray[mGlyphCount]
};

struct CoverageFormat2 {
  mozilla::AutoSwap_PRUint16 mFormat;
  Count16                    mRangeCount;
  // RangeRecord             mRangeArray[mRangeCount];
};

struct MATHTableHeader {
  mozilla::AutoSwap_PRUint32 mVersion;
  Offset                     mMathConstants;
  Offset                     mMathGlyphInfo;
  Offset                     mMathVariants;
};

struct MathConstants {
  mozilla::AutoSwap_PRInt16  mInt16[gfxFontEntry::ScriptScriptPercentScaleDown -
                                    gfxFontEntry::ScriptPercentScaleDown + 1];
  mozilla::AutoSwap_PRUint16 mUint16[gfxFontEntry::DisplayOperatorMinHeight -
                                     gfxFontEntry::
                                     DelimitedSubFormulaMinHeight + 1];
  MathValueRecord            mMathValues[gfxFontEntry::RadicalKernAfterDegree -
                                         gfxFontEntry::MathLeading + 1];
  mozilla::AutoSwap_PRUint16 mRadicalDegreeBottomRaisePercent;
};

struct MathGlyphInfo {
  Offset mMathItalicsCorrectionInfo;
  Offset mMathTopAccentAttachment;
  Offset mExtendedShapeCoverage;
  Offset mMathKernInfo;
};

struct MathItalicsCorrectionInfo {
  Offset  mCoverage;
  Count16 mItalicsCorrectionCount;
  // MathValueRecord mItalicsCorrection[mItalicsCorrectionCount]
};

struct MathVariants {
  mozilla::AutoSwap_PRUint16 mMinConnectorOverlap;
  Offset                     mVertGlyphCoverage;
  Offset                     mHorizGlyphCoverage;
  Count16                    mVertGlyphCount;
  Count16                    mHorizGlyphCount;
  // Offset                  mVertGlyphConstruction[mVertGlyphCount];
  // Offset                  mHorizGlyphConstruction[mHorizGlyphCount];
};

struct MathGlyphVariantRecord {
  GlyphID                    mVariantGlyph;
  mozilla::AutoSwap_PRUint16 mAdvanceMeasurement;
};

struct MathGlyphConstruction {
  Offset                    mGlyphAssembly;
  Count16                   mVariantCount;
  // MathGlyphVariantRecord mMathGlyphVariantRecord[mVariantCount]
};

struct GlyphPartRecord {
  GlyphID                    mGlyph;
  mozilla::AutoSwap_PRUint16 mStartConnectorLength;
  mozilla::AutoSwap_PRUint16 mEndConnectorLength;
  mozilla::AutoSwap_PRUint16 mFullAdvance;
  mozilla::AutoSwap_PRUint16 mPartFlags;
};

// PartFlags enumeration currently uses only one bit:
// 0x0001 If set, the part can be skipped or repeated.
// 0xFFFE Reserved.
enum {
  PART_FLAG_EXTENDER = 0x01
};

struct GlyphAssembly {
  MathValueRecord    mItalicsCorrection;
  Count16            mPartCount;
  // GlyphPartRecord mPartRecords[mPartCount]
};

#endif