gfx/thebes/MathTableStructures.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     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/. */
     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.
    12 #ifndef MATH_TABLE_STRUCTURE_H
    13 #define MATH_TABLE_STRUCTURE_H
    15 #include "gfxFontUtils.h"
    17 typedef mozilla::AutoSwap_PRUint16 Count16;
    18 typedef mozilla::AutoSwap_PRUint16 GlyphID;
    19 typedef mozilla::AutoSwap_PRUint16 Offset;
    21 struct MathValueRecord {
    22   mozilla::AutoSwap_PRInt16  mValue;
    23   Offset                     mDeviceTable;
    24 };
    26 struct RangeRecord {
    27   GlyphID                    mStart;
    28   GlyphID                    mEnd;
    29   mozilla::AutoSwap_PRUint16 mStartCoverageIndex;
    30 };
    32 struct Coverage {
    33   mozilla::AutoSwap_PRUint16 mFormat;
    34 };
    36 struct CoverageFormat1 {
    37   mozilla::AutoSwap_PRUint16 mFormat;
    38   Count16                    mGlyphCount;
    39   // GlyphID                 mGlyphArray[mGlyphCount]
    40 };
    42 struct CoverageFormat2 {
    43   mozilla::AutoSwap_PRUint16 mFormat;
    44   Count16                    mRangeCount;
    45   // RangeRecord             mRangeArray[mRangeCount];
    46 };
    48 struct MATHTableHeader {
    49   mozilla::AutoSwap_PRUint32 mVersion;
    50   Offset                     mMathConstants;
    51   Offset                     mMathGlyphInfo;
    52   Offset                     mMathVariants;
    53 };
    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 };
    66 struct MathGlyphInfo {
    67   Offset mMathItalicsCorrectionInfo;
    68   Offset mMathTopAccentAttachment;
    69   Offset mExtendedShapeCoverage;
    70   Offset mMathKernInfo;
    71 };
    73 struct MathItalicsCorrectionInfo {
    74   Offset  mCoverage;
    75   Count16 mItalicsCorrectionCount;
    76   // MathValueRecord mItalicsCorrection[mItalicsCorrectionCount]
    77 };
    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 };
    89 struct MathGlyphVariantRecord {
    90   GlyphID                    mVariantGlyph;
    91   mozilla::AutoSwap_PRUint16 mAdvanceMeasurement;
    92 };
    94 struct MathGlyphConstruction {
    95   Offset                    mGlyphAssembly;
    96   Count16                   mVariantCount;
    97   // MathGlyphVariantRecord mMathGlyphVariantRecord[mVariantCount]
    98 };
   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 };
   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 };
   115 struct GlyphAssembly {
   116   MathValueRecord    mItalicsCorrection;
   117   Count16            mPartCount;
   118   // GlyphPartRecord mPartRecords[mPartCount]
   119 };
   121 #endif

mercurial