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

+49
View File
@@ -698,11 +698,53 @@ impl OpenCADStudio {
);
registered.push(name);
}
// Remote http(s) raster refs the background fetch settled:
// successes already registered their bytes under the URL (the
// fetch task does it), failures surface on the command line —
// a network/CORS block, an HTTP status, the size cap, or the
// deadline reads differently to the user.
use crate::scene::model::image_model::{RemoteFetchError, RemoteFetchOutcome};
let mut fetched: Vec<String> = Vec::new();
while let Some(outcome) =
crate::scene::model::image_model::take_remote_fetch_outcome()
{
match outcome {
RemoteFetchOutcome::Loaded(url) => fetched.push(url),
RemoteFetchOutcome::Failed(url, reason) => {
let note = match reason {
RemoteFetchError::Network => crate::tf!(
"Remote image \"{url}\" could not be fetched: the network request failed (offline, DNS, or CORS)."
)
.into_owned(),
RemoteFetchError::Status(status) => crate::tf!(
"Remote image \"{url}\" could not be fetched: the server returned HTTP {status}."
)
.into_owned(),
RemoteFetchError::TooLarge => crate::tf!(
"Remote image \"{url}\" was not loaded: it exceeds the 64 MB remote-image limit."
)
.into_owned(),
RemoteFetchError::Timeout => crate::tf!(
"Remote image \"{url}\" could not be fetched: the request timed out."
)
.into_owned(),
};
self.command_line.push_error(&note);
}
}
}
registered.extend(fetched);
if !registered.is_empty() {
for tab in self.tabs.iter_mut() {
tab.scene.resolve_registered_image_names(&registered);
}
}
// Over-budget decode refusals from this poll's re-resolves
// reach the command line; the affected images keep their
// broken-reference placeholders.
for note in crate::scene::model::image_model::take_decode_refusals() {
self.command_line.push_error(&note);
}
Task::batch([control, dropped])
}
#[cfg(not(target_arch = "wasm32"))]
@@ -1283,6 +1325,13 @@ impl OpenCADStudio {
}
}
}
// Images in (or dropped alongside) the opened drawing that
// exceeded the decode budget refused with a note; surface
// them now that the open has settled — the entities
// themselves show the broken-reference placeholder.
for note in crate::scene::model::image_model::take_decode_refusals() {
self.command_line.push_error(&note);
}
task
}