//
//  table_M_A_T_H_.h
//  GSFontTools
//
//  Created by Georg Seifert on 13.08.14.
//
//

#import <GSFontTools/OTTables.h>
#import <GSFontTools/TTFont.h>

#import <GSFontTools/GSXMLWriter.h>

@class OTMathConstants;
@class OTMathGlyphInfo;
@class OTMathVariants;

@interface OTMATH : OTBaseTable {
	Fixed version;
	OTMathConstants *_mathConstants;
	OTMathGlyphInfo *_mathGlyphInfo;
	OTMathVariants *_mathVariants;
}
@property (nonatomic) Fixed version;
@property (nonatomic, retain) OTMathConstants *mathConstants;
@property (nonatomic, retain) OTMathGlyphInfo *mathGlyphInfo;
@property (nonatomic, retain) OTMathVariants *mathVariants;
@end

@interface table_M_A_T_H_ : BaseTTXConverter
@end

@interface OTMathValueRecord : OTBaseTable {
	NSInteger _value;
	OTDevice *_deviceTable;
}
@property (nonatomic) NSInteger value;
@property (nonatomic, retain) OTDevice *deviceTable;
@end

#pragma mark OTMathConstants

@interface OTMathConstants : OTBaseTable {
	int16_t _scriptPercentScaleDown;
	int16_t _scriptScriptPercentScaleDown;
	uint16_t _delimitedSubFormulaMinHeight;
	uint16_t _displayOperatorMinHeight;
	OTMathValueRecord *_mathLeading;
	OTMathValueRecord *_axisHeight;
	OTMathValueRecord *_accentBaseHeight;
	OTMathValueRecord *_flattenedAccentBaseHeight;
	OTMathValueRecord *_subscriptShiftDown;
	OTMathValueRecord *_subscriptTopMax;
	OTMathValueRecord *_subscriptBaselineDropMin;
	OTMathValueRecord *_superscriptShiftUp;
	OTMathValueRecord *_superscriptShiftUpCramped;
	OTMathValueRecord *_superscriptBottomMin;
	OTMathValueRecord *_superscriptBaselineDropMax;
	OTMathValueRecord *_subSuperscriptGapMin;
	OTMathValueRecord *_superscriptBottomMaxWithSubscript;
	OTMathValueRecord *_spaceAfterScript;
	OTMathValueRecord *_upperLimitGapMin;
	OTMathValueRecord *_upperLimitBaselineRiseMin;
	OTMathValueRecord *_lowerLimitGapMin;
	OTMathValueRecord *_lowerLimitBaselineDropMin;
	OTMathValueRecord *_stackTopShiftUp;
	OTMathValueRecord *_stackTopDisplayStyleShiftUp;
	OTMathValueRecord *_stackBottomShiftDown;
	OTMathValueRecord *_stackBottomDisplayStyleShiftDown;
	OTMathValueRecord *_stackGapMin;
	OTMathValueRecord *_stackDisplayStyleGapMin;
	OTMathValueRecord *_stretchStackTopShiftUp;
	OTMathValueRecord *_stretchStackBottomShiftDown;
	OTMathValueRecord *_stretchStackGapAboveMin;
	OTMathValueRecord *_stretchStackGapBelowMin;
	OTMathValueRecord *_fractionNumeratorShiftUp;
	OTMathValueRecord *_fractionNumeratorDisplayStyleShiftUp;
	OTMathValueRecord *_fractionDenominatorShiftDown;
	OTMathValueRecord *_fractionDenominatorDisplayStyleShiftDown;
	OTMathValueRecord *_fractionNumeratorGapMin;
	OTMathValueRecord *_fractionNumDisplayStyleGapMin;
	OTMathValueRecord *_fractionRuleThickness;
	OTMathValueRecord *_fractionDenominatorGapMin;
	OTMathValueRecord *_fractionDenomDisplayStyleGapMin;
	OTMathValueRecord *_skewedFractionHorizontalGap;
	OTMathValueRecord *_skewedFractionVerticalGap;
	OTMathValueRecord *_overbarVerticalGap;
	OTMathValueRecord *_overbarRuleThickness;
	OTMathValueRecord *_overbarExtraAscender;
	OTMathValueRecord *_underbarVerticalGap;
	OTMathValueRecord *_underbarRuleThickness;
	OTMathValueRecord *_underbarExtraDescender;
	OTMathValueRecord *_radicalVerticalGap;
	OTMathValueRecord *_radicalDisplayStyleVerticalGap;
	OTMathValueRecord *_radicalRuleThickness;
	OTMathValueRecord *_radicalExtraAscender;
	OTMathValueRecord *_radicalKernBeforeDegree;
	OTMathValueRecord *_radicalKernAfterDegree;
	uint16_t _radicalDegreeBottomRaisePercent;
}
@property (nonatomic) int16_t scriptPercentScaleDown;
@property (nonatomic) int16_t scriptScriptPercentScaleDown;
@property (nonatomic) uint16_t delimitedSubFormulaMinHeight;
@property (nonatomic) uint16_t displayOperatorMinHeight;
@property (nonatomic, retain) OTMathValueRecord *mathLeading;
@property (nonatomic, retain) OTMathValueRecord *axisHeight;
@property (nonatomic, retain) OTMathValueRecord *accentBaseHeight;
@property (nonatomic, retain) OTMathValueRecord *flattenedAccentBaseHeight;
@property (nonatomic, retain) OTMathValueRecord *subscriptShiftDown;
@property (nonatomic, retain) OTMathValueRecord *subscriptTopMax;
@property (nonatomic, retain) OTMathValueRecord *subscriptBaselineDropMin;
@property (nonatomic, retain) OTMathValueRecord *superscriptShiftUp;
@property (nonatomic, retain) OTMathValueRecord *superscriptShiftUpCramped;
@property (nonatomic, retain) OTMathValueRecord *superscriptBottomMin;
@property (nonatomic, retain) OTMathValueRecord *superscriptBaselineDropMax;
@property (nonatomic, retain) OTMathValueRecord *subSuperscriptGapMin;
@property (nonatomic, retain) OTMathValueRecord *superscriptBottomMaxWithSubscript;
@property (nonatomic, retain) OTMathValueRecord *spaceAfterScript;
@property (nonatomic, retain) OTMathValueRecord *upperLimitGapMin;
@property (nonatomic, retain) OTMathValueRecord *upperLimitBaselineRiseMin;
@property (nonatomic, retain) OTMathValueRecord *lowerLimitGapMin;
@property (nonatomic, retain) OTMathValueRecord *lowerLimitBaselineDropMin;
@property (nonatomic, retain) OTMathValueRecord *stackTopShiftUp;
@property (nonatomic, retain) OTMathValueRecord *stackTopDisplayStyleShiftUp;
@property (nonatomic, retain) OTMathValueRecord *stackBottomShiftDown;
@property (nonatomic, retain) OTMathValueRecord *stackBottomDisplayStyleShiftDown;
@property (nonatomic, retain) OTMathValueRecord *stackGapMin;
@property (nonatomic, retain) OTMathValueRecord *stackDisplayStyleGapMin;
@property (nonatomic, retain) OTMathValueRecord *stretchStackTopShiftUp;
@property (nonatomic, retain) OTMathValueRecord *stretchStackBottomShiftDown;
@property (nonatomic, retain) OTMathValueRecord *stretchStackGapAboveMin;
@property (nonatomic, retain) OTMathValueRecord *stretchStackGapBelowMin;
@property (nonatomic, retain) OTMathValueRecord *fractionNumeratorShiftUp;
@property (nonatomic, retain) OTMathValueRecord *fractionNumeratorDisplayStyleShiftUp;
@property (nonatomic, retain) OTMathValueRecord *fractionDenominatorShiftDown;
@property (nonatomic, retain) OTMathValueRecord *fractionDenominatorDisplayStyleShiftDown;
@property (nonatomic, retain) OTMathValueRecord *fractionNumeratorGapMin;
@property (nonatomic, retain) OTMathValueRecord *fractionNumDisplayStyleGapMin;
@property (nonatomic, retain) OTMathValueRecord *fractionRuleThickness;
@property (nonatomic, retain) OTMathValueRecord *fractionDenominatorGapMin;
@property (nonatomic, retain) OTMathValueRecord *fractionDenomDisplayStyleGapMin;
@property (nonatomic, retain) OTMathValueRecord *skewedFractionHorizontalGap;
@property (nonatomic, retain) OTMathValueRecord *skewedFractionVerticalGap;
@property (nonatomic, retain) OTMathValueRecord *overbarVerticalGap;
@property (nonatomic, retain) OTMathValueRecord *overbarRuleThickness;
@property (nonatomic, retain) OTMathValueRecord *overbarExtraAscender;
@property (nonatomic, retain) OTMathValueRecord *underbarVerticalGap;
@property (nonatomic, retain) OTMathValueRecord *underbarRuleThickness;
@property (nonatomic, retain) OTMathValueRecord *underbarExtraDescender;
@property (nonatomic, retain) OTMathValueRecord *radicalVerticalGap;
@property (nonatomic, retain) OTMathValueRecord *radicalDisplayStyleVerticalGap;
@property (nonatomic, retain) OTMathValueRecord *radicalRuleThickness;
@property (nonatomic, retain) OTMathValueRecord *radicalExtraAscender;
@property (nonatomic, retain) OTMathValueRecord *radicalKernBeforeDegree;
@property (nonatomic, retain) OTMathValueRecord *radicalKernAfterDegree;
@property (nonatomic) uint16_t radicalDegreeBottomRaisePercent;
@end

@interface OTMathItalicsCorrectionInfo : OTBaseTable {
	OTCoverage *_coverage;
	uint16_t _italicsCorrectionCount;
	NSMutableArray *_italicsCorrections;
}
@property (nonatomic, retain) OTCoverage *coverage;
@property (nonatomic) uint16_t italicsCorrectionCount;
@property (nonatomic, retain) NSMutableArray *italicsCorrections;

@end

@interface OTMathTopAccentAttachment : OTBaseTable {
	OTCoverage *_topAccentCoverage;
	uint16_t _topAccentAttachmentCount;
	NSMutableArray *_topAccentAttachment;
}
@property (nonatomic, retain) OTCoverage *topAccentCoverage;
@property (nonatomic) uint16_t topAccentAttachmentCount;
@property (nonatomic, retain) NSMutableArray *topAccentAttachment;

@end

@interface OTMathKernInfo : OTBaseTable {
	OTCoverage *_mathKernCoverage;
	uint16_t _mathKernCount;
	NSMutableArray *_mathKernInfoRecords;
}
@property (nonatomic, retain) OTCoverage *mathKernCoverage;
@property (nonatomic) uint16_t mathKernCount;
@property (nonatomic, retain) NSMutableArray *mathKernInfoRecords;

@end

@interface OTMathKern : OTBaseTable {
	uint16_t _heightCount;
	NSMutableArray *_correctionHeights;
	NSMutableArray *_kernValues;
}
@property (nonatomic) uint16_t heightCount;
@property (nonatomic, retain) NSMutableArray *correctionHeights;
@property (nonatomic, retain) NSMutableArray *kernValues;

@end

@interface OTMathKernInfoRecord : OTBaseTable {
	OTMathKern *_topRightMathKern;
	OTMathKern *_topLeftMathKern;
	OTMathKern *_bottomRightMathKern;
	OTMathKern *_bottomLeftMathKern;
}
@property (nonatomic, retain) OTMathKern *topRightMathKern;
@property (nonatomic, retain) OTMathKern *topLeftMathKern;
@property (nonatomic, retain) OTMathKern *bottomRightMathKern;
@property (nonatomic, retain) OTMathKern *bottomLeftMathKern;
@end

@interface OTMathGlyphInfo : OTBaseTable {
	OTMathItalicsCorrectionInfo *_mathItalicsCorrectionInfo;
	OTMathTopAccentAttachment *_mathTopAccentAttachment;
	OTCoverage *_extendedShapeCoverage;
	OTMathKernInfo *_mathKernInfo;
}
@property (nonatomic, strong) OTMathItalicsCorrectionInfo *mathItalicsCorrectionInfo;
@property (nonatomic, strong) OTMathTopAccentAttachment *mathTopAccentAttachment;
@property (nonatomic, strong) OTCoverage *extendedShapeCoverage;
@property (nonatomic, strong) OTMathKernInfo *mathKernInfo;
@end

@interface OTMathVariants : OTBaseTable {
	uint16 _minConnectorOverlap;
	OTCoverage *_vertGlyphCoverage;
	OTCoverage *_horizGlyphCoverage;
	uint16 _vertGlyphCount;
	uint16 _horizGlyphCount;
	NSMutableArray *_vertGlyphConstruction;
	NSMutableArray *_horizGlyphConstruction;
}
@property (nonatomic) uint16 minConnectorOverlap;
@property (nonatomic, retain) OTCoverage *vertGlyphCoverage;
@property (nonatomic, retain) OTCoverage *horizGlyphCoverage;
@property (nonatomic) uint16 vertGlyphCount;
@property (nonatomic) uint16 horizGlyphCount;
@property (nonatomic, retain) NSMutableArray *vertGlyphConstruction;
@property (nonatomic, retain) NSMutableArray *horizGlyphConstruction;
@end

@interface OTGlyphAssembly : OTBaseTable {
	OTMathValueRecord *_italicsCorrection;
	uint16 _partCount;
	NSMutableArray *_partRecords;
}
@property (nonatomic, retain) OTMathValueRecord *italicsCorrection;
@property (nonatomic) uint16 partCount;
@property (nonatomic, retain) NSMutableArray *partRecords;
@end

@interface OTGlyphPartRecord : OTBaseTable

@property (nonatomic) uint16 glyph;
@property (nonatomic) uint16 startConnectorLength;
@property (nonatomic) uint16 endConnectorLength;
@property (nonatomic) uint16 fullAdvance;
@property (nonatomic) uint16 partFlags;

@end

@interface OTMathGlyphVariantRecord : OTBaseTable

@property (nonatomic) uint16 variantGlyph;
@property (nonatomic) uint16 advanceMeasurement;

@end

@interface OTMathGlyphConstruction : OTBaseTable {
	OTGlyphAssembly *_glyphAssembly;
	uint16 _variantCount;
	NSMutableArray *_mathGlyphVariantRecords; // OTMathGlyphVariantRecord
}
@property (nonatomic, retain) OTGlyphAssembly *glyphAssembly;
@property (nonatomic) uint16 variantCount;
@property (nonatomic, retain) NSMutableArray *mathGlyphVariantRecords;
@end

@interface OTVertGlyphConstruction : OTMathGlyphConstruction

@end

@interface OTHorizGlyphConstruction : OTMathGlyphConstruction

@end

