opentype library Null safety

Classes

BoundingBox
A bounding box is an enclosing box that describes the smallest measure within which all the points lie. It is used to calculate the bounding box of a glyph or text path.
CffEncoding
@exports opentype.CffEncoding @class @constructor @param {string} encoding - The encoding @param {Array} charset - The character set.
CmapEncoding
@exports opentype.CmapEncoding @class @constructor @param {Object} cmap - a object with the cmap encoded data
Coverage
@exports opentype.Coverage @class @param {opentype.Table} @constructor @extends opentype.Table
DefaultEncoding
This is the encoding used for fonts created from scratch. It loops through all glyphs and finds the appropriate unicode value. Since it's linear time, other encodings will be faster. @exports opentype.DefaultEncoding @class @constructor @param {opentype.Font}
Font
FontOption
Glyph
GlyphNames
@exports opentype.GlyphNames @class @constructor @param {Object} post
GlyphSet
Layout
@exports opentype.Layout @class
Parser
Path
A bézier path containing a set of path commands similar to a SVG path. Paths can be drawn on a context using draw. @exports opentype.Path @class @constructor
Position
@exports opentype.Position @class @extends opentype.Layout @param {opentype.Font} @constructor
Record
Table
@exports opentype.Table @class @param {string} tableName @param {Array} fields @param {Object} options @constructor

Properties

addGlyphNames Function
@alias opentype.addGlyphNames @param {opentype.Font} @param {Object}
read / write
addGlyphNamesAll Function
read / write
addGlyphNamesToUnicodeMap Function
read / write
argument Function
read / write
assertfn Function
read / write
bytesToString Function
read / write
cffExpertEncoding List<String>
final
cffGlyphLoader Function
read / write
cffStandardEncoding List<String>
final
cffStandardStrings List<String>
final
DataView Function
read / write
derive Function
read / write
eightBitMacEncodings Map<String, String>
@private
read / write
encode_Card16 → dynamic Function(dynamic v)
final
encode_Card8 → dynamic Function(dynamic v)
final
encode_FIXED → dynamic Function(dynamic v)
final
encode_FWORD → dynamic Function(dynamic v)
final
encode_NAME → dynamic Function(dynamic v)
@param {number} @returns {number}
final
encode_OffSize → dynamic Function(dynamic v)
final
encode_OP → dynamic Function(dynamic v)
@param {Array} v @param {string} @returns {Array}
final
encode_SID → dynamic Function(dynamic v)
final
encode_STRING → dynamic Function(dynamic v)
final
encode_UFWORD → dynamic Function(dynamic v)
final
fail Function
read / write
getByte Function
read / write
getBytes Function
read / write
getCard16 Function
read / write
getCard8 Function
read / write
getFixed Function
read / write
getOffset Function
read / write
getShort Function
read / write
getTag Function
read / write
getULong Function
read / write
getUShort Function
read / write
glyphLoader Function
read / write
langSysTable Map<String, Function>
// Script, Feature, Lookup lists ///////////////////////////////////////////////
read / write
LIMIT16 int
final
LIMIT32 int
final
parseBuffer Function
Parse the OpenType file data (as an ArrayBuffer) and return a Font object. Throws an error if the font could not be parsed. @param {ArrayBuffer} @param {Object} opt - options for parsing @return {opentype.Font}
read / write
parseOpenTypeTableEntries Function
Parses OpenType table entries. @param {DataView} @param {Number} @return {Object[]}
read / write
parseULong2 Function
read / write
parseUShort2 Function
read / write
parseWOFFTableEntries Function
Parses WOFF table entries. @param {DataView} @param {Number} @return {Object[]}
read / write
searchRange Function
read / write
sizeOf_BYTE → dynamic
@constant @type {number}
final
sizeOf_Card16 → dynamic
final
sizeOf_Card8 → dynamic
final
sizeOf_CHAR → dynamic
@constant @type {number}
final
sizeOf_FIXED → dynamic
final
sizeOf_FWORD → dynamic
final
sizeOf_LONG → dynamic
@constant @type {number}
final
sizeOf_LONGDATETIME → dynamic
@constant @type {number}
final
sizeOf_NAME → dynamic Function(dynamic v)
final
sizeOf_NUMBER16 → dynamic
@constant @type {number}
final
sizeOf_NUMBER32 → dynamic
@constant @type {number}
final
sizeOf_OffSize → dynamic
final
sizeOf_OP → dynamic
final
sizeOf_SHORT → dynamic
@constant @type {number}
final
sizeOf_SID → dynamic
final
sizeOf_STRING → dynamic Function(dynamic v)
final
sizeOf_TAG → dynamic
@constant @type {number}
final
sizeOf_UFWORD → dynamic
final
sizeOf_UINT24 → dynamic
@constant @type {number}
final
sizeOf_ULONG → dynamic
@constant @type {number}
final
sizeOf_USHORT → dynamic
@constant @type {number}
final
standardNames List<String>
final
ttfGlyphLoader Function
read / write
typeOffsets Map<String, int>
read / write

Functions

constant(dynamic v) → dynamic
@exports opentype.sizeOf @class
decode_MACSTRING(dynamic dataView, dynamic offset, dynamic dataLength, dynamic encoding) → dynamic
Decodes an old-style Macintosh string. Returns either a Unicode JavaScript string, or 'null' if the encoding is unsupported. For example, we do not support Chinese, Japanese or Korean because these would need large mapping tables. @param {DataView} dataView @param {number} offset @param {number} dataLength @param {string} encoding @returns {string}
decode_UTF16(dynamic data, dynamic offset, dynamic numBytes) → dynamic
@param {DataView} data @param {number} offset @param {number} numBytes @returns {string}
decode_UTF8(ByteData data, int offset, dynamic numBytes) → dynamic
@param {DataView} data @param {number} offset @param {number} numBytes @returns {string}
encode_BYTE(dynamic v) → dynamic
Convert an 8-bit unsigned integer to a list of 1 byte. @param {number} @returns {Array}
encode_CHAR(dynamic v) → dynamic
Convert a 8-bit signed integer to a list of 1 byte. @param {string} @returns {Array}
encode_CHARARRAY(dynamic v) → dynamic
Convert an ASCII string to a list of bytes. @param {string} @returns {Array}
encode_LITERAL(dynamic v) → dynamic
@param {opentype.Table} @returns {number}
encode_LONG(dynamic v) → dynamic
Convert a 32-bit unsigned integer to a list of 4 bytes. @param {number} @returns {Array}
encode_LONGDATETIME(dynamic v) → dynamic
Convert a 32-bit Apple Mac timestamp integer to a list of 8 bytes, 64-bit timestamp. @param {number} @returns {Array}
encode_MACSTRING(dynamic str, dynamic encoding) → dynamic
Encodes an old-style Macintosh string. Returns a byte array upon success. If the requested encoding is unsupported, or if the input string contains a character that cannot be expressed in the encoding, the function returns 'null'. @param {string} str @param {string} encoding @returns {Array}
encode_NUMBER(dynamic v) → dynamic
Convert a numeric operand or charstring number to a variable-size list of bytes. @param {number} @returns {Array}
encode_NUMBER16(dynamic v) → dynamic
Convert a signed number between -32768 and +32767 to a three-byte value. This ensures we always use three bytes, but is not the most compact format. @param {number} @returns {Array}
encode_NUMBER32(dynamic v) → dynamic
Convert a signed number between -(2^31) and +(2^31-1) to a five-byte value. This is useful if you want to be sure you always use four bytes, at the expense of wasting a few bytes for smaller numbers. @param {number} @returns {Array}
encode_OPERATOR(dynamic v) → dynamic
@param {number} @returns {Array}
encode_SHORT(dynamic v) → dynamic
Convert a 16-bit signed integer to a list of 2 bytes. @param {number} @returns {Array}
encode_TAG(dynamic v) → dynamic
Convert a 4-char tag to a list of 4 bytes. @param {string} @returns {Array}
encode_UINT24(dynamic v) → dynamic
Convert a 24-bit unsigned integer to a list of 3 bytes. @param {number} @returns {Array}
encode_ULONG(dynamic v) → dynamic
Convert a 32-bit unsigned integer to a list of 4 bytes. @param {number} @returns {Array}
encode_USHORT(dynamic v) → dynamic
Convert a 16-bit unsigned integer to a list of 2 bytes. @param {number} @returns {Array}
encode_UTF16(dynamic v) → dynamic
Convert a JavaScript string to UTF16-BE. @param {string} @returns {Array}
encode_VARDELTAS(dynamic deltas) → dynamic
Encode a list of variation adjustment deltas.
encodeVarDeltaRunAsBytes(dynamic deltas, dynamic offset, dynamic result) → dynamic
encodeVarDeltaRunAsWords(dynamic deltas, dynamic offset, dynamic result) → dynamic
encodeVarDeltaRunAsZeroes(dynamic deltas, dynamic pos, dynamic result) → dynamic
isByteEncodable(dynamic value) → dynamic
recordList(dynamic itemName, dynamic records, dynamic itemCallback) → dynamic
@private
sizeOf_CHARARRAY(dynamic v) → dynamic
@param {Array} @returns {number}
sizeOf_LITERAL(dynamic v) → dynamic
sizeOf_MACSTRING(dynamic str, dynamic encoding) → dynamic
@param {string} str @param {string} encoding @returns {number}
sizeOf_NUMBER(dynamic v) → dynamic
@param {number} @returns {number}
sizeOf_UTF16(dynamic v) → dynamic
@param {string} @returns {number}
tableList(dynamic itemName, dynamic records, dynamic itemCallback) → dynamic
@private
uncompressTable(dynamic data, Map<String, dynamic> tableEntry) Map<String, dynamic>
@param {DataView} @param {Object} @return {TableData}
ushortList(dynamic itemName, dynamic list, dynamic count) → dynamic
@private