Class representing a variable font.
Parameters:
-
init:Objectinit: { url: String, fontFamily: String, callback: Function, arrayBuffer: ArrayBuffer, inFile: String, outFile: String, filesize: String, date: String }
-
config:Object- (optional)Any properties defined in the
configparameter override properties defined in the globalCONFIGobject.defaultConfig = { isNode: false, outFileDefault: "samsa-out.ttf", instantiation: { method: "default", skipTables: ["gvar","fvar","cvar","avar","STAT","MVAR","HVAR","VVAR","DSIG"], ignoreIUP: false }, defaultGlyph: ["A", "a", "Alpha", "alpha", "afii10017", "A-cy", "afii10065", "a-cy", "zero"], sfnt: { maxNumTables: 100, maxSize: 10000000 }, glyf: { overlapSimple: true, bufferSize: 500000, compression: true }, name: { maxSize: 50000 }, deltas: { round: true }, postscriptNames: [".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","nonbreakingspace","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron","Lslash","lslash","Scaron","scaron","Zcaron","zcaron","brokenbar","Eth","eth","Yacute","yacute","Thorn","thorn","minus","multiply","onesuperior","twosuperior","threesuperior","onehalf","onequarter","threequarters","franc","Gbreve","gbreve","Idotaccent","Scedilla","scedilla","Cacute","cacute","Ccaron","ccaron","dcroat"] }
Returns:
SamsaFont
Example:
let vf = new SamsaFont({
fontFamily: "FontNameShouldGoHere",
url: "fonts/Sans_Variable.ttf",
callback: function(font) {}
});
let vf = new SamsaFont({
arrayBuffer: e.target.result,
inFile: file.name,
filesize: file.size, //Optional
date: file.lastModified, //Optional
callback: function(font) {}
});Font Family name
Type: String
It specifies the number of coordinate units on the "em square", an abstract square whose height is the intended distance between lines of type in the same type size. This is the size of the design grid on which glyphs are laid out. Example value: 1000
Type: Number
Total number of glyphs
Type: Number
Angle of the italic style
Type: Number
Array of instances in this SamsaFont object. Initially, these instances are the Default followed by all the Named Instances defined in the fvar table of the input VF, but instances can be added, modified and deleted so the instances array may no longer correspond with the input VF.
Type: Array of Object
Example:
[{
id: 0,
glyphs: [],
tuple: [
0,
0,
0
],
fvs: {
fmsk: 0,
hdrs: 0,
hscl: 0
},
static: null,
name: 'Default',
type: 'default'
}]Array of the VF’s axes.
Type: Array of Object
Example:
[{
id: 0,
tag: 'fmsk',
min: 0,
default: 0,
max: 100,
flags: 0,
axisNameID: 256,
name: 'WearFaceMask'
}]Total number of axes.
Type: Number
Map of axis tag to axis id.
Type: Object
Example:
axisTagToId: {
wght: 0,
wdth: 1,
ital: 2
}Type: Array of String
Return all of this font’ glyphs as Array of SamsaGlyph objects The array indices correspond exactly with glyph ids in the original font file.
Type: Array of SamsaGlyph objects.
Array of each glyph’s width
Type: Array of Number
Example:
[
800,
600,
0,
240,
512,
502,
485,
502
]Array of each glyph’s name, such as "A"
Type: Array of String
Example:
[
".notdef",
"NULL",
"nonmarkingreturn",
"space",
"A",
"B",
"C",
"D",
"E",
"F",
"G",
]Type: Array of Number
Type: Array of Number
Type: Array of Number
Type: Array of Number
Type: Array
Font url
Type: String
Font url or font file
Type: String
Example:
"https://res.cloudinary.com/dr6lvwubh/raw/upload/v1596755490/Variable%20Fonts/KairosSans_Variable.ttf",
Type: ArrayBuffer
Font file name. Example value: KairosSans_Variable.ttf
Type: String
Font file size. Example value: 68404
Type: Number
Font file flavor. Example value: truetype
Type: String
Total number of font data tables. Example value: 16
Type: Number
Array of font data tables.
Type: Array of Object
Example:
[{
id: 0,
tag: 'HVAR',
checkSum: 1677429614,
offset: 15684,
length: 1393
}]Font data tables as object
Type: Object
Example:
{
...
fvar: {
id: 5,
tag: 'fvar',
checkSum: 270942577,
offset: 17528,
length: 844,
data: {
majorVersion: 1,
minorVersion: 0,
offsetToAxesArray: 16,
countSizePairs: 2,
axisCount: 3,
axisSize: 20,
instanceCount: 48,
instanceSize: 16
}
}
}Font information: designer names, axis names, instance names, version, legal information, etc.
Type: Array
The config that got passed in from constructor or the default config if not passed in.
Type: Object
Return all named instances from font.instances as an array of instances.
Returns:
Array of Object
Source:
Add an new instance to font.instances, then return the added instance.
Parameters:
fvs:Objectoptions:Object
Returns:
Object
Source:
Source:
Convert fvs to tuple.
Returns:
Array
Source:
Convert tuple to fvs.
Returns:
Object
Source:
Returns an array containing the axis indices for this axis tag
Parameters:
tag:String
Returns:
Array
Source:
Source:
Creates a new static font file, based on the axis settings of instance. The font file is created either on disk (this.config.isNode == true) or in memory (this.config.isNode == false).
Returns:
If this.config.isNode == false, returns a Uint8Array, being the font binary in memory.
Source:
Source:
Source:
Source:
Source: