Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import r from 'restructure';
import { LookupTable, StateTable1 } from './aat';
let ClassTable = new r.Struct({
length: r.uint16,
coverage: r.uint16,
subFeatureFlags: r.uint32,
stateTable: new StateTable1
});
let WidthDeltaRecord = new r.Struct({
justClass: r.uint32,
beforeGrowLimit: r.fixed32,
beforeShrinkLimit: r.fixed32,
afterGrowLimit: r.fixed32,
afterShrinkLimit: r.fixed32,
growFlags: r.uint16,
shrinkFlags: r.uint16
});
let WidthDeltaCluster = new r.Array(WidthDeltaRecord, r.uint32);
let ActionData = new r.VersionedStruct('actionType', {
0: { // Decomposition action
lowerLimit: r.fixed32,
upperLimit: r.fixed32,
order: r.uint16,
glyphs: new r.Array(r.uint16, r.uint16)
},
1: { // Unconditional add glyph action
1: { // Unconditional add glyph action
addGlyph: r.uint16
},
2: { // Conditional add glyph action
substThreshold: r.fixed32,
addGlyph: r.uint16,
substGlyph: r.uint16
},
3: {}, // Stretch glyph action (no data, not supported by CoreText)
4: { // Ductile glyph action (not supported by CoreText)
variationAxis: r.uint32,
minimumLimit: r.fixed32,
noStretchValue: r.fixed32,
maximumLimit: r.fixed32
},
5: { // Repeated add glyph action
flags: r.uint16,
glyph: r.uint16
}
});
let Action = new r.Struct({
actionClass: r.uint16,
actionType: r.uint16,
actionLength: r.uint32,
actionData: ActionData,
padding: new r.Reserved(r.uint8, t => t.actionLength - t._currentOffset)
import r from 'restructure';
import { LookupTable, StateTable1 } from './aat';
let ClassTable = new r.Struct({
length: r.uint16,
coverage: r.uint16,
subFeatureFlags: r.uint32,
stateTable: new StateTable1
});
let WidthDeltaRecord = new r.Struct({
justClass: r.uint32,
beforeGrowLimit: r.fixed32,
beforeShrinkLimit: r.fixed32,
afterGrowLimit: r.fixed32,
afterShrinkLimit: r.fixed32,
growFlags: r.uint16,
shrinkFlags: r.uint16
});
let WidthDeltaCluster = new r.Array(WidthDeltaRecord, r.uint32);
let ActionData = new r.VersionedStruct('actionType', {
0: { // Decomposition action
lowerLimit: r.fixed32,
upperLimit: r.fixed32,
order: r.uint16,
glyphs: new r.Array(r.uint16, r.uint16)
},
1: { // Unconditional add glyph action
addGlyph: r.uint16
import r from 'restructure';
// PostScript information
export default new r.VersionedStruct(r.fixed32, {
header: { // these fields exist at the top of all versions
italicAngle: r.fixed32, // Italic angle in counter-clockwise degrees from the vertical.
underlinePosition: r.int16, // Suggested distance of the top of the underline from the baseline
underlineThickness: r.int16, // Suggested values for the underline thickness
isFixedPitch: r.uint32, // Whether the font is monospaced
minMemType42: r.uint32, // Minimum memory usage when a TrueType font is downloaded as a Type 42 font
maxMemType42: r.uint32, // Maximum memory usage when a TrueType font is downloaded as a Type 42 font
minMemType1: r.uint32, // Minimum memory usage when a TrueType font is downloaded as a Type 1 font
maxMemType1: r.uint32 // Maximum memory usage when a TrueType font is downloaded as a Type 1 font
},
1: {}, // version 1 has no additional fields
2: {
numberOfGlyphs: r.uint16,
glyphNameIndex: new r.Array(r.uint16, 'numberOfGlyphs'),
names: new r.Array(new r.String(r.uint8))
},
let WidthDeltaRecord = new r.Struct({
justClass: r.uint32,
beforeGrowLimit: r.fixed32,
beforeShrinkLimit: r.fixed32,
afterGrowLimit: r.fixed32,
afterShrinkLimit: r.fixed32,
growFlags: r.uint16,
shrinkFlags: r.uint16
});
let WidthDeltaCluster = new r.Array(WidthDeltaRecord, r.uint32);
let ActionData = new r.VersionedStruct('actionType', {
0: { // Decomposition action
lowerLimit: r.fixed32,
upperLimit: r.fixed32,
order: r.uint16,
glyphs: new r.Array(r.uint16, r.uint16)
},
1: { // Unconditional add glyph action
addGlyph: r.uint16
},
2: { // Conditional add glyph action
substThreshold: r.fixed32,
addGlyph: r.uint16,
substGlyph: r.uint16
},
3: {}, // Stretch glyph action (no data, not supported by CoreText)
import r from 'restructure';
let Axis = new r.Struct({
axisTag: new r.String(4),
minValue: r.fixed32,
defaultValue: r.fixed32,
maxValue: r.fixed32,
flags: r.uint16,
nameID: r.uint16,
name: t => t.parent.parent.name.records.fontFeatures[t.nameID]
});
let Instance = new r.Struct({
nameID: r.uint16,
name: t => t.parent.parent.name.records.fontFeatures[t.nameID],
flags: r.uint16,
coord: new r.Array(r.fixed32, t => t.parent.axisCount),
postscriptNameID: new r.Optional(r.uint16, t => t.parent.instanceSize - t._currentOffset > 0)
});
export default new r.Struct({
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')
});
filterRangeMaxValue: F2DOT14
}
});
let ConditionSet = new r.Struct({
conditionCount: r.uint16,
conditionTable: new r.Array(new r.Pointer(r.uint32, ConditionTable), 'conditionCount')
});
let FeatureTableSubstitutionRecord = new r.Struct({
featureIndex: r.uint16,
alternateFeatureTable: new r.Pointer(r.uint32, Feature, {type: 'parent'})
});
let FeatureTableSubstitution = new r.Struct({
version: r.fixed32,
substitutionCount: r.uint16,
substitutions: new r.Array(FeatureTableSubstitutionRecord, 'substitutionCount')
});
let FeatureVariationRecord = new r.Struct({
conditionSet: new r.Pointer(r.uint32, ConditionSet, {type: 'parent'}),
featureTableSubstitution: new r.Pointer(r.uint32, FeatureTableSubstitution, {type: 'parent'})
});
export let FeatureVariations = new r.Struct({
majorVersion: r.uint16,
minorVersion: r.uint16,
featureVariationRecordCount: r.uint32,
featureVariationRecords: new r.Array(FeatureVariationRecord, 'featureVariationRecordCount')
});
import r from 'restructure';
let Axis = new r.Struct({
axisTag: new r.String(4),
minValue: r.fixed32,
defaultValue: r.fixed32,
maxValue: r.fixed32,
flags: r.uint16,
nameID: r.uint16,
name: t => t.parent.parent.name.records.fontFeatures[t.nameID]
});
let Instance = new r.Struct({
nameID: r.uint16,
name: t => t.parent.parent.name.records.fontFeatures[t.nameID],
flags: r.uint16,
coord: new r.Array(r.fixed32, t => t.parent.axisCount),
postscriptNameID: new r.Optional(r.uint16, t => t.parent.instanceSize - t._currentOffset > 0)
});
export default new r.Struct({
version: r.fixed32,
offsetToData: r.uint16,
maxValue: r.fixed32,
flags: r.uint16,
nameID: r.uint16,
name: t => t.parent.parent.name.records.fontFeatures[t.nameID]
});
let Instance = new r.Struct({
nameID: r.uint16,
name: t => t.parent.parent.name.records.fontFeatures[t.nameID],
flags: r.uint16,
coord: new r.Array(r.fixed32, t => t.parent.axisCount),
postscriptNameID: new r.Optional(r.uint16, t => t.parent.instanceSize - t._currentOffset > 0)
});
export default new r.Struct({
version: r.fixed32,
offsetToData: r.uint16,
countSizePairs: r.uint16,
axisCount: r.uint16,
axisSize: r.uint16,
instanceCount: r.uint16,
instanceSize: r.uint16,
axis: new r.Array(Axis, 'axisCount'),
instance: new r.Array(Instance, 'instanceCount')
});