Bring in the 205042e Rule-10 pin (#9160) and the #9157 Sonar note so
this branch contains current main.
# Conflicts:
# Cargo.lock
# Cargo.toml
# apps/vectorcraft-web/Cargo.toml
# crates/text/Cargo.toml
# xtask/src/pdf_deps.rs
Shard 5 (Checks) failed because cargo xtask pdf-deps still expected
craft-pdf and the hayro/krilla backends at d7c9632, and hayro-jbig2 at
the leftover stream-codec pin. All of those crates now resolve at the
shared 205042e revision.
Rule 10: every storytold/craft-libs crate is at the same rev, now
205042e406b630cda653990649264a78fea6296b, the merge of #3136 on
craft-libs main. That rev still skips a form already on the drawing
stack (ISO 32000-2 §8.10.1) but no longer reports it as
ContentTruncated, so a 200-shape knockout-mask PDF imports completely.
Also moves the leftover per-crate pins of craft-font-catalog and
craft-web-api onto the same rev.
Pin craft-metafile to craft-libs main 8f6ad14b, which includes the
merged PICT reader (storytold/craft-libs#3073), drop the craft-codepage
dependency the removed reader used, and update the PICT detection
comments for version 1 pictures.
Signed-off-by: FredApps <153173854+FredApps@users.noreply.github.com>
* PDF import: keep embedded fonts for text whose family isn't installed
Glyphs drawn in an embedded font whose family isn't available are gathered
during import and built into one small TrueType font per family and style,
kept with the document (font/ttf blob). Text objects record the fonts and a
hash of their text: layout and rendering draw them in the kept font until the
text is edited (undo restores it) or the family is installed. Lines are
spaced against the file's own widths with per-glyph placement (#3756).
* PDF import: satisfy crate layering constraints without format dev-dep
* FileFont: negate us_win_descent in i32 to prevent overflow on extreme negative descenders
* PDF import: a kept font carries the file font's licence flags, and the docs say what that means
Review of #4569: the fsType of the file's font is copied to the font built from its glyphs (a test pins it against Embedding), so exports honour it; the docs state the limits, that the file's font program is not parsed, and that a saved file carries third-party glyphs.
* PDF import: a glyph curve far outside any glyph is left out; docs say what the limits and the font program mean
CodeRabbit on #4569: coordinates beyond 1e6 font units are refused before the curve is subdivided. The docs say the 64-font limit is what draws one type object and that the file's font program is read only for its licence flags and metrics.
* PDF import: two programs of one font keep the stricter licence flags; the docs cite their sources
CodeRabbit on #4569: embedded programs of one family and style share one built font, which kept the first program's fsType; it now takes the stricter of the two, whichever came first. The docs entry cites the Acrobat Help pages and the OpenType fsType specification.
* fmt
* PDF import: embedded fonts are on by default, with an opt-out preference
Owner decision on #4568. Preferences > File Handling > Use fonts embedded in imported PDFs (pdfImportEmbeddedFonts, on by default) and the embeddedFonts param of document.open and file.place: off, a PDF's type in a font the machine lacks is set in the fallback font with the missing-font warning, as before. One test each for on and off, one for the preference reaching the options.
* fmt after merging main
* docs: restore the status lines damaged by merges (main's line plus this PR's note)
* PDF import: set embedded_fonts through a builder method (keeps read_opened under the complexity limit)
* PDF import: move the missing-font notes out of read_opened (complexity limit after the merge)
* #4569: isolate file-font resources and reclaim live faces (UNVERIFIED)
* Preserve carried-font ownership across placement and recovery
* Fix carried-font regression test dependencies and unwind probe
* Use explicit OS2 heights in owned-font reference regression
* Keep native font regression artwork inside document layers
* fix(engine): bind file fonts when reading document profiles
* test(engine): initialize file-font leases in new image fixtures
* test: complete file-font lease initialization in image fixtures
* docs: keep the #4568 entry in the file-format parity status line
* fix(pdf): keep a line with another glyph for the same character as outlines (review)
A font kept with the document has one glyph per character. A glyph of the file's font that
differs from the one already kept for its character (a stylistic alternate that maps to the same
Unicode scalar) marks its line, which is imported as outlines so each glyph draws as the file
does.
* docs: resolve the leftover status-line conflict
* Placed document blob: give the new ImageBlob literal its file_font
* Test: a PDF's two glyphs for one character survive a native save and reopen as the file draws them
* Test: move the native save and reopen half of the two-glyphs regression to the engine (layers: no format dev-dep in pdf)
* Fix embedded-font preference help and English fallback checks
* Format embedded-font preference help with the workspace edition
---------
Co-authored-by: FredApps <FredApps@users.noreply.github.com>
Co-authored-by: skylartaylor <hi@skylar.cc>
Use craft_metafile::unit_facts from craft-libs#3071 for the placeable
frame, metric map-mode scan and EMF calibration; the fallback scales
stay VectorCraft's policy.
- A read-only image entry may leave out `opacity`, which hosts before API
level 3 don't give, so a level 2 filter that rebuilds an image entry from
the fields it knows still matches.
- A `text.paragraphs` list returned as it was given next to changed
`text.runs` is checked against the new paragraphs: a count that no longer
matches is refused instead of being dropped.
- Written runs hold at most 4,096 paragraphs, the limit for runs and for
the paragraphs a filter is given.
- A fill or stroke in a written run's style with a key its `type` doesn't
read (`tintt`) is refused with the `unknown key` error.
- The font family limit counts the name as given, not the trimmed name.
- The run styles of a type object are indexed once per object, not
compared with every run's style.
- Character styles loaded from another document are skipped when their
tracking, kerning, rotation, miter limit, dashes, Small Caps or variable
font axes are out of range, as `charStyle.new` checks them.
- The plug-in command test's Size command adds a square, since an output
that changes nothing records no undo step.
Docs: docs/plugins.md, docs/mcp.md, plugin.run params text.
The messages a filter's `writes` manifest key and its changed type,
images and symbol instances can give have an `@msg` row in each of the
25 complete-message catalogs. The other new errors use messages the
catalogs already translate: "`{key}` must be a string", "`{key}` must
be an object", and "read-only field 'text' changed" for text changes to
an object that is not type.
Runs written without text.paragraphs that change the paragraph count at
two separate places gave every paragraph between the first and last change
the first one's style. The host now matches the old and new paragraphs by
their text: an unchanged paragraph keeps its style, changed paragraphs take
the styles of those they replace in order, and an added paragraph takes the
style of the one before it (the next one at the start) without a list
number. Past 262,144 compared pairs the paragraphs are paired in order.
Type a filter returned went to layout with its character and paragraph
styles only parsed, and a style equal to one of the type's runs was not
checked at all, so a filter could set leading of 1e9, 100,000 tab stops,
a scale of 0 or a Kinsoku set the document does not have.
- The ranges the character and paragraph style commands keep each
attribute to move to CharStyle::check_ranges and
ParaStyle::check_ranges in vectorcraft-doc (text/attr_ranges.rs).
charStyle.new, charStyle.edit, charStyle.setAttrs and the paragraph
style commands call them, and so does the filter write path, for every
run and paragraph style, including one the type already has.
- A paragraph style's custom Kinsoku set must name one of the
document's sets, and takes that set's characters.
- The character style commands now also refuse tracking and kerning
outside -1000 to 10000, rotation outside -360 to 360, a miter limit
outside 1 to 500, Small Caps outside 1 to 200, negative dash lengths
and a variable font axis setting that is not a number.
Each refusal names the object and the field, and the document does not
change. Docs: docs/plugins.md, docs/mcp.md, docs/target-app-parity.md.
A filter's manifest may list `writes`, the kinds among its `inputs` it
may change, at `api` 3 with `doc.write` in `permissions`. Such a filter
returns those objects with the fields it changes: type's runs and
paragraph styles, an image's transform and opacity, an instance's
transform and symbol (one already in the document), and each one's
name. Every value is checked as the input's limits and a path's paints
are; any other changed field, or a value out of range, refuses the run
naming the object and the field, and the document stays as it was.
The changes of one run are one undo step, and an output that changes
nothing records no undo step for any filter. Images are now also given
with their opacity.
Docs: docs/plugins.md, docs/mcp.md, docs/target-app-parity.md.