PrismCore / API reference / Subtitles and captions
Structure
TextCuePlacement
struct TextCuePlacementDeclared 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: IntNumpad 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.
Structure
TextCuePlacement.Anchor
struct AnchorA 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
Instance properties
Enumeration
TextCuePlacement.Column
enum ColumnNo documentation comment in the source.
Cases
Enumeration
TextCuePlacement.Row
enum RowNo documentation comment in the source.
Cases
Generated from the public symbols of PrismCore 3.5.4. All types