gfx/thebes/MathTableStructures.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/thebes/MathTableStructures.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,121 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +// This file contains the structures described in Microsoft's document
     1.9 +// "The MATH table and OpenType Features for Math Processing" (not yet public).
    1.10 +//
    1.11 +// Arrays of varying size are indicated in comments. Typically, gfxMathTable
    1.12 +// will read the header of the structure first, verify that there is enough
    1.13 +// space for the specified arrays and then use a pointer to browse these arrays.
    1.14 +
    1.15 +#ifndef MATH_TABLE_STRUCTURE_H
    1.16 +#define MATH_TABLE_STRUCTURE_H
    1.17 +
    1.18 +#include "gfxFontUtils.h"
    1.19 +
    1.20 +typedef mozilla::AutoSwap_PRUint16 Count16;
    1.21 +typedef mozilla::AutoSwap_PRUint16 GlyphID;
    1.22 +typedef mozilla::AutoSwap_PRUint16 Offset;
    1.23 +
    1.24 +struct MathValueRecord {
    1.25 +  mozilla::AutoSwap_PRInt16  mValue;
    1.26 +  Offset                     mDeviceTable;
    1.27 +};
    1.28 +
    1.29 +struct RangeRecord {
    1.30 +  GlyphID                    mStart;
    1.31 +  GlyphID                    mEnd;
    1.32 +  mozilla::AutoSwap_PRUint16 mStartCoverageIndex;
    1.33 +};
    1.34 +
    1.35 +struct Coverage {
    1.36 +  mozilla::AutoSwap_PRUint16 mFormat;
    1.37 +};
    1.38 +
    1.39 +struct CoverageFormat1 {
    1.40 +  mozilla::AutoSwap_PRUint16 mFormat;
    1.41 +  Count16                    mGlyphCount;
    1.42 +  // GlyphID                 mGlyphArray[mGlyphCount]
    1.43 +};
    1.44 +
    1.45 +struct CoverageFormat2 {
    1.46 +  mozilla::AutoSwap_PRUint16 mFormat;
    1.47 +  Count16                    mRangeCount;
    1.48 +  // RangeRecord             mRangeArray[mRangeCount];
    1.49 +};
    1.50 +
    1.51 +struct MATHTableHeader {
    1.52 +  mozilla::AutoSwap_PRUint32 mVersion;
    1.53 +  Offset                     mMathConstants;
    1.54 +  Offset                     mMathGlyphInfo;
    1.55 +  Offset                     mMathVariants;
    1.56 +};
    1.57 +
    1.58 +struct MathConstants {
    1.59 +  mozilla::AutoSwap_PRInt16  mInt16[gfxFontEntry::ScriptScriptPercentScaleDown -
    1.60 +                                    gfxFontEntry::ScriptPercentScaleDown + 1];
    1.61 +  mozilla::AutoSwap_PRUint16 mUint16[gfxFontEntry::DisplayOperatorMinHeight -
    1.62 +                                     gfxFontEntry::
    1.63 +                                     DelimitedSubFormulaMinHeight + 1];
    1.64 +  MathValueRecord            mMathValues[gfxFontEntry::RadicalKernAfterDegree -
    1.65 +                                         gfxFontEntry::MathLeading + 1];
    1.66 +  mozilla::AutoSwap_PRUint16 mRadicalDegreeBottomRaisePercent;
    1.67 +};
    1.68 +
    1.69 +struct MathGlyphInfo {
    1.70 +  Offset mMathItalicsCorrectionInfo;
    1.71 +  Offset mMathTopAccentAttachment;
    1.72 +  Offset mExtendedShapeCoverage;
    1.73 +  Offset mMathKernInfo;
    1.74 +};
    1.75 +
    1.76 +struct MathItalicsCorrectionInfo {
    1.77 +  Offset  mCoverage;
    1.78 +  Count16 mItalicsCorrectionCount;
    1.79 +  // MathValueRecord mItalicsCorrection[mItalicsCorrectionCount]
    1.80 +};
    1.81 +
    1.82 +struct MathVariants {
    1.83 +  mozilla::AutoSwap_PRUint16 mMinConnectorOverlap;
    1.84 +  Offset                     mVertGlyphCoverage;
    1.85 +  Offset                     mHorizGlyphCoverage;
    1.86 +  Count16                    mVertGlyphCount;
    1.87 +  Count16                    mHorizGlyphCount;
    1.88 +  // Offset                  mVertGlyphConstruction[mVertGlyphCount];
    1.89 +  // Offset                  mHorizGlyphConstruction[mHorizGlyphCount];
    1.90 +};
    1.91 +
    1.92 +struct MathGlyphVariantRecord {
    1.93 +  GlyphID                    mVariantGlyph;
    1.94 +  mozilla::AutoSwap_PRUint16 mAdvanceMeasurement;
    1.95 +};
    1.96 +
    1.97 +struct MathGlyphConstruction {
    1.98 +  Offset                    mGlyphAssembly;
    1.99 +  Count16                   mVariantCount;
   1.100 +  // MathGlyphVariantRecord mMathGlyphVariantRecord[mVariantCount]
   1.101 +};
   1.102 +
   1.103 +struct GlyphPartRecord {
   1.104 +  GlyphID	              mGlyph;
   1.105 +  mozilla::AutoSwap_PRUint16 mStartConnectorLength;
   1.106 +  mozilla::AutoSwap_PRUint16 mEndConnectorLength;
   1.107 +  mozilla::AutoSwap_PRUint16 mFullAdvance;
   1.108 +  mozilla::AutoSwap_PRUint16 mPartFlags;
   1.109 +};
   1.110 +
   1.111 +// PartFlags enumeration currently uses only one bit:
   1.112 +// 0x0001 If set, the part can be skipped or repeated.
   1.113 +// 0xFFFE Reserved.
   1.114 +enum {
   1.115 +  PART_FLAG_EXTENDER = 0x01
   1.116 +};
   1.117 +
   1.118 +struct GlyphAssembly {
   1.119 +  MathValueRecord    mItalicsCorrection;
   1.120 +  Count16            mPartCount;
   1.121 +  // GlyphPartRecord mPartRecords[mPartCount]
   1.122 +};
   1.123 +
   1.124 +#endif

mercurial