Commit Graph
1054 Commits
Author SHA1 Message Date
aiongg 7a0407f8a7 Merge #118: Honor MCP typing, story, and page contracts 2026-10-09 22:16:13 +00:00
aiongg 8cd7bdc88b Merge #117: Fix browser printing, startup flags, and document MIME 2026-10-09 22:16:13 +00:00
aiongg 8fe589586b Merge #224: Distribute selected table rows evenly and keep the edit undoable 2026-10-09 22:16:13 +00:00
aiongg de5d32c90f Merge #244: Rebind embedded image links when opening relocated packages (#235) 2026-10-09 22:15:59 +00:00
DWAA1660andCodex 658d8e1784 M5: rebind embedded image links when opening relocated packages (#235)
Reuse packaged-link candidates for embedded IDML images and native files.
Resolve missing original paths beside the opened document, retaining the
embedded image bytes and any original link that still exists. Bound path
lookup allocations and cover actual package relocation through commands.

Make existing data-merge test path assertions portable to Windows.

Co-authored-by: Codex <noreply@openai.com>
2026-10-09 15:07:20 -06:00
aiongg 40eaaea9db Fonts: a family named with a format suffix such as (OTF) resolves to the installed family 2026-10-09 20:49:09 +00:00
Skylar Taylor-Barrick a45375c335 FID2: preserve decoration color resets, geometry and paint order 2026-10-09 17:39:08 +00:00
Vikram Bhaskaran 6aaa4f0b75 Distribute selected table rows evenly and keep the edit undoable.
The rows share one fixed height that preserves their composed total. Merged rows and rows that are not laid out are refused, and the table stays unchanged.
2026-10-10 04:37:44 +11:00
zydvc26s67-webandCopilot App 3018c56e0c Character Styles: wire save and delete into the UI
Mirrors the Paragraph Styles fix (#169): Character Styles had no save
or delete affordance at all — not even an edit dialog existed.

- Add a new characterStyleOptions dialog (General: rename/based-on,
  Basic Character Formats, Character Color) reachable by double-click
  or the row's new "Edit Character Style…" context-menu entry.
- Add a style.character.delete engine command (mirrors
  style.paragraph.delete): rejects built-in styles, reassigns any text
  runs using the deleted style to a replacement (default [None]).
- Add rename and basedOn (with cycle rejection via the existing
  char_based_on_cycles) support to style.character.edit, matching
  style.paragraph.edit.
- Add a deleteCharacterStyle confirmation dialog with the same
  in-use detection and replacement-style picker as the paragraph one,
  wired via a new "Delete Character Style…" context-menu entry.
- Add Styles::resolve_char_style to resolve a character style's
  effective attributes for display, mirroring resolve_para_style.
- Add engine tests (edit persistence/rename, based-on cycle rejection,
  delete with run reassignment, built-in rejection) and UI-level
  dialog tests for both new dialogs.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-10-08 17:01:14 -07:00
zydvc26s67-webandCopilot App fde78978a4 Paragraph Styles: wire save and delete into the UI (#169)
The engine already supported style.paragraph.edit and
style.paragraph.delete, but the UI never exposed a delete action and
edit was only reachable by double-clicking a style row, with no
visible affordance.

- Add "Edit Paragraph Style…" and "Delete Paragraph Style…" entries to
  the paragraph style row context menu (hidden for built-in styles).
- Add a new deleteParagraphStyle confirmation dialog that detects
  whether the style is currently in use and, if so, lets the user pick
  a replacement style (defaulting to [Basic Paragraph]) for affected
  text before deleting.
- Add engine tests covering paragraph style edit (attribute merge and
  rename propagation), based-on cycle rejection, delete with text
  reassignment, and rejection of built-in style deletion.
- Add UI-level tests covering the edit dialog persisting changes and
  the delete dialog removing a style and reassigning text, including
  the default replacement style.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-10-08 14:55:11 -07:00
skylar taylor-barrick 4e4eaad1c8 PERF-MEM: release retired layouts and trim edit-history capacity 2026-10-08 15:35:20 -06:00
Philipp Krüger a11bd021cd feat(pptx): export documents as editable PowerPoint presentations
New designcraft-pptx crate (L3) and file.exportPptx command (File ›
Export PowerPoint…, CLI --export x.pptx). Each page becomes a slide of
native objects: shapes with fills, gradients, strokes and effects,
pictures cropped like their frames, native tables, and text boxes.

Text keeps DesignCraft's composition by default: composed lines end in
line breaks, justified spacing becomes character spacing, and leading
becomes percentage line spacing (PowerPoint rounds exact spacing to
whole points; its 100% line is 1.2 em for every font). Threaded
stories split at their frames and wrapped lines get their own boxes.
lineBreaks: reflow writes one box per frame in native columns instead.

TrueType fonts are embedded as Embedded OpenType when their licences
allow. Objects PowerPoint can't represent (placed PDF/EPS, type on a
path, some effects) are rasterised through the existing
rasterize_where path.

Checked in PowerPoint for Mac and LibreOffice: on the sample magazine,
word positions match DesignCraft's PDF to within 0.8 pt horizontally
and 1.6 pt vertically.
2026-10-08 23:32:53 +02:00
skylar taylor-barrick b050343a6c links.relink: make replacements atomic and retain EPS sources 2026-10-08 11:13:17 -06:00
Jan Hallvard LarsenandClaude Opus 5.5 7c739feb6f Commands: huge row and column counts can't exhaust memory
Three commands took a count from their parameters and used it unchecked.
Parameters come from MCP, the control channel and scripts, so the count
is hostile input (never-crash: cap input-sized allocations, checked
arithmetic).

- layout.createGuides made one or two guides per row and column with no
  upper limit: 30 million rows took 1.2 GB, and 2^32 - 1 would exhaust
  memory, which aborts the process past the command guard. A count over
  2^32 wrapped to a small one. Both counts are now capped at 100.
- edit.stepAndRepeat multiplied rows by columns as usize. In debug builds
  the overflow panicked; in release builds 2^32 x 2^32 wraps to 0, passes
  the 1000-copy limit and starts a grid of 2^64 copies. The product is
  now checked, and a grid that large falls back to `count` copies like
  any other grid over 1000.
- file.new stored any column count in the page (4 billion, or a wrapped
  value past 2^32). Page::column_rects builds one rect per column each
  time the columns are laid out. The count is now clamped to 1..=216,
  the range layout.marginsAndColumns already uses.

Each case has a regression test that failed before the fix.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-08 15:45:15 +01:00
aiongg 11585c82fa Styles: editing a character style renames it everywhere it is used, changes its Based On and unsets attributes; [None] can't be edited 2026-10-08 09:46:59 -04:00
Shao Wenbin 56febef6ab CJK-REVERT1: revert CID preference and diagnostic expansion
Revert 20ce4f5 because the compatibility extension does not implement CID-based layout and is not required for the verified spacing repairs.
2026-10-08 20:32:53 +08:00
Shao Wenbin 20ce4f5ecd CJK-MOJI9: preserve CID preferences and report unsupported glyph classification 2026-10-08 20:24:59 +08:00
Shao Wenbin bc43965a45 CJK-MOJI7: validate spacing data and inspect nested typography rules 2026-10-08 20:14:16 +08:00
Shao Wenbin d16a7423b8 CJK-MOJI3: report only unsupported Mojikumi rules in preflight 2026-10-08 19:55:16 +08:00
Shao Wenbin 4f8d230d70 CJK-BASE: integrate font resolution and special-text preflight branches 2026-10-08 19:50:38 +08:00
Shao Wenbin af43dd88c9 FONT7: validate replacement coverage and reject placeholder font fallbacks 2026-10-08 19:19:33 +08:00
Shao Wenbin f36636b95f FONT6: unify localized font matching and replacement recommendations 2026-10-08 19:02:39 +08:00
Shao Wenbin 39482d1b8c FONT5: diagnose missing glyphs in generated text with frame locations 2026-10-08 18:56:14 +08:00
Shao Wenbin 6c18ccdc3b FONT2: resolve inherited fonts during document-wide replacement 2026-10-08 18:33:42 +08:00
Shao Wenbin 2dbbf98900 FONT1: preserve composite font references and unify usage checks
Resolve imported composite fonts by resource identity and preserve literal
display names. Export AppliedFont as an object reference instead of registering
a composite definition as an ordinary font family.

Share composite lookup and typed font usage between composition, font inventory,
and preflight. Include nested cells and notes, and report only component fonts
selected by the document's characters.

Add synthetic coverage for reference round trips, footnote character mapping
and metrics, nested font inventory, component replacement, and undo.
2026-10-08 18:21:10 +08:00
Shao Wenbin 7c10b3ad41 IDML1: preserve anchored text frames and footnote artwork
Resolve forward story references before importing embedded frames and groups.
Compose embedded stories, retain anonymous-story objects for screen and PDF
rendering, and invalidate layout caches when embedded frame geometry changes.

Measure inline objects by geometry, fill open contours, reject cyclic frame
references, and distinguish unplaced stories from located overset text.

Add synthetic round-trip, composition, preflight, pixel-rendering, and PDF
regressions. Update the roadmap with the supported import and rendering paths.
2026-10-08 18:08:44 +08:00
skylar taylor-barrick 637d05e776 #91: reject PDF pages before narrowing on Wasm 2026-10-08 00:31:43 -06:00
skylar taylor-barrick e9cc4b49ec #61: honor MCP typing, story and page contracts 2026-10-08 00:08:17 -06:00
skylar taylor-barrick 8662526736 browser-correctness: fix print, startup flags, and document MIME 2026-10-08 00:08:16 -06:00
aiongg 0f52f3ba89 Text: stories made in a right-to-left-bound document fill their columns from the right (#100) 2026-10-08 01:57:30 -04:00
aiongg 3c83f4f477 Tables: new tables take their paragraph's direction, and the Table panel sets a table's direction (#100) 2026-10-08 01:54:14 -04:00
Brandon ThomasandClaude Opus 5.5 bed9438612 Merge #81 (includes #83, #84) into fix/compose-baseline-frame-fit
#83's Keep Lines Together tests change expectation: with the last baseline
allowed on the bottom inset, the first frame holds one more line, so the
10-line paragraph splits 7/3 instead of 6/4 (the keep rule is unchanged).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 23:24:30 -04:00
aiongg 1bdca77eea Merge the fork's feat/text-editing-and-frames 2026-10-07 23:12:38 -04:00
aiongg e13dee0728 Text: Bold and Italic link the document's own fonts
Bold and Italic find the linked style through the document's font scope,
so a family from the document's fonts folder links its own styles; the
Character panel's B and I state reads the same scope.
2026-10-07 23:04:29 -04:00
Brandon ThomasandClaude Opus 5.5 fc6101d10f Merge origin/main into feat/text-editing-and-frames
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 22:58:36 -04:00
Brandon ThomasandClaude Opus 5.5 f2b8c3dce1 Merge origin/main into feat/layout-parity
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 22:58:28 -04:00
Brandon ThomasandClaude Opus 5.5 0590f63406 Merge #83 (layout parity) into feat/text-editing-and-frames
Trailing spaces and drop caps both join the placed line; hit testing checks
the drop cap first, then the closest line (hit_line). hit_char also picks
the drop cap's character under the point, so a double click on the cap
selects from it (the follow-up both PRs named).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 22:47:17 -04:00
Brandon ThomasandClaude Opus 5.5 962234fbdf Merge origin/main into feat/text-editing-and-frames
Resolve conflicts with the CJK/Arabic work: trailing spaces follow the line
only in left-to-right paragraphs without right-to-left glyphs (layout_line
now takes the bidi info); style linking moves to ScopedFonts so the
document's own fonts count (FontDb delegates to scope 0); threading keeps
the receiving story's direction and Vertical Type, and frames split off by
threading or removed from a thread keep theirs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 22:41:43 -04:00
Brandon ThomasandClaude Opus 5.5 6e8e252cc4 Merge origin/main into feat/layout-parity
Resolve conflicts with the CJK/Arabic composition work: line metrics keep
the first-baseline tops and add the CJK alignment shift; the CJK line
reference adjustment applies before baseline-grid snapping; layout_line
takes the bidi info and the drop cap is spliced in after it; vertical text
is now the story's direction (FrameSpec::vertical); IDML insets use main's
validated inset_spacing over the object style chain; format's JSON upgrade
(vertical frames) and model upgrade (format v2 defaults) both run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 22:34:18 -04:00
Brandon ThomasandClaude Opus 5.5 48dfbcfd19 Merge origin/main into data-merge
Resolve conflicts keeping both sides: doc gains both `cjk` and
`datamerge` modules; file.open resolves data-merge sources and loads the
document's fonts; DocState keeps preview_stash/preview_record and fonts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 22:28:15 -04:00
Brandon ThomasandClaude Opus 5.5 2d889af2e2 M2: keep the system clipboard away from the control channel
Commands run while handling a control request (engine.execute,
ui.menu.invoke, ...) no longer read the system clipboard into Paste or
write Copy/Cut text to it; only user-initiated runs do. Regression test
included. append_story allocates note, endnote, editorial and table ids
with saturating_add (no overflow panic on hostile ids), with a test.
Also fixes a clippy nonminimal_bool in cmd/text.rs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 22:11:44 -04:00
Brandon Thomas aee756d604 Merge remote-tracking branch 'origin/main' into feat/cjk-and-fonts
# Conflicts:
#	crates/ui-egui/Cargo.toml
2026-10-07 22:04:42 -04:00
Brandon Thomas dd8d3037b1 Merge pull request #75 from ShaoWenbinSaleh/arabic-chinese-typesetting-rules-fix
Preserve and compose Chinese and Arabic typesetting rules
2026-10-07 22:04:16 -04:00
Brandon Thomas feb3808029 Merge pull request #56 from storybored379/fix/guide-layer-locks
Guides: honor layer protection in move and delete commands
2026-10-07 22:04:06 -04:00
Brandon ThomasandClaude Opus 5.5 2531f039fe Data merge: review fixes (bounded reads, no truncation, safe links, docs)
- Remove the docs/superpowers planning spec.
- textimport: cap decompressed zip parts at 64 MiB (protects Place and
  xlsx data sources); oversized part is an error. Regression test.
- datamerge: refuse data files over 256 MiB and skip image candidates
  over 256 MiB by metadata before reading.
- datamerge: assign_page uses get_mut instead of indexing spreads.
- datamerge: one/limit over u32 are errors, not truncated.
- select_records dedupes with a HashSet (was O(n^2)), order kept.
- Hyperlink cells: only http, https, ftp and mailto schemes link.
- Document data.* commands and data.merge creating a new document.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 21:54:38 -04:00
skylar taylor-barrick 089b1ac28f IDML: resolve nested packaged image links after relocation 2026-10-07 14:27:50 -06:00
aiongg 99f1e653f2 Text: locale-coded language names (de_DE_2006) get their language
IDML names some languages by locale code
(AppliedLanguage="$ID/de_DE_2006", "$ID/nl_NL_2005") beside names such
as "English: USA" and "Spanish: Castilian". language_tag maps any locale
code (ll, ll_CC, ll-CC, with a reform year after them) to its BCP 47 tag
(de-DE, nl-NL; kept once per process, at most 512 distinct tags), ignores
IDML's $ID/ prefix, and knows Spanish: Castilian (es-ES) and Swiss French
and Italian. The stored name stays as written, so IDML round trips are
unchanged.

What depends on the language now goes by the tag: typographer's quotes
(by language subtag; Swiss regions take guillemets), English
hyphenation and spelling (is_english), Korean word breaking and the CJK
fallback chains (ja-JP, ko-KR are Japanese and Korean whatever the
region).
2026-10-07 10:44:46 -04:00
aiongg c64e538de5 UI: the font menu groups fonts by script, CJK fonts by language
Font menus list Western (and other-script) families first, then
Japanese, Simplified Chinese, Traditional Chinese and Korean families,
each group alphabetical by the name shown, with a separator between
groups. The group comes from the font's own data, strongest signal
first: the meta table's dlng (else slng) languages, family names in a
CJK language (Windows and Macintosh language IDs), OS/2 code pages (JIS,
Chinese Simplified, Korean Wansung, Chinese Traditional, Korean Johab);
a font declaring none of these goes by what it covers (kana, Hangul,
ideographs). Ties go Japanese, Simplified, Traditional, Korean. Loaded faces are classified
once; installed fonts by the font scan, which also reads their OS/2 and
meta tables (and cmap only for fonts declaring nothing), capped.

CJK families show their family name in their language, the English
name on hover; Preferences > Type > Show Font Names in English
(prefs.set {showFontNamesInEnglish}, off by default) shows English
names. Search matches either name; documents store the English name.
The Character panel, Control bar, Properties, style dialogs, Find Font
and Glyphs panel lists all follow this order. The main font menu stays
open while searching or starring (it closed on any click inside).

Font previews don't draw DesignCraft's missing-glyph box for fonts
whose .notdef is empty.
2026-10-07 10:44:46 -04:00
aiongg 1ef187ad02 Text: missing glyphs show as boxes
A character the applied font lacks is drawn as that font's missing-glyph
box (its .notdef, gid 0), on screen and in PDF, and Preflight lists the
characters by font ("Missing glyphs in <family> <style>: …", an error,
at most 20 named). A .notdef without an outline is drawn as a hollow box
across its advance, so a missing character never disappears. PDF draws
.notdef glyphs as paths, which PDF/A and PDF/UA accept. Kenten marks are
set in their text's font the same way.

The document setting Draw Missing Glyphs from Fallback Fonts
(DocSettings::glyph_fallback; Preferences > Composition,
document.preferences {glyphFallback}, undoable) draws them from fallback
fonts instead (the language-aware chains, then any font; kenten marks
from a fallback font, else a bullet). It is off in new documents and
IDML imports and on in files saved before it existed, which keep
drawing as they did. A missing font's substitute always uses fallback
fonts. The composition cache's signature includes the setting. Tests
whose Arabic comes from a fallback font turn the setting on.
2026-10-07 10:44:46 -04:00
aiongg a08198e139 CJK 1.11: Chinese language names in their common spellings
language_tag ignores case and punctuation and recognises Chinese in its
common spellings and locale codes (Simplified Chinese, Chinese
(Simplified), zh_CN, zh-Hans; Traditional Chinese, zh_TW, zh_HK,
zh-Hant), and Japanese and Korean locale codes (ja_JP, ko_KR).
Typographer's quotes for Chinese and Japanese follow the tag, so every
spelling takes the same quotes. IDML import keeps the name as written.
2026-10-07 10:44:46 -04:00