28 lines
921 B
Plaintext
28 lines
921 B
Plaintext
// The `hhea` table contains information for horizontal layout.
|
|
// https://www.microsoft.com/typography/OTSPEC/hhea.htm
|
|
|
|
import parse from '../parse';
|
|
|
|
// Parse the horizontal header `hhea` table
|
|
function parseHheaTable(data, start) {
|
|
const hhea = {};
|
|
const p = new parse.Parser(data, start);
|
|
hhea.version = p.parseVersion();
|
|
hhea.ascender = p.parseShort();
|
|
hhea.descender = p.parseShort();
|
|
hhea.lineGap = p.parseShort();
|
|
hhea.advanceWidthMax = p.parseUShort();
|
|
hhea.minLeftSideBearing = p.parseShort();
|
|
hhea.minRightSideBearing = p.parseShort();
|
|
hhea.xMaxExtent = p.parseShort();
|
|
hhea.caretSlopeRise = p.parseShort();
|
|
hhea.caretSlopeRun = p.parseShort();
|
|
hhea.caretOffset = p.parseShort();
|
|
p.relativeOffset += 8;
|
|
hhea.metricDataFormat = p.parseShort();
|
|
hhea.numberOfHMetrics = p.parseUShort();
|
|
return hhea;
|
|
}
|
|
|
|
export default { parse: parseHheaTable };
|