Skip to content

Conversation

@abey79
Copy link
Owner

@abey79 abey79 commented Jan 4, 2026

This PR refactors path metadata to support inheritance semantics, including:

  • PathMetadata fields are now Option<T>: None means "inherit from layer" (or SVG default if layer also `None`)
  • Added LayerMetadata::default_path_metadata: Layer-level defaults that paths can inherit from
  • SVG export writes only non-None values: Layer defaults on <g>, path overrides on <path>, letting SVG handle inheritance
  • SVG reader promotes common metadata: After loading, if all paths in a layer share the same value, it's moved to layer defaults and cleared from paths. This is needed because usvg flattens everything, and lead to duplication of layer-level metadata to all paths, leading to file size bloat.
  • Added ResolvedPathMetadata: For display purposes (vsvg-viewer) where concrete values are needed
  • Added PathMetadata::merge(): Conflict semantics (both Some but different → None)

This is part 4 of 4 in a stack made with GitButler:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Breaking change feature New feature vsvg Relates to vsvg

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants