ui_controls

module pkg::alloy::text::font::outlinesource

Glyph outlines: from glyf, contours of on- and off-curve points (quadratic curves), composite glyphs assembled from their components; from CFF and CFF2 (text_fonts' cff.alloy), lines and cubic curves.

type PointKindsource

exp type PointKind = enum

What a point of a contour is: on the curve, a quadratic curve's control point (two in a row implying an on-curve point midway), or one of a cubic curve's two control points.

Variants

On
Quadratic
Cubic

type OutlinePointsource

exp type OutlinePoint = struct

Fields

exp x: f32
exp y: f32

font units, y up

exp kind: PointKind

type Outlinesource

exp type Outline = struct

Fields

exp points: Vector<OutlinePoint>
exp ends: Vector<u32>

each contour's last point

Functions

fn Outline::emptysource

exp fn Outline::empty() -> Outline

type Movedsource

exp type Moved = struct

A point being moved by a variable face's deltas, in font units.

Fields

exp x: f32
exp y: f32

type Affinesource

exp type Affine = struct

The point (x, y) goes to (a x + c y + e, b x + d y + f).

Fields

exp a: f32
exp b: f32
exp c: f32
exp d: f32
exp e: f32
exp f: f32

Functions

const IDENTITYsource

exp const IDENTITY: Affine = Affine { .a = 1.0, .b = 0.0, .c = 0.0, .d = 1.0, .e = 0.0, .f = 0.0 };

fn inversesource

exp fn inverse(self t: &Affine) -> Affine

The transform undoing this one; one taking every point to the origin when it has no inverse.

fn thensource

exp fn then(self inner: &Affine, outer: &Affine) -> Affine

This transform, then the outer one.

fn outlinesource

exp fn outline(self face: &Face, glyph: u32) -> Outline

The glyph's outline: empty for a space or a glyph past the face's. A face's .notdef left empty, as Inter's is, is drawn as a box, so a character the face lacks still shows.

fn drawn_outlinesource

exp fn drawn_outline(self face: &Face, glyph: u32) -> Outline

The glyph's outline as its font draws it, at the face's position on its axes.

type Extentssource

exp type Extents = struct

A glyph's ink box as HarfBuzz gives it, in font units: from the left side bearing and the top, its width and its height (negative, down).

Fields

exp x_bearing: f32
exp y_bearing: f32
exp width: f32
exp height: f32

fn extentssource

exp fn extents(self face: &Face, glyph: u32) -> Option<Extents>

The glyph's extents, None for a face with no outlines (HarfBuzz's hb_font_get_glyph_extents): a TrueType glyph's from its header with hmtx's side bearing, others' and varied ones' from their points; a face made bold's taller and wider by its strength, as HarfBuzz's.