Commit Graph
1054 Commits
Author SHA1 Message Date
Gert Pellin 6fafa9b0a3 EPUB/HTML: generic font fallback from the font's class, and optional font embedding (#775)
- Every font-family fell back to serif, sans-serif typefaces included.
  The fallback now comes from the font's classification (PANOSE, OS/2
  class, name: serif, sans-serif, monospace, cursive, fantasy), passed
  in by the engine; without one, from the family name.
- file.exportEpub takes embedFonts: the faces the stylesheet names are
  packaged (OEBPS/fonts, @font-face, manifest items with font/ttf, otf,
  woff or woff2). Faces that aren't available, whose licence (OS/2
  fsType) forbids embedding, or that sit in a font collection are left
  out and listed in the new warnings array. Fonts are packaged whole;
  subsetting is a follow-up.

Fixes #775
2026-10-13 16:41:08 +02:00
Gert Pellin f420639276 EPUB/HTML: no file name as alt text, readable image names in the package (#774)
- An image without alt text (Object Export Options) got its file name as
  alt, which a screen reader then reads aloud. It is now decorative
  (alt=""), and file.exportEpub lists those images in a new warnings
  array so they can be given alt text.
- Images and media were packaged as images/<asset id>.<ext>. They are
  now <name>-<asset id>.<ext>, the name from the original file name
  (lowercase ASCII); the id keeps two files of the same name apart.

Fixes #774
2026-10-13 16:35:36 +02:00
Gert Pellin 7be88b4484 EPUB: real modified time, a stable unique identifier, and a cover image file (#771, #773)
- dcterms:modified was always 2026-01-01T00:00:00Z. It is now the
  export time (from the command; on the web, and in the crate without
  one, the document's last save or creation time).
- The default dc:identifier was urn:designcraft:<title>, shared by
  books with the same title. It is now a urn:uuid derived from the
  title and the document's creation time: stable from export to export,
  different between documents. file.exportEpub takes identifier to set
  it (an ISBN, say).
- file.exportEpub takes coverImage, a PNG or JPEG file used as the
  cover (cover-image); a JPEG is packaged as cover.jpg/image/jpeg.

Fixes #771
Fixes #773
2026-10-13 16:33:34 +02:00
aiongg d087c035b2 Merge recovery-dirs: fix(recovery): an explicit recovery folder never overwrites or deletes another run's checkpoints (#715) 2026-10-13 14:32:52 +00:00
aiongg 4e3a5364e5 Merge docx-tables: fix(textimport): Word table cells skip deleted text and field codes; Normal comes in as its own style (#721, #722) 2026-10-13 14:31:03 +00:00
aiongg a39bb70c5b Merge locked-paths: fix(paths): path edits refuse a path on a locked layer or in a locked group (#735); fix(properties): links to other panels open them when panel docking is on (#736) 2026-10-13 14:28:19 +00:00
aiongg a418a8a309 Merge editor-undo: fix(editing): Story Editor stays with its document; Undo restores the selection from before the command (#729, #716) 2026-10-13 14:27:42 +00:00
aiongg 3d3f02e621 Merge save-result: fix(file): saving never reports success without a file (#741, #708) 2026-10-13 14:27:03 +00:00
Gert Pellin 1fc302f695 EPUB: the navigation lists the headings, with a title in the book's language (#769, #770)
nav.xhtml had one entry per placed story, labelled with its first
paragraph (body text too), and always the title "Contents".

- Headings (h1-h6) get an id in the EPUB, and the navigation lists the
  h1-h3 headings of the stories in reading order, nested by level and
  linked to them. A document without headings keeps one entry per
  story (its first paragraph).
- The navigation's title follows the language (Inhoud, Inhalt, Table
  des matières, Índice, Indice, 目次, 目录; Contents otherwise), and
  file.exportEpub takes tocTitle to set it.

Fixes #769
Fixes #770
2026-10-13 16:26:32 +02:00
aiongg debec75166 fix(textimport): Word table cells skip deleted text and field codes; Normal comes in as its own style (#721, #722)
Table cell paragraphs go through the same run and inline path as body paragraphs, so deleted and moved-from text and field instructions stay out of cells, and field results, tabs and breaks come in.

Word's Normal imports as a paragraph style named Normal whose definition is w:docDefaults with Normal's own properties on top; paragraphs without a style use Word's default paragraph style. A styleMap entry can still map Normal to [Basic Paragraph].
2026-10-13 14:23:08 +00:00
aiongg 4eb786e880 fix(recovery): an explicit recovery folder never overwrites or deletes another run's checkpoints (#715) 2026-10-13 14:22:58 +00:00
aiongg eb83d23040 fix(file): saving never reports success without a file (#741, #708)
to_bytes returns a Result and every caller propagates it, so a document
that can't be written is an error: the existing file, the unsaved state
and the recovery checkpoint stay. Asset entries near or over 4 GiB are
written with zip64 sizes. On the web, Save marks the document saved only
after the browser download has started.
2026-10-13 14:22:27 +00:00
aiongg 8817e07013 fix(paths): path edits refuse a path on a locked layer or in a locked group (#735) 2026-10-13 14:19:56 +00:00
aiongg 2c7e3e53f0 fix(editing): Story Editor stays with its document; Undo restores the selection from before the command (#729, #716) 2026-10-13 14:19:00 +00:00
moppeeerandClaude Opus 5.5 7a30e5427e fix(render): radial gradients stretch with the object's box, as in InDesign
InDesign draws a radial gradient in the object's bounding box: on a
non-square frame it's an ellipse reaching the frame's sides, and a
Gradient Swatch tool drag keeps those proportions. LYH Studio episode 6
(3:16) gives the left page's background a radial gradient: magenta in
the middle, cyan out to every edge. DesignCraft drew a circle reaching
only the longer side, so a portrait page stayed purple at its sides.

- doc: `Fill::radial_ellipse(bounds)`: centre and radii (default: the
  box's centre and half its width and height; with a tool vector, its
  start, and its length measured with the box made square).
- render: the radial paint is that circle, stretched by the paint
  transform; PDF: the shading's transform does the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 15:58:05 +02:00
moppeeerandClaude Opus 5.5 19aa1c6f4c feat(swatches): New Swatch names a gradient "New Gradient Swatch"; gradient swatches from colour swatches
InDesign's Swatches panel New Swatch takes what is current: a gradient
built in the Gradient panel becomes "New Gradient Swatch" (applied, and
listed), an unnamed colour a listed swatch, a selected named swatch a
"… copy". DesignCraft's button always added the same orange swatch, and
gradient swatches could not be created at all (LYH Studio episode 6,
2:12: "this is our Swatch … create a new swatch for it").

- engine: `swatch.new {swatch?, target?}` does the above for the
  selection's fill (or stroke) or a named swatch; `swatch.create` also
  takes `gradient: {kind?, stops: [{location, swatch | color, opacity?,
  midpoint?}]}`, its stops taking colour swatches by name, as swatches
  dragged onto the Gradient panel's stops.
- Swatches panel: New Swatch runs `swatch.new`, and with nothing
  selected still adds a colour.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 15:46:31 +02:00
PiMinusMax 1c82a5b892 File › Open Recent: recent documents in the menu and on the start screen (#706)
Opening or saving a document moves it to the front of File › Open Recent
(no duplicates; Save a Copy and exports don't count). The submenu lists the
files by name with the full path as tooltip, then Clear Recent Files; the
start screen shows the last eight with their folders. A file that is gone is
dimmed and, when chosen, says so in an alert and stays listed (a disk that
isn't connected comes back). Preferences › File Handling sets how many are
kept (default 20, 0–100).

Engine: Prefs.recent_files / recent_files_max (saved in prefs.json),
file.openRecent {index}, file.recentFiles, file.clearRecent. UI:
app.openRecent; the macOS menu bar rebuilds the submenu when the list
changes.
2026-10-13 15:13:18 +02:00
aiongg 73af5d7f63 Merge script-dollar: GREP replacements like $1 stay literal in scripts (#749)
# Conflicts:
#	ROADMAP.md
2026-10-13 13:01:31 +00:00
aiongg d227ee84e9 fix(script): only a well-formed $N reference is replaced; $$ is a literal $ (#749) 2026-10-13 13:00:34 +00:00
moppeeerandClaude Opus 5.5 61ea089149 feat(ui): Text Frame Options laid out as InDesign's, with its General options
InDesign's Text Frame Options has a section list (General, Baseline
Options, Column Rules, ...). General holds Columns (Fixed Number / Fixed
Width with Number, Width, Gutter), Balance Columns, Inset Spacing as a
2x2 grid with a link button, Vertical Justification and Ignore Text
Wrap; Baseline Options holds First Baseline Offset and Min. DesignCraft
showed one flat list without the columns type, width, balance, link,
ignore-wrap or baseline settings, although the model keeps them.

- dialogs: a section list (General, Baseline Options, Column Rules);
  General as above (Width shows what Fixed Number columns get, editable
  for Fixed Width; a side typed while linked sets all four insets);
  Baseline Options; Column Rules as before. Enum captions translated.
- OK sends the new fields only when edited, as before.
- engine: `object.textFrameOptions` takes `columnWidth` (Fixed Width)
  and `firstBaselineMin`, which compose already honours.

LYH Studio episode 14 sets two columns (9:45) and a 0.1875 in inset
(10:57) here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 14:46:54 +02:00
Philipp Krüger f8474fa1c8 Merge branch 'main' into feat/pptx-export 2026-10-13 14:44:29 +02:00
moppeeer a255dc99b5 feat(tools): resize a selected placed graphic by its own handles (#699)
With a placed graphic selected (Direct Selection, or the content
grabber), the graphic's own brown bounding box has eight handles:
dragging one resizes the image inside its frame (Shift keeps its
proportions, Alt from its centre) and leaves the frame as it is.

- tools: a content-handle hit test on the selected graphic's bounds
  (after the frame's anchors under Direct Selection), a ContentResize
  drag previewing `transform.set {content, bounds}`, the handle cursors,
  and the content ghost while dragging. The frame's handles don't resize
  the frame while its graphic is selected.
- engine: `transform.set` takes `bounds` for content: the graphic's new
  bounding box on the spread (normalized, never empty).
- canvas: the brown content box gets its handles; the frame's handles
  are hidden while the graphic is selected.

(cherry picked from commit 8e0e6c2f2e)
2026-10-13 12:29:32 +00:00
aiongg 1533665af8 Merge pr/688: Create Outlines makes one compound path per line, so Ungroup separates the lines (#688) 2026-10-13 12:28:22 +00:00
aiongg 3f489a1273 Merge pr/689: Ungroup leaves frames with pasted-in content whole; name them by their shape (#689) 2026-10-13 12:27:49 +00:00
aiongg 0eb1ecfe1b Merge pr/691: Copy a selected placed graphic on its own, so Paste Into puts the whole image in place (#691) 2026-10-13 12:27:29 +00:00
aiongg 23eb86988f Merge pr/704: fix(tables): keep each table anchor in its own paragraph (#704) 2026-10-13 12:26:51 +00:00
aiongg d234ede3a2 Merge craft-atomic: Save: delegate atomic writes to craft-atomic 2026-10-13 12:12:16 +00:00
aiongg 004e585e34 Merge upstream main e862e0a6 into next 2026-10-13 12:11:25 +00:00
aiongg e81a21e645 refactor(save): delegate atomic writes to craft-atomic
The engine's atomic module keeps its functions and signatures and delegates to craft-libs/craft-atomic (pinned to e9546e19), so every save and export caller is unchanged. write_atomic_with also turns a panicking writer into an error, so its temporary file is removed. Recovery checkpoints and package output keep their own writers, which replace links instead of following them.

On Unix, new files follow the umask and replaced files keep their permissions.
2026-10-13 11:56:42 +00:00
moppeeerandClaude Opus 5.5 6c65a55905 fix(object): Ungroup leaves frames with pasted-in content whole
A frame holding items pasted into it isn't a group. Ungroup took it
apart like one, leaving its content loose and losing the clipping shape,
and the Properties panel called it "Group" with an Ungroup quick action.
As in InDesign, Ungroup now only takes real groups apart; other objects
stay as they are and stay selected (Ungroup used to clear them from the
selection). Such frames are labelled by their shape (<ellipse>, ...), so
Properties shows "Ellipse" with Convert Shape.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 11:01:30 +02:00
moppeeerandClaude Opus 5.5 f55b94f3ff fix(type): Create Outlines makes one compound path per line
As in InDesign, outlining a text frame gives a group with one compound
path per line (split further by text colour within a line), so Ungroup
leaves each line on its own: LYH Studio episode 14 ungroups the outlined
title at 4:56 to tighten the space between its lines before making one
compound path again. A single line in one colour stays a single compound
path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 10:21:39 +02:00
Noah Scholz 65bb4e3f66 fix(tables): keep each table anchor in its own paragraph
Backspace at the start of the second of two consecutive tables merged their
anchor paragraphs: Story::delete kept one table id, the other table was
dropped and the paragraph held two anchors. Pasting a table next to an anchor
replaced the existing table the same way, and pasting several paragraphs
right before an anchor left its table unreferenced. Saving succeeded;
reopening failed with "paragraph must hold exactly one anchor".

fix_tables now splits a table paragraph that holds further anchors, so every
anchor gets its own paragraph again. delete and insert_story tell it which
table each surviving anchor belongs to (fix_tables_with), and insert_story
fixes tables up once after the whole paste instead of after every run.

Regression tests in doc (Backspace between tables, deleting the middle of
three, paste before/after an anchor, paragraphs pasted before an anchor) and
engine (text.delete and edit.paste through commands, then a file round-trip);
all failed before the fix.

Claude-Session: https://claude.ai/code/session_01La6SDgsmdZfgfDDmx3wiGU
2026-10-13 08:17:51 +00:00
moppeeerandClaude Opus 5.5 39ec501351 fix(edit): copy a selected graphic on its own; delete leaves the frame
With a placed image selected via Direct Selection (InDesign's content
selection), Copy now copies the graphic itself: a frame of the whole
image's bounds (uncropped) at its spread position, without the frame's
fill, stroke or effects. Paste Into then puts the full picture in place
inside the target shape, as InDesign does (LYH Studio episode 14, 5:44).
Cut and Delete with the graphic selected remove only the graphic; the
frame stays, empty and selected.

Nested items copy in spread coordinates (parent transform applied).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 10:12:43 +02:00
moppeeerandClaude Opus 5.5 7192c2e136 feat(eyedropper): A sampled colour goes to the stroke when the Stroke box is in front
As in InDesign, the Eyedropper applies a colour sampled from a placed image
to the fill or the stroke, whichever is in front in the toolbox: with the
Stroke box in front a selected line takes it on its stroke (it has no
fill to show it). The toolbox's state reaches tools through
ViewInfo/ToolContext::stroke_in_front.

Depends on #572.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 09:56:25 +02:00
moppeeerandClaude Opus 5.5 812df5b3d3 fix(tools): Fit along the frame's own axes; skip locked frames; fit text by its layout
Side handles map to the frame's local axis through spread and frame
rotation. Graphic frames honour the axis. Locked frames and frames on
locked layers are left alone. Text frames fit by searching the frame
height with its own columns and vertical justification, so two columns
stay two columns and Bottom/Center/Justify don't inflate it. A mouse
double-click on a handle fits (main's canvas counts clicks on the press);
a UI test covers it with one undo step.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 09:42:26 +02:00
moppeeerandClaude Opus 5.5 45d803c6a4 feat(tools): Double-click a frame handle to fit the frame to its content
In InDesign double-clicking a selection handle fits the frame to its
content: a corner fits both sides, a top or bottom handle the height, a
side handle the width. LYH Studio's tutorial uses it at 9:30 to fit the
INDESIGN text frame before moving it to the corner. In DesignCraft the
double-click switched to the Type tool.

- Selection tool: a double-click on a handle runs object.fit
  {mode: fitFrameToContent, axis: both|height|width}.
- object.fit fitFrameToContent fits text frames to their composed text:
  the bottom to the last line's descent, the right side to the longest
  line (one column), plus the insets, keeping the top-left. Overset text
  grows the frame first. Before, it fitted graphic frames only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 09:39:42 +02:00
moppeeerandClaude Opus 5.5 5b74bd71e4 fix(render): A group's gradient feather masks everything the group draws
The DestIn mask now covers the whole render target (and the PDF's
exported area), with the gradient kept in item space through the paint
transform, since past the gradient's ends the end opacity carries on: a
child's long drop shadow or thick stroke is faded, not cut off at a box.
feather_bounds counts only shown children and active states, walking
nested groups without recursion.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 09:33:12 +02:00
moppeeerandClaude Opus 5.5 6f4fa3e56d fix(render): A group's gradient feather fades the group, on screen and in PDF
A gradient feather on a group (Gradient Feather tool over grouped text, as
in LYH Studio's poster tutorial) did nothing on screen: groups never went
through the effects path. In PDF the group's mask was the group's own path
bounds, and a group has no path, so the mask covered a box of zero size and
hid the group.

- Item::feather_bounds: the box the feather spans, the objects' bounds for
  a group.
- Render: a feathered group draws its objects in one layer, then fades it
  with the same mask as other objects (fx::gradient_feather_mask).
- PDF: the group's mask spans its objects.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 09:33:12 +02:00
Brandon ThomasandClaude Opus 5.5 e862e0a613 fix: integrate batched community PRs (#572 with #662's fallible spread_param; #524's test helper back in its module)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 02:28:50 -04:00
Brandon Thomas 777d8c3251 Merge branch 'pr/572' into batch1
# Conflicts:
#	crates/tools/src/tests.rs
#	crates/ui-egui/src/i18n.rs
#	crates/ui-egui/src/i18n/ar.rs
#	crates/ui-egui/src/i18n/it.rs
#	crates/ui-egui/src/i18n/ja.rs
#	crates/ui-egui/src/i18n/pt_br.rs
#	crates/ui-egui/src/i18n/uk.rs
2026-10-13 02:24:24 -04:00
Brandon Thomas 89e9abbc8d Merge branch 'pr/662' into batch1
# Conflicts:
#	crates/engine/src/cmd/object.rs
2026-10-13 02:23:56 -04:00
Brandon Thomas a390905beb Merge branch 'pr/647' into batch1
# Conflicts:
#	crates/tools/src/lib.rs
#	crates/tools/src/tests.rs
#	crates/ui-egui/src/canvas.rs
2026-10-13 02:23:33 -04:00
Brandon Thomas 0a14d9fb97 Merge branch 'pr/539' into batch1 2026-10-13 02:23:12 -04:00
Brandon Thomas 2103af784a Merge branch 'pr/537' into batch1 2026-10-13 02:23:11 -04:00
Brandon Thomas d5613411ca Merge branch 'pr/522' into batch1 2026-10-13 02:23:11 -04:00
Brandon Thomas 6e551af3e7 Merge branch 'pr/663' into batch1 2026-10-13 02:23:11 -04:00
Brandon Thomas b758c6180a Merge branch 'pr/649' into batch1 2026-10-13 02:23:11 -04:00
Brandon ThomasandClaude Opus 5.5 b70b586a16 fix(path-type): NaN-safe bracket clamping (f64::clamp panics on a NaN path length)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 02:22:34 -04:00
Brandon Thomas 878169130e Merge branch 'pr/600' into batch1 2026-10-13 02:21:53 -04:00
Brandon Thomas 8a36af3af8 Merge branch 'pr/630' into batch1 2026-10-13 02:21:53 -04:00