astro-ghostcms/.pnpm-store/v3/files/40/66bb2b692801d19aa09f0d4f032...

33 lines
1.1 KiB
Plaintext

// The `maxp` table establishes the memory requirements for the font.
// We need it just to get the number of glyphs in the font.
// https://www.microsoft.com/typography/OTSPEC/maxp.htm
import parse from '../parse';
// Parse the maximum profile `maxp` table.
function parseMaxpTable(data, start) {
const maxp = {};
const p = new parse.Parser(data, start);
maxp.version = p.parseVersion();
maxp.numGlyphs = p.parseUShort();
if (maxp.version === 1.0) {
maxp.maxPoints = p.parseUShort();
maxp.maxContours = p.parseUShort();
maxp.maxCompositePoints = p.parseUShort();
maxp.maxCompositeContours = p.parseUShort();
maxp.maxZones = p.parseUShort();
maxp.maxTwilightPoints = p.parseUShort();
maxp.maxStorage = p.parseUShort();
maxp.maxFunctionDefs = p.parseUShort();
maxp.maxInstructionDefs = p.parseUShort();
maxp.maxStackElements = p.parseUShort();
maxp.maxSizeOfInstructions = p.parseUShort();
maxp.maxComponentElements = p.parseUShort();
maxp.maxComponentDepth = p.parseUShort();
}
return maxp;
}
export default { parse: parseMaxpTable };