Glyph

Description

Per-glyph outline + metrics. Holds the raw quadratic-bezier contours parsed from the font’s glyf table and the derived edgeContours used by MTSDF generation, plus the layout metrics serialized into the atlas data (.agd).

Fields & Properties

public short xMin, yMin, xMax, yMax;
public float glyphWidth = 1;
public float glyphHeight = 1;

[@NonSerializable] public List<List<Edge>> edgeContours = new();  // built for MTSDF
[NonSerializable]  public List<Bezier> contours = new();          // raw outline

public float advanceWidth;     // horizontal advance (÷ unitsPerEm)
public float leftSideOffset;   // left side bearing
public float tsb = 0;          // top side bearing (when yMin < 0)

Methods

BuildEdges (public)

Converts the raw contours (on-/off-curve bezier points) into edgeContours of quadratic Edges. Consecutive off-curve points get an implied on-curve midpoint inserted between them — standard TrueType outline reconstruction.

SetParams (public)

Stores the glyph bounds and computes the normalized glyphWidth/glyphHeight from unitsPerEm.