docs: ADR 0014 text from Animate documents; roadmap and changelog (M4)

This commit is contained in:
Tanish Manku committed 2026-11-09 01:51:06 -07:00
1 parent 95131360bd
commit ef31d386ae
5 files changed
+89 -3

No files matched your search

+11
View File
@@ -2,6 +2,17 @@
## Unreleased
* **Text in Animate documents.** Opening a `.fla` or XFL now brings its text across as text
you can edit: titles, captions and paragraphs keep their font, size, colour, bold and
italic, alignment, letter and line spacing, position, and fixed width (wrapping) or
auto-size. A field whose lines use different styles (a big title over smaller lines)
becomes one text block per style, stacked as in Animate; a line that mixes styles takes
the style of most of its characters, and the report counts it. Fonts that aren't on this
computer fall back to the default, and the status bar names them ("Fonts not on this
computer, drawn in Arial: Futura."). Dynamic and input text come across as static text and
are reported. The import report now also shows in the status bar when a document is
opened from the command line (ADR 0014).
* **ActionScript on the roadmap** (ADR 0013, low priority, M6): first keep the scripts in
imported Animate files, with an Actions panel, then play the common timeline controls (stop,
play, go to a frame or label, button clicks) in Test Movie and HTML canvas export. Until
+3 -1
View File
@@ -44,5 +44,7 @@ own timelines, nested to any depth.
* Imported documents render and animate in AniCraft immediately and can be edited with every
tool, then saved as `.anicraft`.
* Next slices: bitmaps (needs bitmap fills, M5), text (M5), masks (M2), motion tweens, shape
* Text fields come across as text blocks (ADR 0014: one block per run of same-style lines,
missing fonts named in the report).
* Next slices: bitmaps (needs bitmap fills, M5), masks (M2), motion tweens, shape
tweens, more scenes, and a corpus of larger self-authored files.
+1
View File
@@ -44,6 +44,7 @@ so neither may depend on which fonts happen to be installed.
block, stored like any shape's path).
* Changing a font on a computer that lacks it changes the look of that block only when it is
edited, and the user is told.
* Text in Animate documents imports onto this model (ADR 0014).
* Not yet: per-character styles in one block, vertical text, text along a path, input and
dynamic text fields (with scripting, M6), font embedding for export, glyph fallback across
fonts for missing characters (missing glyphs draw as the font's "notdef" box).
+71
View File
@@ -0,0 +1,71 @@
# ADR 0014: Text from Animate documents
* Status: accepted (2026-11-09)
* Relates to: roadmap M4 (XFL import), ADR 0009 (XFL import), ADR 0012 (text)
## Context
Animate documents are full of text: titles, captions, speech bubbles, credits, score
counters. The XFL importer reported every text field as skipped. AniCraft now has a text
engine (ADR 0012): `ElementKind::Text(TextBlock)`, one style per block, laid out by
`anicraft-text` and stored as outlines.
An XFL text field (`DOMStaticText`, `DOMDynamicText`, `DOMInputText`) has a matrix, a box
(`width`, `height`, optional `left`/`top`), `autoExpand` for auto-size versus fixed width, and
a list of text runs: `<DOMTextRun><characters>…</characters><textAttrs><DOMTextAttrs …/>`.
The attributes give a face (a PostScript name such as `Arial-BoldMT`, or a device font such
as `_sans`), size, fill colour and alpha, alignment, letter spacing, line spacing, margins
and indent. Lines end with a carriage return (`&#xD;`). This structure comes from public
descriptions of XFL and from self-authored files only.
AniCraft's block has one style, but a field may have runs with different styles.
## Decision
1. **A field becomes one text block per run of consecutive lines that share a style.** Runs
are split into lines at line breaks; each line takes one style; consecutive lines with the
same style make one block, and the blocks stack downwards, each starting where the line
after the previous block would (`lines × line_height`, which `anicraft-text` now reports).
This keeps the most common mixed case exact: a big title line over smaller body lines,
each block editable as text. A **line** that mixes styles (one bold word in a sentence)
takes the style of most of its visible characters, and the report counts it. Splitting
inside a line would need per-glyph positions from one shared layout; it waits for
per-character styles in the text model (ADR 0012, "not yet").
2. **Placement.** The element's transform is the field's matrix, then the box offset
(`left`, `top`) plus a 2-pixel gutter, the inset of text in Animate's text fields. A
fixed-width field wraps at `width` (less its margins); an auto-size field never wraps, and
its centred or right-aligned blocks align against the widest block, as lines of one field
do.
3. **Fonts.** A face is looked up on this computer by its PostScript name, then as a family
name (ignoring case and spaces), then as the family the PostScript name suggests
(`TimesNewRomanPS-BoldItalicMT` is Times New Roman, bold, italic); `_sans`, `_serif` and
`_typewriter` map to installed sans, serif and monospaced families. Boldness and slant
come from the face (and `bold`/`italic` attributes when present). A family that isn't
installed falls back as the text engine does (ADR 0012), the block records the family
actually used, and the report names the missing families and the fallback: "Fonts not on
this computer, drawn in Arial: Futura." The lookup lives in `anicraft-text`
(`Fonts::find_face`, `guess_family`), so other importers can use it.
4. **Dynamic and input text come across as static text**, keeping their instance name on the
element, and are counted in the report. They become fields with scripting (M6).
5. **Report, don't guess** (ADR 0009): justified text (drawn left-aligned), first-line
indents, superscript and subscript, vertical text, filters on text, text cut to the
engine's 100,000-character limit, and text on a computer with no fonts at all (nothing is
drawn) are counted. Empty fields make nothing.
6. **Import lays text out once, with this computer's fonts.** The imported document stores
the outlines like any text (ADR 0012), so it then looks the same everywhere. The desktop app
registers its embedded Inter before opening a file from the command line, so command-line
and menu imports lay out with the same fonts.
## Consequences
* Imported titles and captions render, export and stay editable as text (Text tool, Properties,
`text.edit`).
* Lines with mixed styles lose their minor styles until text blocks have per-character styles;
the report says how many.
* Positions depend on the fonts' metrics: with the original fonts installed, text sits where
Animate puts it within about a pixel; a fallback family changes widths, as it would in
Animate.
* The shared XML reader now keeps character data (`Element::text`), needed for
`<characters>`; indentation between elements is dropped so memory doesn't grow with it.
* Not yet: per-character styles, kerning and rendering-mode settings, links on text, text
along a path, input and dynamic fields with scripting (M6), embedded fonts in the document.
+3 -2
View File
@@ -13,7 +13,7 @@ milestone ends with a green tree: build, tests, clippy, a `--screenshot` check a
| Timeline | **Frame selection**: click, Shift-click or drag across frames and layers; F5/Shift+F5, F6/F7 and Shift+F6 (keys, buttons and right-click menu) act on the whole selection; drag selected keyframes left or right to move them, and up or down onto other layers (the source keeps empty frames, as in Animate) (with a drop outline; one undo step; keys they land on are replaced, and spans fill the frames left behind); removing or clearing selected frames that hold artwork asks first. **Cut/Copy/Paste Frames** (Ctrl+Alt+X/C/V, and plain Ctrl+X/C/V after clicking the timeline): own clipboard, copies cut exactly at the selection edges (mid-tween state kept), paste inserts like Animate, several layers paste onto the layers below (missing ones are created), fresh element ids, symbols travel with them. **Span length by dragging its end** (resize cursor, live outline with the length in frames and seconds; later frames move with it). Headless: `layers`/`count` on the frame commands, `timeline.move_keyframes`, `timeline.cut_frames/copy_frames/paste_frames`. Layers (show/lock/outline), keyframes, blank keyframes, insert/remove frames, classic tweens with 8 easing presets + curve preview, **shape tweens** (morph between any two shapes: segments made cubic, subpaths paired by size and grown from or shrunk to a point when counts differ, segment counts equalized by subdivision, windings matched and start points aligned; amber spans; classic ⇄ shape keeps the easing), auto-key when editing inside a tween, frame labels, symbol nesting: graphics keep step with their timeline (loop, play once, single frame, first frame; set in Properties), movie clips loop their own timeline from when the instance appears (continuous across keyframes holding the same instance), buttons show their Up frame, onion skin (±2 frames), looping playback. **Mask layers**: right-click a layer › Mask turns it into a mask over the layer below (Masked adds more layers to it); masked layers are indented under a stencil icon; the mask applies on the stage and in every export alike, and while the mask layer is unlocked its edge shows in the layer colour so it can be picked and reshaped; masked-away parts cannot be picked; layers moved in under a mask join it, moved out leave it, and a mask moves with its whole group; masks inside symbols nest. Headless: `layer.toggle_mask`, `layer.set_type`. **Scenes** (ADR 0011): the movie is an ordered list of scenes, each its own timeline, edited one at a time (scene menu on the edit bar, Insert › Scene, Modify › Scene, Shift+PageUp/PageDown); add, duplicate (fresh ids), rename, reorder and remove (asks when the scene has artwork; undoable); PNG-sequence and GIF exports play every scene in order. **Layer folders**: nestable folders (depth ≤ 16) holding layers and masks through `Layer.parent`, one invariant (`Timeline::repair_masks`: a child sits below its parent inside the parent's unbroken run; broken links fall back to the nearest valid ancestor); hiding or locking a folder hides or locks its contents (rendering, picking, drawing); folders open and close on the timeline (view state); layers move in and out with Up/Down, a folder moves with its contents; deleting a folder deletes its contents (asks first). No motion editor yet; **motion guides**: guided layers (children of a guide through `Layer.parent`) have their classic tweens follow the guide's first path by arc length, from the point nearest each start keyframe to the point nearest its end (`geom::walk::PathWalk`), optionally orienting to the path; guide artwork is listed for picking and editing, drawn on the stage as a line, and never rendered or exported. |
| Drawing | Selection (click, shift-add, marquee, drag-move, arrow nudge), **Free Transform (Q)**: scale from corner/edge handles (Shift proportional, Alt from centre), rotate outside corners (Shift snaps 15°), move; one undo step per drag. Rectangle (corner radius), oval, PolyStar, line (45° snap), hand, zoom. **Pen (P)**: click for corners, drag for smooth handles (Alt breaks them), close on the first point, Enter/Esc/last-point click finishes, Backspace takes back a point; one undo step per path. **Pencil (Shift+Y)**: Smooth (Schneider curve fitting with corner detection), Straighten and Ink modes, smoothing relative to the screen. **Subselection (A)**: anchors and handles on selected shapes, drag points/handles (anchors bring their handles; one undo step per drag), point marquee, double-click an edge to add a point, Delete removes points, right-click Make Smooth/Corner; closed shapes' start point and closing edge edit like any other. **Cut/Copy/Paste in Center/Paste in Place** (the clipboard carries symbols across documents). **Rotate 90° CW/CCW, Flip H/V. Align** left/centre/right/top/middle/bottom (Ctrl+Alt+1…6; a single element aligns to the stage) and distribute. Convert to symbol / break apart; arrange; duplicate. Headless: `draw.path`, `draw.freehand`, `path.move_points/add_point/delete_points/convert_point`. **Paint Bucket (K)**: click a fill to recolour it, or inside an outline (one shape or several) to fill the enclosed area; gap size None/Small/Medium/Large closes openings; the fill is traced and curve-fitted into a new shape placed under its lines; open areas say so instead of flooding. **Ink Bottle (S)**: gives the clicked shape the current stroke. Headless: `paint.bucket`, `paint.ink`. Tool options show first in Properties while a drawing tool is active. **Text (T)** (ADR 0012): click to type on the stage, click or double-click text to edit it; font (installed families, plus the embedded Inter), size, colour, bold, italic, alignment, letter/line spacing, wrap width; the last style is kept for new text; laid out by `anicraft-text` (`fontdb` discovery, `harfrust` shaping, `skrifa` outlines) and stored as outlines with the source, so rendering never needs the font; Break Apart makes a shape. No brush or merge drawing yet. |
| Headless | CLI: info, render, render-seq, **gif**, commands, exec, run, serve (JSON-lines). **MCP server** (`anicraft-cli mcp`, `docs/mcp.md`): stdio JSON-RPC, protocol 2025-06-18 (and 2025-03-26, 2024-11-05); five tools over the command registry (list, run, run a script, describe the document, render a frame as a PNG picture); confirmation tiers and undo apply as in the app. |
| Files | `.anicraft` JSON load/save (v3, with scenes; v1 and v2 files open as one scene), PNG frame and sequence export, **animated GIF export** (parallel render and quantize, exact frame timing, looping), **SVG frame export** (from the same evaluated frame as the renderer: stage-space paths, renderer-matched stroke widths, gradients under `gradientTransform`, colour effects baked in, masks as nested `clipPath`s). **Opens Animate documents** (`.fla`, `.xfl`, XFL folders; ADR 0009): stage, first scene, layers, keyframes, labels, classic tweens with ease, shapes (solid/linear/radial fills, strokes), groups, primitives, symbol instances (matrix, alpha, tint, loop), library symbols, **shape tweens**, **layer folders** and **mask layers** (masks inside folders too); imported files are untitled so Save never overwrites them; what isn't supported yet is reported after opening. Every scene comes across. **Bitmaps**: library items whose image is in the package as PNG or JPEG (the original in `LIBRARY/`, else the `bin/` data file when it is PNG or JPEG), instances, and bitmap fills with their matrix (twips scale removed; repeating unless clipped); Animate's own bitmap encodings are not public and are reported, not decoded. No text, motion tweens or shape hints from XFL yet; frame scripts are counted in the import report but not kept yet (ADR 0013); **Import to Stage (Ctrl+R) for SVG drawings**: editable shapes on a new layer at the playhead, with groups, use and symbols, transforms, viewBox, styles, opacity and gradients; unsupported parts are reported. **Sprite sheet export**: movie frames on one PNG grid (parallel render, columns/padding/scale, transparent or stage background) with a "JSON hash" frame map (rectangles, sizes, per-frame durations). **Video export**: WebM (VP9) or MP4 (H.264) by streaming raw frames, in order and rendered in parallel batches, to the user's own ffmpeg (no encoder bundled; ffmpeg from a parameter, `ANICRAFT_FFMPEG` or the PATH; argument lists, never a shell). **Lottie export** (`file.export_lottie`): frame-accurate rather than re-keyed: each frame is evaluated, artwork that persists (same layer, element, occurrence and path structure) becomes one shape layer with outlines baked to stage space, and whatever changes (outlines, colours, gradient points, stroke width, opacity, masks as layer masks) is written as hold keyframes where it changes; one layer order consistent with every frame (topological); checked against the reference web player (matches the renderer). Reported, not exported: bitmap fills, nested masks (innermost kept), group fades (per shape), stretched radial gradients (circles). |
| Files | `.anicraft` JSON load/save (v3, with scenes; v1 and v2 files open as one scene), PNG frame and sequence export, **animated GIF export** (parallel render and quantize, exact frame timing, looping), **SVG frame export** (from the same evaluated frame as the renderer: stage-space paths, renderer-matched stroke widths, gradients under `gradientTransform`, colour effects baked in, masks as nested `clipPath`s). **Opens Animate documents** (`.fla`, `.xfl`, XFL folders; ADR 0009): stage, first scene, layers, keyframes, labels, classic tweens with ease, shapes (solid/linear/radial fills, strokes), groups, primitives, symbol instances (matrix, alpha, tint, loop), library symbols, **shape tweens**, **layer folders** and **mask layers** (masks inside folders too); imported files are untitled so Save never overwrites them; what isn't supported yet is reported after opening. Every scene comes across. **Bitmaps**: library items whose image is in the package as PNG or JPEG (the original in `LIBRARY/`, else the `bin/` data file when it is PNG or JPEG), instances, and bitmap fills with their matrix (twips scale removed; repeating unless clipped); Animate's own bitmap encodings are not public and are reported, not decoded. **Text** (ADR 0014): static, dynamic and input text fields become text blocks laid out by `anicraft-text`, with face (by PostScript name, family, or the family the name suggests; `_sans`/`_serif`/`_typewriter`), size, colour, bold/italic, alignment, letter and line spacing, margins, matrix, fixed width (wraps) or auto-size, and several lines; runs in different styles become one block per run of same-style lines, stacked as in Animate; a line mixing styles takes its main style and is counted; missing families fall back and are named in the report; dynamic/input fields come across as static text (reported). No per-character styles, motion tweens or shape hints from XFL yet; frame scripts are counted in the import report but not kept yet (ADR 0013); **Import to Stage (Ctrl+R) for SVG drawings**: editable shapes on a new layer at the playhead, with groups, use and symbols, transforms, viewBox, styles, opacity and gradients; unsupported parts are reported. **Sprite sheet export**: movie frames on one PNG grid (parallel render, columns/padding/scale, transparent or stage background) with a "JSON hash" frame map (rectangles, sizes, per-frame durations). **Video export**: WebM (VP9) or MP4 (H.264) by streaming raw frames, in order and rendered in parallel batches, to the user's own ffmpeg (no encoder bundled; ffmpeg from a parameter, `ANICRAFT_FFMPEG` or the PATH; argument lists, never a shell). **Lottie export** (`file.export_lottie`): frame-accurate rather than re-keyed: each frame is evaluated, artwork that persists (same layer, element, occurrence and path structure) becomes one shape layer with outlines baked to stage space, and whatever changes (outlines, colours, gradient points, stroke width, opacity, masks as layer masks) is written as hold keyframes where it changes; one layer order consistent with every frame (topological); checked against the reference web player (matches the renderer). Reported, not exported: bitmap fills, nested masks (innermost kept), group fades (per shape), stretched radial gradients (circles). |
| Tests | 133 tests (adds point editing, closed-path anchors, curve fitting, pen/pencil/subselection commands, the Pen's path data, frame ranges, keyframe moves, range confirmations, frame selection and the frame clipboard): unit, analytic render, band/determinism, robustness fuzz over all commands, round trip (v1 and v2 files), structural sharing and history budget, render-service equivalence, confirmations, clipboard, transforms and align, GIF decode and timing, free-transform maths, UI-guideline enforcement, CLI. |
| Ease of use & safety | **Visual language** (ADR 0008, revised): graphite palette, corners by role (square structure, softened controls, rounder menus and dialogs with soft depth), borders only between layout regions, flat buttons with a visible focus ring, vibrant timeline blocks (mint artwork, violet tweens), sentence-case headings, **collapsible sections with rules** (Preferences, Properties, dock, shortcut sheet), **Lucide icons** stroked as vectors via a new full SVG path reader; click targets ≥ 28 px (tools 40, rows 28, toggles 24); palette contrast, target sizes and "no raw colours or radii" are enforced by tests. Product principles written (`docs/product-principles.md`). Tiered destructive-action confirmations, enforced in the engine (ADR 0004). Unsaved-changes guard on close/new/open. Overwrite checks for saves and exports. "Ctrl+Z to undo" hints. Command palette (Ctrl+K). Shortcut sheet (F1). Right-click menus on stage, frames and layers. Save As (Ctrl+Shift+S). **Shortcut editor** (F1): every menu command, tool and view key can be rebound, given extra keys or unbound; recording asks before taking a key from another action, reserved keys (palette, editor, Preferences, quit, play, Esc, Space, Tab) stay fixed, per-action and global reset; only the changes are saved in preferences, so untouched actions follow new defaults; menus, tooltips and the palette show the keys in effect. |
| Platforms & preferences | ADR 0006 platform layer: ⌘ shortcut labels and an AniCraft app menu with a unified title bar on macOS; Exit and Preferences (Ctrl+U) on Windows and Linux; native file dialogs (XDG portal on Linux, with a fallback switch); wgpu with automatic OpenGL fallback; per-OS settings folder. **Preferences** window: interface and data fonts (bundled default or any installed font), interface scale, stage render mode, file dialogs, reset confirmations. Edits render live (fixed the missing-repaint bug). Not yet: native macOS NSMenu, macOS/Linux CI runners. Verified on Windows only so far. |
@@ -74,7 +74,8 @@ has a key (P is the Pen, as in Animate).
Next, in order:
1. M4 **XFL import, next slices**: ~~masks (with M2 mask layers)~~ ✅, ~~shape tweens~~ ✅,
~~every scene~~ ✅, ~~bitmaps~~ ✅ (PNG/JPEG data), motion tweens, text (with M5), and a larger self-authored
~~every scene~~ ✅, ~~bitmaps~~ ✅ (PNG/JPEG data), ~~text~~ ✅ (one style per line; per-character styles with
the text model), motion tweens, and a larger self-authored
corpus checked by render tests.
2. ~~SVG import~~ ✅ and ~~SVG frame export~~ ✅. Next for SVG: text, clip paths and masks (onto mask layers), dashes.