API Reference Index
Fontkit Object
Fontkit Objectfontkit.openSync(filePath, postscriptName)Opens a font file synchronously and returns a font object.fontkit.open(filePath, postscriptName, callback)Opens a font file asynchronously.fontkit.create(buffer, postscriptName)Creates a new font object from a buffer.
Font Object
Font Objectfont.layout(string)Layouts the given string with the font and returns a GlyphRun object.font.glyphForCodePoint(codePoint)Gets a glyph for a given Unicode code point.font.hasGlyphForCodePoint(codePoint)Checks if the font has a glyph for the given code point.font.characterSetReturns the set of Unicode code points supported by the font.font.availableFeaturesReturns the list of OpenType feature tags available in the font.
GlyphRun Object
GlyphRun ObjectglyphRun.glyphsAn array of Glyph objects in the run.glyphRun.positionsAn array of position objects for each glyph.
Glyph Object
Glyph Objectglyph.pathReturns a Path object representing the glyph’s outline.glyph.bboxGets the glyph’s bounding box, i.e., the rectangle that encloses the glyph’s outline.glyph.cboxGets the glyph’s control bounding box.glyph.advanceWidthThe advance width of the glyph.
Path Object
Path Objectpath.moveTo(x, y)Moves the pen to a new location.path.lineTo(x, y)Draws a straight line to a new location.path.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y)Draws a cubic bezier curve.path.quadraticCurveTo(cpx, cpy, x, y)Draws a quadratic bezier curve.path.closePath()Closes the current path.path.bboxReturns the bounding box of the path.
Subset Object
Subset Objectsubset.includeGlyph(glyph)Includes the given glyph in the subset.subset.encode()Encodes the subset font.
Last updated
Was this helpful?