Day 3 (V2): the editor's document (crates/doc), .pictor, exports, SVG import #4
Reference in New Issue
Block a user
Delete Branch "feature/editor"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Day 3 (V2) core:
crates/doc, the editor's document. Design: the app'sdocs/03_editor.md; format:docs/FORMATS.md("The .pictor document").What
ops).format): zip with document.json, PNG assets and embeddable fonts; strict, capped reading; newer formats refused with their message.text): fontdb system fonts + document fonts, rustybuzz shaping with per-character fallback, line breaking, alignment incl. justify, letter spacing; OS/2 fsType read.display) and the tiny-skia painter (render): glyphs as outlines defined once; opacity groups.bitmap): brush/eraser (soft dabs, no build-up), pencil, fill and wand (scanline flood), rect/lasso masks, delete/copy, adjustments (brightness, contrast, levels, hue/saturation, invert, blur, sharpen), clone stamp, matte;editreturns the exact undo patch.export): PNG at a scale, JPG on white, SVG with real<text>, PDF with pdf-writer (vectors, shading patterns, ExtGState/transparency groups, images with SMask, Type 0 fonts subset with subsetter, ToUnicode, exact MediaBox). Restricted or bitmap-only fonts are refused with the font's name and the reason.svg, usvg) and the worker opsdoc.open(outside .pictor → a clean copy) anddoc.import_svg.Tests (186 in the workspace, all green; clippy 0;
deps.mjs228 crates, 0 not allowed)tests/format.rs(9): round trip of the fixtures, zip slip and odd names, a 300 MB bomb and a 1000× ratio, a 50 000² picture, 5000 entries, missing/wrong assets, broken JSON and lies, newer format.tests/undo.rs: proptest, 256 cases of up to 60 random edits (objects, text, layers, pages, pixel patches, groups, assets) → as many undos give the original, as many redos the edited document; a failing batch leaves nothing.tests/export.rs: text extractable in reading order (Czech letters), A4 at 595.276 × 841.89, a second page at its own size; pdfium's render of each fixture's PDF within 3/255 of the core's render; PNG/JPG sizes; SVG parses and keeps text. (The canvas half is in the app.)tests/fonts.rs: fsType restricted and bitmap-only refused with name and reason; installable, print and editable embedded.tests/render.rs,tests/bitmap.rs(incl. the wand taking a stroke's soft edge), workertests/hostile_doc.rs,pathandwordunit tests.Self-review
FontBookcaches outlines without a limit for the process's life; bounded in practice by the fonts in use.fixturesis a public module so the app's fidelity test can render the same documents.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.