PrismCore / API reference / Subtitles and captions

Structure

TextCuePlacement

struct TextCuePlacement

Declared in Sources/PrismCore/Subtitles/TextCuePlacement.swift · PrismCore 3.5.4

Where a text cue asked to be drawn — when the source said so at all.

Almost every cue says nothing and wants the renderer's default: bottom centre. The ones that do speak up matter out of proportion to their number: a {\an8} moves dialogue to the top of the frame so it does not sit on burned-in signs or a second speaker's caption, and a WebVTT line: does the same for a sidecar. Dropping that used to leave two captions stacked on one another, which is the failure this type exists to prevent — it is carried both into the served rendition (as WebVTT cue settings) and to hosts that draw text themselves (TimedTextCue).

Two models had to meet here. ASS positions an anchor point (a numpad alignment, optionally a \pos); WebVTT positions a box edge (line: is where the box top lands, position: where its aligned edge lands). The anchor is what the source meant, so it is what is stored; the settings string is a rendering of it, and the two conversions are separate so a host can ignore the WebVTT reading entirely.

Initializers

init?(alignment: Int, anchor: Anchor? = nil)

nil for an alignment outside 1…9 — a malformed \an0 must not invent a placement.

Instance properties

let alignment: Int

Numpad alignment, as ASS spells it: 1 bottom-left through 3 bottom-right, 4–6 the middle row, 7–9 the top row. 2 is the everyday bottom-centre.

let anchor: Anchor?

Anchor from \pos(x,y) (normalized against the script's play resolution) or from a WebVTT line:/position: percentage pair. nil when only a row/column was named.

var row: Row { get }

No documentation comment in the source.

var column: Column { get }

No documentation comment in the source.

Structure

TextCuePlacement.Anchor

struct Anchor

A point on the picture, normalized to 0…1 on both axes, y measured from the top. Usually inside the frame, but a script may anchor outside it on purpose, so the range is not clamped here — a host that cannot draw off-picture decides for itself.

Initializers

init(x: Double, y: Double)

No documentation comment in the source.

Instance properties

let x: Double

No documentation comment in the source.

let y: Double

No documentation comment in the source.

Enumeration

TextCuePlacement.Column

enum Column

No documentation comment in the source.

Cases

case start

No documentation comment in the source.

case center

No documentation comment in the source.

case end

No documentation comment in the source.

Enumeration

TextCuePlacement.Row

enum Row

No documentation comment in the source.

Cases

case bottom

No documentation comment in the source.

case middle

No documentation comment in the source.

case top

No documentation comment in the source.

Generated from the public symbols of PrismCore 3.5.4. All types