Namespace Ot.Var
Foundation Types
Type Ot.Var.Value
An immutable, opaque union type of number and an internal class implements a quantity that varies under OpenType Variation rules. Use Ot.Var.Ops to create and manipulate them.
Class Ot.Var.Dim
An object type representing a “variation dimension” in a variable font. Its object identity is significant, and is used to distinguish dimensions of a variable font's design space.
Class Ot.Fvar.Axis in Ot.Fvar contains such dimension object, with extra properties for naming, identification, etc.
Constructor
- new Ot.Var.Dim(tag:Tag,minValue:number,defaultValue:number,maxValue:number)
Properties
Type Ot.Var.DesignSpace
Aliased to Data.Order<Ot.Var.Dim>.
Datatype Ot.Var.Instance
Defined as Data.Maybe<readonly Map<Ot.Var.Dim,number>>.
Datatype Ot.Var.MasterDim
Properties
- readonly dim:Ot.Var.Dim
- readonly min:number
- readonly peak:number
- readonly max:number
Class Ot.Var.Master
Constructor
-
new Ot.Var.Master(init:Iterable<undefined | null | Ot.Var.MasterDim>)
Create a Ot.Var.Master from per-axis regions.
undefined
andnull
items are ignored.
Properties
- readonly regions:readonly Ot.Var.MasterDim[]
Methods
- evaluate(instance:Ot.Var.Instance):number
- getPeak():Ot.Var.Instance
- isInvalid():boolean
- isSimple():boolean
Class Ot.Var.MasterSet
A master set collects masters and associates an unique number to masters that are distinguishable. Equivalent masters will share same index.
Inherits
- Iterable<[Ot.Var.Master,number]>
Constructor
- new Ot.Var.MasterSet()
Methods
-
get(master:Ot.Var.Master):undefined | {index:number,master:Ot.Var.Master}
Query the records and return the index and corresponding collected masters, or
undefined
if the master is not recorded. -
getOrPush(master:Ot.Var.Master):undefined | {index:number,master:Ot.Var.Master}
Query the records and return the index and corresponding collected masters, or add it into the record if it is not collected. Returns
undefined
when the master is considered invalid.
Operations
Singleton Ot.Var.Ops
Properties
-
readonly neutral:number
The identity of Ot.Var.Value. Equal to 0.
Vector space methods
- add(x:Ot.Var.Value,y:Ot.Var.Value):Ot.Var.Value
- negate(x:Ot.Var.Value):Ot.Var.Value
- minus(x:Ot.Var.Value,y:Ot.Var.Value):Ot.Var.Value
- scale(scale:number,y:Ot.Var.Value):Ot.Var.Value
- addScale(x:Ot.Var.Value,scale:number,y:Ot.Var.Value):Ot.Var.Value
Variation methods
- originOf(x:Ot.Var.Value):number
- varianceDeltaOf(x:Ot.Var.Value,m:Ot.Var.Master):number
- varianceOf(x:Ot.Var.Value):Iterable<[Ot.Var.Master,number]>
- removeOrigin(x:Ot.Var.Value):Ot.Var.Value
- evaluate(x:Ot.Var.Value,instance:Ot.Var.Instance):number
- equal(x:Ot.Var.Value,y:Ot.Var.Value,err?:number):boolean
- sum(...xs:Ot.Var.Value[]):Ot.Var.Value
- isConstant(x:Ot.Var.Value):boolean
- isZero(x:Ot.Var.Value):boolean
Class Ot.Var.ValueFactory
Constructor
- new Ot.Var.ValueFactory(masterSet?:Ot.Var.MasterSet)
Properties
- readonly masterSet:Ot.Var.MasterSet
Methods
- create(origin?:number,variance?:Iterable<[Ot.Var.Master,number]>):Ot.Var.Value
- make(...xs:(Ot.Var.Value | [Ot.Var.Master,number])[]):Ot.Var.Value