Divooka Reference

Stroke Pen Path

3 nodes

On this page 3

Measure

Function

The advance width of a run, in drawing units.

Signature
Measure -> Low Accuracy Number
    font: Stroke Font
    text: Text
    capHeight: Low Accuracy Number
    letterSpacing: Low Accuracy Number
float Measure(
    StrokeFont font,
    string text,
    float capHeight,
    float letterSpacing = 0f)

Parameters

nametypedefaultdescription
fontStroke Font—
textText—
capHeightLow Accuracy Number—
letterSpacingLow Accuracy Number0

Returns

resultLow Accuracy Number

Remarks

The advance, not the ink. The Hershey faces carry side bearings and a flourish on a cursive
face reaches past them, so a caller sizing an image around the text should measure the
traced points instead.

Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Stroke Pen Path
Package
Image Processing

Trace

Function

The pen path for a run of text: one polyline per pen-down..pen-up mark, in writing order,
glyph by glyph from left to right.

Signature
Trace -> IReadOnlyList<Vector2 Array>
    font: Stroke Font
    text: Text
    capHeight: Low Accuracy Number
    x: Low Accuracy Number
    baseline: Low Accuracy Number
    slant: Low Accuracy Number
    letterSpacing: Low Accuracy Number
IReadOnlyList<Vector2[]> Trace(
    StrokeFont font,
    string text,
    float capHeight,
    float x = 0f,
    float baseline = 0f,
    float slant = 0f,
    float letterSpacing = 0f)

Parameters

nametypedefaultdescription
fontStroke Font—The face to write with.
textText—The text to write. Characters the face lacks fall back to its '?'.
capHeightLow Accuracy Number—Height from baseline to cap line, in drawing units.
xLow Accuracy Number0Where the run starts.
baselineLow Accuracy Number0The baseline the run sits on.
slantLow Accuracy Number0Shear applied per unit of height; negative leans right, as a hand does.
letterSpacingLow Accuracy Number0Extra advance after each glyph, in drawing units.

Returns

resultIReadOnlyList<Vector2 Array>
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Stroke Pen Path
Package
Image Processing

Trace Glyph

Function

The pen path for one glyph, placed with its origin at (Origin X, Baseline).

Signature
TraceGlyph -> IReadOnlyList<Vector2 Array>
    glyph: Stroke Glyph
    capHeight: Low Accuracy Number
    originX: Low Accuracy Number
    baseline: Low Accuracy Number
    slant: Low Accuracy Number
IReadOnlyList<Vector2[]> TraceGlyph(
    StrokeGlyph glyph,
    float capHeight,
    float originX = 0f,
    float baseline = 0f,
    float slant = 0f)

Parameters

nametypedefaultdescription
glyphStroke Glyph—
capHeightLow Accuracy Number—
originXLow Accuracy Number0
baselineLow Accuracy Number0
slantLow Accuracy Number0

Returns

resultIReadOnlyList<Vector2 Array>
Ships with
Divooka ExploreDivooka Compute
Graph kinds
Flows Function Events Routine Constructs StateMachineState
Declared by
Stroke Pen Path
Package
Image Processing