Ot.Glyph
The type-namespace duplex Ot.Glyph defines the datatype, related datatype and operations for OpenType glyphs.
Glyph Store
A Ot.Font support any datatype implemented Data.OrderStore<Ot.Glyph> to be the glyph store. ot-builder
provided Ot.ListGlyphStore as the default glyph store implementation.
Interface Ot.GlyphStore
Alias of Data.OrderStore<Ot.Glyph>.
Interface Ot.GlyphStoreFactory<GS extends Ot.GlyphStore>
Alias of Data.OrderStoreFactory<Ot.Glyph,GS>.
Interface Ot.GlyphStoreFactoryWithDefault<GS extends Ot.GlyphStore>
Alias of Data.OrderStoreFactoryWithDefault<Ot.Glyph,GS>.
Type Ot.ListGlyphStore
An opaque class that implements Data.OrderStore<Ot.Glyph>. Created by Ot.ListGlyphStoreFactory.
Singleton Ot.ListGlyphStoreFactory
An opaque factory object that implements Data.OrderStoreFactoryWithDefault<Ot.Glyph,Ot.ListGlyphStore>.
Glyph
Class Ot.Glyph
The Ot.Glyph class represents one glyph. Object identity of Ot.Glyph's carry the semantics of glyph identity. Many parts of the font, even some geometries inside the glyph, will hold references to Ot.Glyph's.
Constructor
Properties
-
name:Data.Maybe<string>
The glyph name. Optional.
-
geometry:Data.Maybe<Ot.Glyph.Geometry>
The geometry. Optional. When absent, the glyph is considered a space.
-
hints:Data.Maybe<Ot.Glyph.Hints>
The hints. Optional.
-
horizontal:Data.Maybe<Ot.Glyph.Metric>
The horizontal metric.
-
vertical:Data.Maybe<Ot.Glyph.Metric>
The vertical metric.
Methods
-
Ot.Glyph.shallowCopy(from:Ot.Glyph):Ot.Glyph
Perform a shallow copy of another glyph.
Metrics
Datatype Ot.Glyph.Metric
Defines a metric advance of a glyph.
Properties
-
readonly start:Ot.Var.Value
Start coordinate.
-
readonly end:Ot.Var.Value
End coordinate.
Geometry
Interface Ot.Glyph.Geometry
Defines as the union of the following cases.
Properties
-
readonly type:unique symbol
The type tag of this hint object.
Case Class Ot.Glyph.ContourSet | type = Ot.Glyph.GeometryType.ContourSet
Implements
Constructor
-
new Ot.Glyph.ContourSet():Ot.Glyph.ContourSet
Creates an Ot.Glyph.ContourSet with default implementation.
Interface Ot.Glyph.ContourSetProps
Properties
-
contours:Ot.Glyph.Contour[]
The contour set, being a nested array of control knots.
Case Class Ot.Glyph.TtReference | type = Ot.Glyph.GeometryType.TtReference
Implements
Constructor
-
new Ot.Glyph.TtReference(to,transform):Ot.Glyph.TtReference
Creates an Ot.Glyph.TrReference with default implementation.
Interface Ot.Glyph.TtReferenceProps
Properties
-
to:Ot.Glyph
The target glyph.
-
transform:Ot.Glyph.Transform2X3
The transform being applied.
-
roundXyToGrid:boolean
Whether to round to grid.
-
useMyMetrics:boolean
If set, this forces the advance width and left sidebearing for the composite to be equal to those from this original glyph. This works for hinted and unhinted characters.
-
pointAttachment:Data.Maybe<Ot.Glyph.PointAttachment>
When present, this reference follows TrueType's point-attachment rules.
Case Class Ot.Glyph.GeometryList | type = Ot.Glyph.GeometryType.GeometryList
Implements
Constructor
-
new Ot.Glyph.GeometryList(items?:Ot.Glyph.Geometry[]):Ot.Glyph.GeometryList
Creates an Ot.Glyph.GeometryList from its members.
Type Ot.Glyph.GeometryListProp
Properties
-
items:Ot.Glyph.Geometry
The sub items inside.
Hints
Interface Ot.Glyph.Hint
Defines as the union of the following cases.
Properties
-
readonly type:unique symbol
The type tag of this hint object.
Case Class Ot.Glyph.TtInstruction | type = Ot.Glyph.HintType.TtInstruction
Implements
Constructor
-
new Ot.Glyph.TtInstruction(instructions:Buffer)
Creates an Ot.Glyph.TtInstruction from a given instruction buffer.
Interface Ot.Glyph.TtInstructionProps
Properties
-
instructions:Buffer
The buffer containing the TrueType instructions.
Case Class Ot.Glyph.CffHint | type = Ot.Glyph.HintType.CffHint
Implements
Constructor
-
new Ot.Glyph.CffHint():Ot.Glyph.CffHint
Create an empty Ot.Glyph.CffHint.
Interface Ot.Glyph.CffHintProps
Properties
-
hStems:Ot.Glyph.CffHintStem
The horizontal stems.
-
vStems:Ot.Glyph.CffHintStem
The vertical stems.
-
hintMasks:Ot.Glyph.CffHintMask
The hint masks.
-
counterMasks:Ot.Glyph.CffHintMask
The contour masks.
Datatype Ot.Glyph.CffHintStem
Properties
Factory Methods
-
Ot.Glyph.CffHint.createStem(start:Ot.Var.Value,end:Ot.Var.Value):Ot.Glyph.CffHintStem
Create a Ot.Glyph.CffHintStem.
Datatype Ot.Glyph.CffHintMask
Properties
-
at:Set<Ot.Glyph.PointRef>
The point reference right before this hint mask take effect.
-
maskH:Set<Ot.Glyph.CffHintStem>
Horizontal stems needed to be enabled.
-
maskH:Set<Ot.Glyph.CffHintStem>
Vertical stems needed to be enabled.
Factory Methods
-
Ot.Glyph.CffHint.createMask(at,maskH,maskV):Ot.Glyph.CffHintMask
Create a Ot.Glyph.CffHintMask.
Support Types
Datatype Ot.Glyph.Contour
Defined as Ot.Glyph.Point[].
Datatype Ot.Glyph.Point
Ot.Glyph.Point defines the datatype of glyph points.
Factory Methods
- Ot.Glyph.Point.create(x,y,kind?):Ot.Glyph.Point
Properties
-
readonly x:Ot.Var.Value
X coordinate.
-
readonly y:Ot.Var.Value
Y coordinate.
-
readonly kind:Ot.Glyph.PointType
Point type.
Singleton Ot.Glyph.PointOps
Properties
-
readonly neutral:number
The identity of Ot.Glyph.Point. Equal to 0.
Methods
- add(x:Ot.Glyph.Point,y:Ot.Glyph.Point):Ot.Glyph.Point
- negate(x:Ot.Glyph.Point):Ot.Glyph.Point
- minus(x:Ot.Glyph.Point,y:Ot.Glyph.Point):Ot.Glyph.Point
- scale(scale:number,y:Ot.Glyph.Point):Ot.Glyph.Point
- addScale(x:Ot.Glyph.Point,scale:number,y:Ot.Glyph.Point):Ot.Glyph.Point
-
applyTransform(x:Ot.Glyph.Point,transform:Ot.Glyph.Transform2X3):Ot.Glyph.Point
Apply a 2×3 transform to a point.
-
combineTransform(a:Ot.Glyph.Transform2X3,b:Ot.Glyph.Transform2X3):Ot.Glyph.Transform2X3
Combine two 2×3 transforms together. Applying the combined transform will be equivalent to applying b then a.
-
removeScaledOffset(tfm:Ot.Glyph.Transform2X3):Ot.Glyph.Transform2X3
Create an equivalent 2×3 transform but without
scaledOffset
property set.
Type Ot.Glyph.Transform2X3
Constants
-
Ot.Glyph.Transform2X3.Identity
The identity transform.
Factory Methods
-
Ot.Glyph.Transform2X3.Scale(s:number):Ot.Glyph.Transform2X3
Creates a uniform scaling transform.
-
Ot.Glyph.Transform2X3.Translate(dx:Ot.Var.Value,dy:Ot.Var.Value):Ot.Glyph.Transform2X3
Creates a translation transform.
-
Ot.Glyph.Transform2X3.Rotate(angle:number):Ot.Glyph.Transform2X3
Creates a rotation transform. angle is measured in radians, and the positive orientation is counter-clockwise.
Properties
-
readonly dx:Ot.Var.Value
X offset.
-
readonly dy:Ot.Var.Value
Y offset.
-
readonly xx:number
X scale.
-
readonly yx:number
X shearing. Used by the "Scale10" coefficient in TrueType's `glyf`` table.
-
readonly xy:number
Y shearing. Used by the "Scale01" coefficient in TrueType's `glyf`` table.
-
readonly yy:number
Y scale.
-
readonly scaledOffset:Data.Maybe<boolean>
Whether the offset is scaled.
Enumeration Ot.Glyph.PointType
-
Corner = 0
This point is corner point.
-
Lead = 1
This point is the first control point of a cubic Bezier curve.
-
Follow = 2
This point is the second control point of a cubic Bezier curve.
-
Quad = 3
This point is an off-curve control point in a quadratic contour, as in TrueType.
Datatype Ot.Glyph.PointRef
Properties
Datatype Ot.Glyph.PointIDRef
Properties
- readonly pointIndex:number
Datatype Ot.Glyph.GlyphPointIDRef
Properties
- readonly glyph:Ot.Glyph
- readonly pointIndex:number
Datatype Ot.Glyph.PointAttachment
Properties
- readonly inner:Ot.Glyph.PointIDRef
- readonly outer:Ot.Glyph.PointIDRef
Glyph Naming
Type Ot.GlyphNamingSource
Properties
- readonly post:Data.Maybe<Data.Naming.Source<Ot.Glyph>>
- readonly cff:Data.Maybe<Data.Naming.Source<Ot.Glyph>>
- readonly encoding:Data.Maybe<Data.Naming.IndexSource<Ot.Glyph>>
Interface Ot.GlyphNamer
Properties
- nameGlyph(source:Ot.GlyphNamingSource,gid:number,glyph:Ot.Glyph):string
Singleton Ot.StandardGlyphNamer
The default glyph namer, implements Ot.GlyphNamer.
Glyph Stats (namespace Ot.Glyph.Stats)
Class Ot.Glyph.Stats.BoundingBox
Constructor
- new Ot.Glyph.Stats.BoundingBox(xMin:number,xMax:number,yMin:number,yMax:number)
Properties
Static Methods
Geometry Utilities (namespace Ot.GeometryUtil)
Interface Ot.GeometryUtil.GeometrySink<T>
Methods
-
beginContour()
The callback when a contour begins.
-
addControlKnot(knot:Ot.Glyph.Point)
The callback when a control knot (point) is added.
-
endContour()
The callback when a contour ends.
-
getResult():T
The callback of returning value.
Interface Ot.GeometryUtil.GeometrySinkClass<T>
Class that constructs Ot.GeometryUtil.GeometrySink<T> instances.
Class Ot.GeometryUtil.Flattener
Implements Ot.GeometryUtil.GeometrySink<Ot.Glyph.Point[][]>
A sink class to flatten the geometry to a contour list.
Class Ot.GeometryUtil.ListPoint
Implements Ot.GeometryUtil.GeometrySink<Ot.Glyph.Point[]>
A sink class to list the geometry's points
Class Ot.GeometryUtil.GetBound
Implements Ot.GeometryUtil.GeometrySink<Ot.Glyph.Stat.BoundingBox>
A sink class to get the bounding box of a geometry
Class Ot.GeometryUtil.CountPoint
Implements Ot.GeometryUtil.GeometrySink<number>
A sink class to count the geometry's points.
Function Ot.GeometryUtil.apply<T>(cls:Ot.GeometryUtil.GeometrySinkClass<T>,...geometries:Ot.Glyph.Geometry[]):T
Traverse the geometries and use the sink to collect data.