Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
yMax: r.int16, // Maximum value (in pels) for this yPelHeight
yMin: r.int16 // Minimum value (in pels) for this yPelHeight
});
let VdmxGroup = new r.Struct({
recs: r.uint16, // Number of height records in this group
startsz: r.uint8, // Starting yPelHeight
endsz: r.uint8, // Ending yPelHeight
entries: new r.Array(vTable, 'recs') // The VDMX records
});
export default new r.Struct({
version: r.uint16, // Version number (0 or 1)
numRecs: r.uint16, // Number of VDMX groups present
numRatios: r.uint16, // Number of aspect ratio groupings
ratioRanges: new r.Array(Ratio, 'numRatios'), // Ratio ranges
offsets: new r.Array(r.uint16, 'numRatios'), // Offset to the VDMX group for this ratio range
groups: new r.Array(VdmxGroup, 'numRecs') // The actual VDMX groupings
});
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 GPOSLookup = new r.VersionedStruct('lookupType', {
1: new r.VersionedStruct(r.uint16, { // Single Adjustment
1: { // Single positioning value
coverage: new r.Pointer(r.uint16, Coverage),
valueFormat: ValueFormat,
value: new ValueRecord()
},
2: {
coverage: new r.Pointer(r.uint16, Coverage),
valueFormat: ValueFormat,
valueCount: r.uint16,
values: new r.LazyArray(new ValueRecord(), 'valueCount')
}
minCoord: new r.Pointer(r.uint16, BaseCoord), // May be NULL
maxCoord: new r.Pointer(r.uint16, BaseCoord), // May be NULL
featMinMaxCount: r.uint16, // May be 0
featMinMaxRecords: new r.Array(FeatMinMaxRecord, 'featMinMaxCount') // In alphabetical order
});
let BaseLangSysRecord = new r.Struct({
tag: new r.String(4), // 4-byte language system identification tag
minMax: new r.Pointer(r.uint16, MinMax, {type: 'parent'})
});
let BaseScript = new r.Struct({
baseValues: new r.Pointer(r.uint16, BaseValues), // May be NULL
defaultMinMax: new r.Pointer(r.uint16, MinMax), // May be NULL
baseLangSysCount: r.uint16, // May be 0
baseLangSysRecords: new r.Array(BaseLangSysRecord, 'baseLangSysCount') // in alphabetical order by BaseLangSysTag
});
let BaseScriptRecord = new r.Struct({
tag: new r.String(4), // 4-byte script identification tag
script: new r.Pointer(r.uint16, BaseScript, {type: 'parent'})
});
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)
});
deltas: new r.Array(r.int16, 32)
},
1: { // Distance-based, with mapping
deltas: new r.Array(r.int16, 32),
mappingData: new LookupTable(r.uint16)
},
2: { // Control point-based, no mapping
standardGlyph: r.uint16,
controlPoints: new r.Array(r.uint16, 32)
},
3: { // Control point-based, with mapping
standardGlyph: r.uint16,
controlPoints: new r.Array(r.uint16, 32),
mappingData: new LookupTable(r.uint16)
}
});
export default new r.Struct({
version: r.fixed32,
format: r.uint16,
defaultBaseline: r.uint16,
subtable: BslnSubtable
});
nPairs: r.uint16,
searchRange: r.uint16,
entrySelector: r.uint16,
rangeShift: r.uint16,
pairs: new r.Array(KernPair, 'nPairs')
},
2: {
rowWidth: r.uint16,
leftTable: new r.Pointer(r.uint16, ClassTable, {type: 'parent'}),
rightTable: new r.Pointer(r.uint16, ClassTable, {type: 'parent'}),
array: new r.Pointer(r.uint16, Kern2Array, {type: 'parent'})
},
3: {
glyphCount: r.uint16,
kernValueCount: r.uint8,
leftClassCount: r.uint8,
rightClassCount: r.uint8,
flags: r.uint8,
kernValue: new r.Array(r.int16, 'kernValueCount'),
leftClass: new r.Array(r.uint8, 'glyphCount'),
rightClass: new r.Array(r.uint8, 'glyphCount'),
kernIndex: new r.Array(r.uint8, t => t.leftClassCount * t.rightClassCount)
}
});
let KernTable = new r.VersionedStruct('version', {
0: { // Microsoft uses this format
subVersion: r.uint16, // Microsoft has an extra sub-table version number
length: r.uint16, // Length of the subtable, in bytes
format: r.uint8, // Format of subtable
});
let LangTagRecord = new r.Struct({
length: r.uint16,
tag: new r.Pointer(r.uint16, new r.String('length', 'utf16be'), {type: 'parent', relativeTo: 'stringOffset'})
});
var NameTable = new r.VersionedStruct(r.uint16, {
0: {
count: r.uint16,
stringOffset: r.uint16,
records: new r.Array(NameRecord, 'count')
},
1: {
count: r.uint16,
stringOffset: r.uint16,
records: new r.Array(NameRecord, 'count'),
langTagCount: r.uint16,
langTags: new r.Array(LangTagRecord, 'langTagCount')
}
});
export default NameTable;
const NAMES = [
'copyright',
'fontFamily',
'fontSubfamily',
'uniqueSubfamily',
'fullName',
'version',
'postscriptName', // Note: A font may have only one PostScript name and that name must be ASCII.
2: { // Class pair adjustment
coverage: new r.Pointer(r.uint16, Coverage),
valueFormat1: ValueFormat,
valueFormat2: ValueFormat,
classDef1: new r.Pointer(r.uint16, ClassDef),
classDef2: new r.Pointer(r.uint16, ClassDef),
class1Count: r.uint16,
class2Count: r.uint16,
classRecords: new r.LazyArray(new r.LazyArray(Class2Record, 'class2Count'), 'class1Count')
}
}),
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),
import r from 'restructure';
import tables from './';
let WOFFDirectoryEntry = new r.Struct({
tag: new r.String(4),
offset: new r.Pointer(r.uint32, 'void', {type: 'global'}),
compLength: r.uint32,
length: r.uint32,
origChecksum: r.uint32
});
let WOFFDirectory = new r.Struct({
tag: new r.String(4), // should be 'wOFF'
flavor: r.uint32,
length: r.uint32,
numTables: r.uint16,
reserved: new r.Reserved(r.uint16),
totalSfntSize: r.uint32,
majorVersion: r.uint16,
minorVersion: r.uint16,
metaOffset: r.uint32,
metaLength: r.uint32,
metaOrigLength: r.uint32,
privOffset: r.uint32,
privLength: r.uint32,
tables: new r.Array(WOFFDirectoryEntry, 'numTables')
});
WOFFDirectory.process = function() {
let tables = {};
for (let table of this.tables) {
tables[table.tag] = table;
});
let UnicodeValueRange = new r.Struct({
startUnicodeValue: r.uint24,
additionalCount: r.uint8
});
let UVSMapping = new r.Struct({
unicodeValue: r.uint24,
glyphID: r.uint16
});
let DefaultUVS = new r.Array(UnicodeValueRange, r.uint32);
let NonDefaultUVS = new r.Array(UVSMapping, r.uint32);
let VarSelectorRecord = new r.Struct({
varSelector: r.uint24,
defaultUVS: new r.Pointer(r.uint32, DefaultUVS, {type: 'parent'}),
nonDefaultUVS: new r.Pointer(r.uint32, NonDefaultUVS, {type: 'parent'})
});
let CmapSubtable = new r.VersionedStruct(r.uint16, {
0: { // Byte encoding
length: r.uint16, // Total table length in bytes (set to 262 for format 0)
language: r.uint16, // Language code for this encoding subtable, or zero if language-independent
codeMap: new r.LazyArray(r.uint8, 256)
},
2: { // High-byte mapping (CJK)
length: r.uint16,
language: r.uint16,
subHeaderKeys: new r.Array(r.uint16, 256),
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)
});
let PostcompensationAction = new r.Array(Action, r.uint32);
let PostCompensationTable = new r.Struct({
lookupTable: new LookupTable(new r.Pointer(r.uint16, PostcompensationAction))
});
let JustificationTable = new r.Struct({
classTable: new r.Pointer(r.uint16, ClassTable, { type: 'parent' }),
wdcOffset: r.uint16,
postCompensationTable: new r.Pointer(r.uint16, PostCompensationTable, { type: 'parent' }),