/// <summary> Creates a new kern by reading it from the specified stream. </summary> /// <param name="reader"> The correctly positioned stream to read from. </param> public Kern(BinaryReader reader) { Contract.Requires(reader != null); int count = reader.ReadInt16(); var corrections = new short[count]; for (int i = 0; i < corrections.Length; i++) { corrections[i] = reader.ReadValueRecord(); } Corrections = new ReadOnlyCollection<short>(corrections); var values = new short[count + 1]; for (int i = 0; i < values.Length; i++) { values[i] = reader.ReadValueRecord(); } Values = new ReadOnlyCollection<short>(values); }
/// <summary> Creates a new glyph variant record by reading it from the specified stream. </summary> /// <param name="reader"> The correctly positioned stream to read from. </param> public GlyphAssemblyTable(BinaryReader reader) { Contract.Requires(reader != null); this.ItalicsCorrection = reader.ReadValueRecord(); //get the parts: var parts = new PartRecord[reader.ReadUInt16()]; for (int i = 0; i < parts.Length; i++) { parts[i] = new PartRecord(reader); } Parts = new ReadOnlyCollection<PartRecord>(parts); }
/// <summary> Creates a new italics correction info table by reading it from the specified stream. </summary> /// <param name="reader"> The correctly positioned stream to read from. </param> public ItalicsCorrectionInfoTable(BinaryReader reader) { Contract.Requires(reader != null); long start = reader.BaseStream.Position;//the start of this correction info table uint offsetToCoverageTable = reader.ReadUInt16EvenThoughSpecsSays32(); //read corrections var corrections = new short[reader.ReadUInt16()]; for (int i = 0; i < corrections.Length; i++) { corrections[i] = reader.ReadValueRecord(); } Corrections = new ReadOnlyCollection<short>(corrections); //read coverage table reader.BaseStream.Position = start + offsetToCoverageTable; CoverageTable = reader.ReadCoverageTable(); }
/// <summary> Creates a new math constants table by reading it from the specified stream. </summary> /// <param name="reader"> The correctly positioned stream to read from. </param> public ConstantsTable(BinaryReader reader) { //shorts to read: (length 8) ScriptPercentScaleDown = reader.ReadInt16(); ScriptScriptPercentScaleDown = reader.ReadInt16(); DelimitedSubFormulaMinHeight = reader.ReadInt16(); DisplayOperatorMinHeight = reader.ReadInt16(); //MathValueRecords to read: //50 times (2 + 4) = 300 MathLeading = reader.ReadValueRecord(); AxisHeight = reader.ReadValueRecord(); AccentBaseHeight = reader.ReadValueRecord(); FlattenedAccentBaseHeight = reader.ReadValueRecord(); SubscriptShiftDown = reader.ReadValueRecord(); SubscriptTopMax = reader.ReadValueRecord(); SubscriptBaselineDropMin = reader.ReadValueRecord(); SuperscriptShiftUp = reader.ReadValueRecord(); SuperscriptShiftUpCramped = reader.ReadValueRecord(); SuperscriptBottomMin = reader.ReadValueRecord(); SuperscriptBaselineDropMax = reader.ReadValueRecord(); SubSuperscriptGapMin = reader.ReadValueRecord(); SuperscriptBottomMaxWithSubscript = reader.ReadValueRecord(); SpaceAfterScript = reader.ReadValueRecord(); UpperLimitGapMin = reader.ReadValueRecord();//ok UpperLimitBaselineRiseMin = reader.ReadValueRecord(); LowerLimitGapMin = reader.ReadValueRecord(); LowerLimitBaselineDropMin = reader.ReadValueRecord(); StackTopShiftUp = reader.ReadValueRecord(); StackTopDisplayStyleShiftUp = reader.ReadValueRecord(); StackBottomShiftDown = reader.ReadValueRecord(); StackBottomDisplayStyleShiftDown = reader.ReadValueRecord(); StackGapMin = reader.ReadValueRecord(); StackDisplayStyleGapMin = reader.ReadValueRecord(); StretchStackTopShiftUp = reader.ReadValueRecord(); StretchStackBottomShiftDown = reader.ReadValueRecord(); StretchStackGapAboveMin = reader.ReadValueRecord();//ok StretchStackGapBelowMin = reader.ReadValueRecord();//ok FractionNumeratorShiftUp = reader.ReadValueRecord(); FractionNumeratorDisplayStyleShiftUp = reader.ReadValueRecord(); FractionDenominatorShiftDown = reader.ReadValueRecord(); FractionDenominatorDisplayStyleShiftDown = reader.ReadValueRecord(); FractionNumeratorGapMin = reader.ReadValueRecord(); FractionNumDisplayStyleGapMin = reader.ReadValueRecord(); FractionRuleThickness = reader.ReadValueRecord(); FractionDenominatorGapMin = reader.ReadValueRecord(); FractionDenomDisplayStyleGapMin = reader.ReadValueRecord();// SkewedFractionHorizontalGap = reader.ReadValueRecord(); SkewedFractionVerticalGap = reader.ReadValueRecord(); OverbarVerticalGap = reader.ReadValueRecord(); OverbarRuleThickness = reader.ReadValueRecord(); OverbarExtraAscender = reader.ReadValueRecord(); UnderbarVerticalGap = reader.ReadValueRecord(); UnderbarRuleThickness = reader.ReadValueRecord(); UnderbarExtraDescender = reader.ReadValueRecord(); RadicalVerticalGap = reader.ReadValueRecord(); RadicalDisplayStyleVerticalGap = reader.ReadValueRecord(); RadicalRuleThickness = reader.ReadValueRecord(); RadicalExtraAscender = reader.ReadValueRecord(); RadicalKernBeforeDegree = reader.ReadValueRecord(); RadicalKernAfterDegree = reader.ReadValueRecord(); //and lastly another short to read: RadicalDegreeBottomRaisePercent = reader.ReadInt16(); //length 2 //total length: 8 + 300 + 2 = 310 }