Files
vectorcraft/crates/pdf/Cargo.toml
T
dotCooCoo 8c2ab73b81 Tests: bounded-work checks count the work instead of timing it
Six engine tests guarded against quadratic or unbounded work by timing
it (under 2, 10, 30 or 60 seconds) or by printing how long it took. A
slow or loaded machine could fail them, and a regression that stayed
under the bound passed. Each now counts the work the guarded code does
and compares it with a smaller input or with the code's own limit:

- An unknown command id or parameter key of 200,000 characters compares
  no more characters than one of 20 (edit-distance cells).
- A Word .doc with 20,000 hidden paragraphs reads at most one more Prl
  per paragraph than one with a single paragraph, and each style's
  properties are read once.
- One function-based shading filling 5,000 paths takes no more function
  evaluations than filling one, and twenty stay within the import's
  evaluation budget.
- A form decoding to 64 MiB drawn 1,000 times is walked no further than
  the page's form-content limit and one more form.
- A blend of 998 steps measures no more laid steps per object than a
  blend of 3, and one of 1,500 steps is not laid out.
- Retype of a tracked line of 450 glyphs lays out at most 20 times the
  glyphs a line of 45 does.

The counters are test-only: thread-local cells in the engine under
cfg(test), and in vectorcraft-pdf (read-count feature) and
vectorcraft-eps (new work-count feature), which the engine enables in
its dev-dependencies only. Retype's layout calls go through one helper
that counts them.
2026-11-27 16:20:23 -08:00

69 lines
2.9 KiB
TOML

[package]
name = "vectorcraft-pdf"
version.workspace = true
edition.workspace = true
license.workspace = true
description = "VectorCraft PDF export and import"
[lints]
workspace = true
[features]
# `vectorcraft_pdf::reads_of`, `imports_of`, `function_evaluations_of`, `form_content_of` and their
# limits for other crates' tests (dev-dependencies only).
read-count = []
[dependencies]
vectorcraft-geom = { workspace = true }
vectorcraft-doc = { workspace = true }
vectorcraft-effects = { workspace = true }
vectorcraft-brush = { workspace = true }
vectorcraft-color = { workspace = true }
vectorcraft-text = { workspace = true }
skrifa = { workspace = true }
kurbo = { workspace = true }
thiserror = { workspace = true }
flate2 = { workspace = true, features = ["zlib-rs"] }
image = { workspace = true }
craft-image-codecs = { workspace = true }
# CMYK JPEGs (src/images.rs; the image crate writes RGB and grey ones only).
jpeg-encoder = { workspace = true }
craft = { workspace = true, features = ["pdf-interpret", "pdf-write"] }
craft-stream-codecs = { workspace = true }
log = { workspace = true }
chrono = { workspace = true }
smallvec = "1"
siphasher = "1"
serde = { workspace = true }
# The XMP packet that File Info is read from (file_info.rs).
craft-xml = { workspace = true }
# PDF security (encrypt.rs): pure Rust, MIT OR Apache-2.0, builds for wasm.
aes = "0.8"
md-5 = { version = "0.10", default-features = false }
sha2 = { version = "0.10", default-features = false }
# The seed of the file key, salts and IVs (encrypt.rs).
getrandom = "0.4"
[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies]
# The browser's crypto.getRandomValues.
getrandom = { version = "0.4", features = ["wasm_js"] }
[dev-dependencies]
vectorcraft-testkit = { workspace = true }
# A variable font built in code (no font file is committed).
vectorcraft-text = { workspace = true, features = ["test-fonts"] }
serde_json = { workspace = true }
# `draw_text`, to write test files with live text as other writers do.
krilla = { workspace = true, features = ["simple-text"] }
# How many times the symbol list is read to find symbols by name.
vectorcraft-doc = { workspace = true, features = ["symbol-read-count"] }
# The counters vectorcraft-engine's tests turn on, also when this crate is tested without
# vectorcraft-engine (`cargo xtask ci shard`).
vectorcraft-pdf = { path = ".", features = ["read-count"] }
# An independent raster oracle for gradient placement in PDF forms. These are test-only macOS
# bindings; the exporter stays portable Rust and does not depend on an OS PDF renderer.
[target.'cfg(target_os = "macos")'.dev-dependencies]
objc2-core-foundation = { version = "0.3", default-features = false, features = ["std", "CFData"] }
objc2-core-graphics = { version = "0.3", default-features = false, features = ["std", "CGBitmapContext", "CGColorSpace", "CGContext", "CGDataProvider", "CGImage", "CGPDFDocument", "CGPDFPage"] }