* 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>
- With transparent pixels, a fixed palette's colors mapped to
transparent share the transparent pixels' slot, so at Colors 256 all
255 opaque colors keep their entries.
- The preview's mappedToTransparent lists a color mapped to transparent
that did not fit in the fixed palette when its pixels became
transparent.
- When Colors leaves a fixed palette fewer slots than it has opaque
colors, shifted colors keep their slots first, then locked ones, then
the others in palette order. The file keeps the palette's order.
- quantize::nearest_entries hands each pixel's entry to a callback
instead of collecting one per pixel.
- A GIF lossy test with one fixed entry of three.
Docs: params text, docs/mcp.md.
RenderOptions::hidden was a Vec<NodeId>, and the renderer checked each
node it visits against it with contains (node_checks::left_out and
Renderer::draw_node), so every check could compare against all k
hidden ids. The Fold Preview print hides every non-printing layer and,
with Show Fold Lines off, every object with a line role.
hidden is now a HashSet<NodeId>, so each check is one hash lookup. The
Fold Preview collects print_hidden's list into the set, and two tests
that built the field with vec! build it from an array. The field's doc
comment now names the Fold Preview print as its example.
New test a_render_leaves_out_every_object_of_a_large_hidden_set renders
2,000 strips with 1,000 of them in hidden and checks every strip's
pixel. It checks that hiding still works for a large set; the old Vec
drew the same pixels, so the test does not fail at run time without
the change.
- A file's corners are kept only when there are exactly four that the
image can take; a longer list is skipped without decoding it. Corners
the affine map misses stay a distortion, and a scale past the
perspective limit leaves the image at its nearest affine placement.
- Distort checks the corners in a frame local to the quad, so a missed
corner far from the origin is still refused.
- Relink and Unembed refuse a named or selected distorted image before
searching a folder or writing a file. Create Gradient Mesh lists the
distorted images it leaves in `skipped`. Place with Replace refuses
only when the measured image is distorted and the file is not text.
- SVG cuts a distorted image in a scaled symbol instance at the placed
size. EMF pieces store only the pixels inside their clip. PDF mesh
pieces of a CMYK image keep a same-corner mask as its soft mask, color
mask included. Both `.ai` writers write an image at the nesting limit
at its nearest placement with a warning. DXF warns only when it writes
the image.
- The canvas cuts the mesh by the view's largest stretch. Warped images
with a singular placement keep finite corners.
- docs/mcp.md and docs/plugins.md describe the tolerances, the DXF and
WMF fallback, the partial result of Create Gradient Mesh, and when a
plug-in sees `corners`.
A pattern's tile drawn for a proof that preserves the colors' numbers
kept the proof's image tables for its opacity masks, so a mask's image
was proofed and the mask covered differently than outside a pattern.
The mask now leaves its images as they are when the tile's ink carries
that proof, as it does for the frame's proof.
Measure effect-bearing Align to Path content after spine placement, retaining
the conservative envelope and covering damage containment with original
software-rendered move and Undo controls.
With transparent pixels and Colors at 256, a custom palette of one opaque color and 255 colors mapped to transparent has no room for the last of those, and its pixels took the nearest entry left, which could be the opaque color. Such pixels now take the transparent entry when their nearest color is one that did not fit.
Lossy compression compared each pixel with the reduction's colors, so a pixel next to a color shifted by hand could join that color and be written in its new color, and a pixel of the shifted color could leave it. Lossy now leaves the entries of shifted colors alone, as it does the transparent entry.
The color table's trash button and Delete Color in its new menu delete
the selected GIF or PNG-8 colors. Pixels that used a deleted color take
the nearest color left, with the current reduction's color distance and
dither, and the preview matches the saved file. A click selects one
color and makes it the anchor, Shift-click selects the range from the
anchor, and Ctrl-click (Command-click on macOS) adds or removes one.
- colorTable.deleted lists the deleted colors by source. A deleted color
leaves the locked, transparent and webShift lists.
- colorTable.customPalette fixes the palette at the first deletion, so a
deleted color is not made again; the table reads Custom. Restore
Generated Table in the menu, or another reduction, clears both.
- Deleting every opaque color, or every color not mapped to transparent,
is an error and changes nothing.
- Presets and the remembered settings keep the edit.
- quantize_to uses all 256 fixed colors when no pixel is transparent.
Docs: docs/mcp.md, docs/target-app-parity.md.
A damaged .ai can give a gradient mesh whose outline is enormous but finite.
draw_mesh_raster flattened that whole outline in device pixels (grown_outline),
and kurbo's flatten then asked for more segments than memory holds: a
"capacity overflow" panic (seen in import_fuzz's ai_written_meshes_never_panic).
An outline wider or taller than 2^24 device pixels now goes to the per-quad
drawing path the function already falls back to.
Perspective Distort and Free Distort (`object.distort`) used to give an image
only the warp's affine approximation at its center, so its corners did not
follow the handles and it drifted away from paths warped with it.
- An image's four corners now go exactly where the warp takes them, alone or
in a mixed selection. A parallelogram stays in the image's transform; any
other shape is kept in the new `image_quad` field of the native file, which
older files do not have and still open as before.
- Corners that would fold the image over, fall on one line, cross the warp's
horizon or lie too close together for a perspective map are an error, and
nothing changes. A file whose corners break these rules opens with the image
placed by its transform. A drag is one undo step, and a distort that leaves
the corners where they are records none.
- Bounds, hit testing, transforms, Transform effects, blends, the Eyedropper,
Outline view, the Color Theme Picker and Weed Box and Lines follow the
corners. Image info measures the resolution at the image's middle, and
plug-ins get the corners.
- The canvas, printing and every exporter draw a distorted image as a mesh of
affine image pieces through the shared mesh warp, clipped by the corners.
In files and print the mesh aims to stay within 0.05 pt with cells of at
least 2 pt; the canvas cuts it for the zoom, within a quarter of a pixel
with cells of at least 4 pixels. Pieces reach into their neighbors (0.5 pt,
or 2 pixels on the canvas), so the image stays opaque at every zoom. The
mesh has at most 64 by 64 cells and no more cells across than the image
has pixels on its longer side (at least 8). No warped copy of the pixels is
stored. DXF and WMF write the nearest parallelogram and warn.
- Crop Image, Image Trace, Relink, Embed, Unembed, Create Object Mosaic,
Create Gradient Mesh and Place with Replace refuse a distorted image with an
error that names the distortion. Update Links puts a changed file's pixels
between the same corners, without applying Placement Options. Mask follows
the corners. Rasterize makes a plain image of it.
- The new error messages have rows in every complete-message catalog.
Docs: docs/mcp.md, docs/plugins.md, docs/target-app-parity.md.
A VP8 key frame stores its first partition's size in 19 bits (RFC 6386
section 9.1). The encoder writes 524,287 for a larger partition too, and
a decoder then reads the token partition from the wrong offset. A lossy
WebP whose size field is at that limit now fails with an error that
suggests a lower resolution or Lossless, instead of writing a file that
does not decode.