Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
});
let BaseScriptList = new r.Array(BaseScriptRecord, r.uint16);
// Array of 4-byte baseline identification tags-must be in alphabetical order
let BaseTagList = new r.Array(new r.String(4), r.uint16);
let Axis = new r.Struct({
baseTagList: new r.Pointer(r.uint16, BaseTagList), // May be NULL
baseScriptList: new r.Pointer(r.uint16, BaseScriptList)
});
export default new r.VersionedStruct(r.uint32, {
header: {
horizAxis: new r.Pointer(r.uint16, Axis), // May be NULL
vertAxis: new r.Pointer(r.uint16, Axis) // May be NULL
},
0x00010000: {},
0x00010001: {
itemVariationStore: new r.Pointer(r.uint32, ItemVariationStore)
}
});
});
let LangSysRecord = new r.Struct({
tag: new r.String(4),
langSys: new r.Pointer(r.uint16, LangSysTable, { type: 'parent' })
});
let Script = new r.Struct({
defaultLangSys: new r.Pointer(r.uint16, LangSysTable),
count: r.uint16,
langSysRecords: new r.Array(LangSysRecord, 'count')
});
let ScriptRecord = new r.Struct({
tag: new r.String(4),
script: new r.Pointer(r.uint16, Script, { type: 'parent' })
});
export let ScriptList = new r.Array(ScriptRecord, r.uint16);
//#######################
// Features and Lookups #
//#######################
export let Feature = new r.Struct({
featureParams: r.uint16, // pointer
lookupCount: r.uint16,
lookupListIndexes: new r.Array(r.uint16, 'lookupCount')
});
let FeatureRecord = new r.Struct({
tag: new r.String(4),
2: { // Design units plus contour point
xCoordinate: r.int16,
yCoordinate: r.int16,
anchorPoint: r.uint16
},
3: { // Design units plus Device tables
xCoordinate: r.int16,
yCoordinate: r.int16,
xDeviceTable: new r.Pointer(r.uint16, Device),
yDeviceTable: new r.Pointer(r.uint16, Device)
}
});
let EntryExitRecord = new r.Struct({
entryAnchor: new r.Pointer(r.uint16, Anchor, {type: 'parent'}),
exitAnchor: new r.Pointer(r.uint16, Anchor, {type: 'parent'})
});
let MarkRecord = new r.Struct({
class: r.uint16,
markAnchor: new r.Pointer(r.uint16, Anchor, {type: 'parent'})
});
let MarkArray = new r.Array(MarkRecord, r.uint16);
let BaseRecord = new r.Array(new r.Pointer(r.uint16, Anchor), t => t.parent.classCount);
let BaseArray = new r.Array(BaseRecord, r.uint16);
let ComponentRecord = new r.Array(new r.Pointer(r.uint16, Anchor), t => t.parent.parent.classCount);
let LigatureAttach = new r.Array(ComponentRecord, r.uint16);
let LigatureArray = new r.Array(new r.Pointer(r.uint16, LigatureAttach), r.uint16);
let CaretValue = new r.VersionedStruct(r.uint16, {
1: { // Design units only
coordinate: r.int16
},
2: { // Contour point
caretValuePoint: r.uint16
},
3: { // Design units plus Device table
coordinate: r.int16,
deviceTable: new r.Pointer(r.uint16, Device)
}
});
let LigGlyph = new r.Array(new r.Pointer(r.uint16, CaretValue), r.uint16);
let LigCaretList = new r.Struct({
coverage: new r.Pointer(r.uint16, Coverage),
ligGlyphCount: r.uint16,
ligGlyphs: new r.Array(new r.Pointer(r.uint16, LigGlyph), 'ligGlyphCount')
});
let MarkGlyphSetsDef = new r.Struct({
markSetTableFormat: r.uint16,
markSetCount: r.uint16,
coverage: new r.Array(new r.Pointer(r.uint32, Coverage), 'markSetCount')
});
export default new r.VersionedStruct(r.uint32, {
header: {
glyphClassDef: new r.Pointer(r.uint16, ClassDef),
}
});
// Fix circular reference
GPOSLookup.versions[9].extension.type = GPOSLookup;
export default new r.VersionedStruct(r.uint32, {
header: {
scriptList: new r.Pointer(r.uint16, ScriptList),
featureList: new r.Pointer(r.uint16, FeatureList),
lookupList: new r.Pointer(r.uint16, new LookupList(GPOSLookup))
},
0x00010000: {},
0x00010001: {
featureVariations: new r.Pointer(r.uint32, FeatureVariations)
}
});
// export GPOSLookup for JSTF table
export { GPOSLookup };
lookupRecords: new r.Array(LookupRecord, 'lookupCount')
});
let ClassSet = new r.Array(new r.Pointer(r.uint16, ClassRule), r.uint16);
export let Context = new r.VersionedStruct(r.uint16, {
1: { // Simple context
coverage: new r.Pointer(r.uint16, Coverage),
ruleSetCount: r.uint16,
ruleSets: new r.Array(new r.Pointer(r.uint16, RuleSet), 'ruleSetCount')
},
2: { // Class-based context
coverage: new r.Pointer(r.uint16, Coverage),
classDef: new r.Pointer(r.uint16, ClassDef),
classSetCnt: r.uint16,
classSet: new r.Array(new r.Pointer(r.uint16, ClassSet), 'classSetCnt')
},
3: {
glyphCount: r.uint16,
lookupCount: r.uint16,
coverages: new r.Array(new r.Pointer(r.uint16, Coverage), 'glyphCount'),
lookupRecords: new r.Array(LookupRecord, 'lookupCount')
}
});
//######################################################
// Chaining Contextual Substitution/Positioning Tables #
//######################################################
let ChainRule = new r.Struct({
backtrackGlyphCount: r.uint16,
backtrack: new r.Array(r.uint16, 'backtrackGlyphCount'),
backtrackCoverage: new r.Array(new r.Pointer(r.uint16, Coverage), 'backtrackGlyphCount'),
lookaheadGlyphCount: r.uint16,
lookaheadCoverage: new r.Array(new r.Pointer(r.uint16, Coverage), 'lookaheadGlyphCount'),
glyphCount: r.uint16,
substitutes: new r.Array(r.uint16, 'glyphCount')
}
});
// Fix circular reference
GSUBLookup.versions[7].extension.type = GSUBLookup;
export default new r.VersionedStruct(r.uint32, {
header: {
scriptList: new r.Pointer(r.uint16, ScriptList),
featureList: new r.Pointer(r.uint16, FeatureList),
lookupList: new r.Pointer(r.uint16, new LookupList(GSUBLookup))
},
0x00010000: {},
0x00010001: {
featureVariations: new r.Pointer(r.uint32, FeatureVariations)
}
});
}
}),
3: { // Cursive Attachment Positioning
format: r.uint16,
coverage: new r.Pointer(r.uint16, Coverage),
entryExitCount: r.uint16,
entryExitRecords: new r.Array(EntryExitRecord, 'entryExitCount')
},
4: { // MarkToBase Attachment Positioning
format: r.uint16,
markCoverage: new r.Pointer(r.uint16, Coverage),
baseCoverage: new r.Pointer(r.uint16, Coverage),
classCount: r.uint16,
markArray: new r.Pointer(r.uint16, MarkArray),
baseArray: new r.Pointer(r.uint16, BaseArray)
},
5: { // MarkToLigature Attachment Positioning
format: r.uint16,
markCoverage: new r.Pointer(r.uint16, Coverage),
ligatureCoverage: new r.Pointer(r.uint16, Coverage),
classCount: r.uint16,
markArray: new r.Pointer(r.uint16, MarkArray),
ligatureArray: new r.Pointer(r.uint16, LigatureArray)
},
6: { // MarkToMark Attachment Positioning
format: r.uint16,
mark1Coverage: new r.Pointer(r.uint16, Coverage),
mark2Coverage: new r.Pointer(r.uint16, Coverage),
6: { // MarkToMark Attachment Positioning
format: r.uint16,
mark1Coverage: new r.Pointer(r.uint16, Coverage),
mark2Coverage: new r.Pointer(r.uint16, Coverage),
classCount: r.uint16,
mark1Array: new r.Pointer(r.uint16, MarkArray),
mark2Array: new r.Pointer(r.uint16, BaseArray)
},
7: Context, // Contextual positioning
8: ChainingContext, // Chaining contextual positioning
9: { // Extension Positioning
posFormat: r.uint16,
lookupType: r.uint16, // cannot also be 9
extension: new r.Pointer(r.uint32, GPOSLookup)
}
});
// Fix circular reference
GPOSLookup.versions[9].extension.type = GPOSLookup;
export default new r.VersionedStruct(r.uint32, {
header: {
scriptList: new r.Pointer(r.uint16, ScriptList),
featureList: new r.Pointer(r.uint16, FeatureList),
lookupList: new r.Pointer(r.uint16, new LookupList(GPOSLookup))
},
0x00010000: {},
0x00010001: {
featureVariations: new r.Pointer(r.uint32, FeatureVariations)
import r from 'restructure';
let Setting = new r.Struct({
setting: r.uint16,
nameIndex: r.int16,
name: t => t.parent.parent.parent.name.records.fontFeatures[t.nameIndex]
});
let FeatureName = new r.Struct({
feature: r.uint16,
nSettings: r.uint16,
settingTable: new r.Pointer(r.uint32, new r.Array(Setting, 'nSettings'), { type: 'parent' }),
featureFlags: new r.Bitfield(r.uint8, [
null, null, null, null, null, null,
'hasDefault', 'exclusive'
]),
defaultSetting: r.uint8,
nameIndex: r.int16,
name: t => t.parent.parent.name.records.fontFeatures[t.nameIndex]
});
export default new r.Struct({
version: r.fixed32,
featureNameCount: r.uint16,
reserved1: new r.Reserved(r.uint16),
reserved2: new r.Reserved(r.uint32),
featureNames: new r.Array(FeatureName, 'featureNameCount')
});