The SamsaGlyph object represents a glyph as either:
SamsaGlyph()
SamsaGlyph.componentspoints property still contains the 4 phantom points.SamsaGlyph.endPtspoints array that indicate the last point of each contour.SamsaGlyph.fontSamsaFont object that the glyph belongs to.SamsaGlyph.instructionLengthSamsaGlyph.instructionsSamsaGlyph.instructionLength is non-zero, this is a SamsaBuffer object containing the instruction bytes for the glyph; otherwise it is undefined.SamsaGlyph.nameSamsaGlyph.numberOfContoursSamsaGlyph.numPointsSamsaGlyph.points[x, y, onCurve], where onCurve is 0 for off-curve points and 1 for on-curve points). Note that the length of this array is 4 more than SamsaGlyph.numPoints, because 4 phantom points are appended.SamsaGlyph.tvtsSamsaGlyph.decompose()SamsaGlyph object that is a simple glyph, by recursively decomposing the glyph if it is composite. The new glyph is visually identical to the original glyph. The components array of the returned glyph will be empty. It is valid to call this method on a simple glyph, in which case the method returns a new glyph that is a copy of the original.SamsaGlyph.instantiate()SamsaGlyph object, being a new version of this glyph transformed according to the SamsaInstance object passed as an argument.SamsaGlyph.svgPath()d attribute of an SVG <path> element.// display the array of points for the glyph for the character "A"
const nodeBuffer = fs.readFileSync(filename);
const arrayBuffer = nodeBuffer.buffer;
const samsaBuffer = new SamsaBuffer(arrayBuffer);
const font = new SamsaFont(samsaBuffer);
const string = "A";
const glyphId = font.glyphIdFromUnicode(string.codePointAt(0));
const glyph = font.loadGlyphById(glyphId);
console.log(glyph.points);