mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-25 20:14:31 +01:00
73 lines
3.5 KiB
TOML
73 lines
3.5 KiB
TOML
[package]
|
|
name = "craft-svg"
|
|
description = "SVG: sniffing, SVGZ and text encodings, pre-parse limits, a geometry reader (Bézier paths in millimetres), CSS colours and a writer"
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
license.workspace = true
|
|
rust-version.workspace = true
|
|
repository.workspace = true
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
# Files of other crates that this crate's build or tests read. CI selects this crate's tests
|
|
# when one of them changes (craft-common-actions' select-platforms).
|
|
[package.metadata.craft]
|
|
reads = [
|
|
"crates/ui-contract/tests/fonts/NotoSans-test.ttf",
|
|
]
|
|
|
|
[dependencies]
|
|
craft-xml = { workspace = true }
|
|
quick-xml = { version = "0.41", default-features = false }
|
|
# Probing and bounding raster images embedded in a parsed tree (`tree`).
|
|
craft-image-codecs = { workspace = true, optional = true }
|
|
# SVGZ (gzip), pure-Rust backend.
|
|
flate2 = { version = "1", default-features = false, features = ["rust_backend"] }
|
|
kurbo = { workspace = true }
|
|
roxmltree = "0.21.2"
|
|
thiserror = { workspace = true }
|
|
# The geometry reader (`paths`) builds and cleans its outlines with these.
|
|
vectorcraft-geom = { workspace = true, optional = true }
|
|
vectorcraft-pathops = { workspace = true, optional = true }
|
|
# The full SVG parser (Apache-2.0 OR MIT). The one version every Craft app uses: apps depend on
|
|
# craft-svg's `tree` feature and take usvg from its re-export, never directly.
|
|
usvg = { version = "=0.48.1", default-features = false, optional = true }
|
|
# Rendering the parsed tree uses the matching renderer version. Keep it behind an opt-in feature
|
|
# so callers that only need bounded SVG text/tree parsing do not pull in raster backends.
|
|
resvg = { version = "=0.48.1", default-features = false, optional = true }
|
|
|
|
data-url = { version = "0.3.2", optional = true }
|
|
# Renderer-specific validation uses the same resolved backends as resvg0.48.1.
|
|
# JPEG validation uses the existing backend in craft-image-codecs.
|
|
gif = { version = "=0.14.2", optional = true }
|
|
image-webp = { version = "=0.2.4", optional = true }
|
|
|
|
|
|
[features]
|
|
default = ["paths"]
|
|
# `craft_svg::paths`: the geometry reader (Bézier paths in millimetres) for cutters, plotters and
|
|
# CAD import. Off, the crate is SVG text, guards, path data, colours and the writer only, with no
|
|
# app crates (vectorcraft) among its dependencies.
|
|
paths = ["dep:vectorcraft-geom", "dep:vectorcraft-pathops"]
|
|
# `craft_svg::tree` without images: usvg behind the bounded entry point, the preflight, the
|
|
# limits and the draw check. For a caller that parses SVG it trusts no `<image>` in (UI icons).
|
|
tree-core = ["paths", "dep:usvg"]
|
|
# `craft_svg::tree`: usvg behind the bounded entry point, with the data-URL image resolver.
|
|
tree = ["tree-core", "dep:data-url", "dep:craft-image-codecs"]
|
|
# Text converted to paths (needs a font database in the options).
|
|
tree-text = ["tree", "usvg/text"]
|
|
# The system's fonts in `usvg::fontdb`.
|
|
tree-system-fonts = ["tree-text", "usvg/system-fonts"]
|
|
# Bounded drawing of a parsed tree through the matching resvg/tiny-skia versions, without text or
|
|
# raster images (`tree::draw::render`, `render_node`, the `resvg` and `tiny_skia` re-exports).
|
|
draw = ["tree-core", "dep:resvg"]
|
|
# Bounded rendering of a parsed tree with its text and raster images, and the raster validation
|
|
# through the decoders resvg uses.
|
|
tree-render = ["tree", "draw", "resvg/text", "resvg/raster-images", "dep:gif", "dep:image-webp"]
|
|
tree-render-system-fonts = ["tree-render", "resvg/system-fonts"]
|
|
|
|
[dev-dependencies]
|
|
# Already resolved in the workspace; test-only Cargo.lock edge inspection.
|
|
toml = "=1.1.8"
|