feat: bounded huge-image decoding, webp/gif, remote rasters, Georgian/Armenian fonts

Giant rasters (500 MB aerial/GIS TIFFs) decoded whole: multiple GB of
RGBA on a wasm heap is tab death, and even desktop silently failed
past the image crate's 512 MiB default allocation cap. Decoding now
probes the header for dimensions first and runs in tiers — full decode
under a per-target budget (512 MB wasm / 4 GB native, enforced through
the decoder's allocation limits so oversize fails fast instead of
ballooning), Lanczos3 downsample to a display cap (4096² wasm /
8192² native) when the decode fits but the buffer is oversized, and a
clear localized refusal naming the dimensions and the limit when it
cannot. The probed source dimensions stay the entity's sizing truth,
so a downsampled buffer never shrinks the on-paper footprint; PDF
export self-corrects (effective DPI derives from placement × stored
pixels). Refusals surface once per image through the pick, open, and
drop/re-resolve paths.

Decode coverage gains webp and gif (pure Rust in image 0.25 — no C,
no lockfile churn), with the attach picker and drop filters matching.

Remote http(s) raster references now fetch on web: CORS-classified
failures name CORS, HTTP errors name the status, bodies over 64 MB and
8 s deadlines are bounded, and fetched bytes join the session source
registry (so ARCHIVE can package them and re-resolution reads cache).

Georgian and Armenian Noto subsets ship (generation blocks included),
so those scripts render instead of skipping; scripts still without
subsets remain silently skipped, unchanged.

(cherry picked from commit ca0d7b96)

Ported onto main (#1717 review): Armenian and Georgian take the script
indices after Lao, which main added meanwhile.
This commit is contained in:
Afonsop authored and Hakan Seven committed 2026-10-12 12:02:05 +03:00
1 parent 8a5d343927
commit 93e97bdf18
31 files changed
+840 -39

No files matched your search

+5
View File
@@ -1617,6 +1617,7 @@ pub(super) fn message_attribute(source: &str) -> Option<(&'static str, &'static
"IMAGE Specify insertion point (%{name}): " => Some(("draw", "image-specify-insertion-point-name")),
"IMAGE Specify width (drag right):" => Some(("draw", "image-specify-width-drag-right")),
"IMAGE: {e}" => Some(("common", "image-e")),
"\"{name}\" is {width}×{height} px and would decode to {decoded} MB, over the {limit} MB image limit of this build — it cannot be attached. Images within the limit are attached at a reduced display resolution when needed." => Some(("file", "image-over-the-decode-limit-cannot-be-attached")),
"IMPORTOBJ: imported \"{file_stem}\" as mesh." => Some(("common", "importobj-imported-file-stem-as-mesh")),
"IMPORTOBJ: target drawing was closed." => Some(("common", "importobj-target-drawing-was-closed")),
"IMPORTOBJ: {error}" => Some(("common", "importobj-error")),
@@ -5822,6 +5823,10 @@ pub(super) fn message_attribute(source: &str) -> Option<(&'static str, &'static
"Autosave copy could not be read: {error}" => Some(("common", "autosave-copy-could-not-be-read")),
"An open is already in progress." => Some(("common", "an-open-is-already-in-progress")),
"Autosave copy could not be queued: too many pending opens" => Some(("common", "autosave-copy-could-not-be-queued-too-many-pending-opens")),
"Remote image \"{url}\" could not be fetched: the network request failed (offline, DNS, or CORS)." => Some(("common", "remote-image-url-could-not-be-fetched-the-network-request-failed-offline-dns-or-cors")),
"Remote image \"{url}\" could not be fetched: the server returned HTTP {status}." => Some(("common", "remote-image-url-could-not-be-fetched-the-server-returned-http-status")),
"Remote image \"{url}\" was not loaded: it exceeds the 64 MB remote-image limit." => Some(("common", "remote-image-url-was-not-loaded-it-exceeds-the-64-mb-remote-image-limit")),
"Remote image \"{url}\" could not be fetched: the request timed out." => Some(("common", "remote-image-url-could-not-be-fetched-the-request-timed-out")),
_ => None,
}
}