All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
This changelog also contains important changes in dependencies.
- License to
Apache-2.0 OR MIT
. See resvg#838 for more information.
0.44.0 - 2024-09-28
- Stylesheet injection support. Thanks to @LaurenzV.
- (c-api)
resvg_get_object_bbox
- (c-api)
cargo-c
metadata. Thanks to @lu-zero. - Implement
From
forfontdb
andusvg
font types. Thanks to @dhardy.
- (c-api)
resvg_get_image_bbox
returns a layer and not object bounding box now. Useresvg_get_object_bbox
to preserve the old behavior.
- (svgtypes) Path parsing with
S
orT
segments afterA
. - Bounding box calculation for the root group used for
viewBox
flattening.
0.43.0 - 2024-08-10
- Support WebP images. Thanks to @notjosh.
- Use
zune-jpeg
instead ofjpeg-decoder
. Thanks to @mattfbacon. - Update dependencies.
- Canvas size limits calculation.
- SVG fonts handling. Thanks to @LaurenzV.
- Transforms in COLR fonts. Thanks to @LaurenzV.
0.42.0 - 2024-06-01
resvg
can render color fonts now, aka Emojis.
In TrueType terms,COLRv0
,COLRv1
(mostly),sbix
,CBDT
andSVG
tables are supported.
Thanks to @LaurenzV.- Fonts matching and fallback can be controlled by the caller via
usvg::FontResolver
now. Thanks to @LaurenzV. usvg::Options::font_resolver
. Similar tousvg::Options::image_href_resolver
we already had.usvg::Options::fontdb
- Support double-quoted FuncIRIs, aka
url("#id")
. image
element viewbox flattening.
Instead of havingusvg::Image::view_box
that the caller should handle themselves, we instead replace it withtransform
and optionalclip-path
. This greatly simplifiesimage
rendering.usvg::Image::size
- Tree viewbox flattening.
Similar toimage
above, but affects the rootsvg
element instead. pattern
viewbox flattening.
Similar toimage
above, but for patterns.- Improve vertical text rendering. Thanks to @LaurenzV.
usvg::fontdb::Database
should be set inusvg::Options
and not passed to the parser separately now.usvg::Options
andusvg::ImageHrefResolver
have a lifetime now.- Replace
usvg::Visibility
enum with justbool
. usvg::Path::visibility()
is replaced withusvg::Path::is_visible()
usvg::Image::visibility()
is replaced withusvg::Image::is_visible()
usvg::TextSpan::visibility()
is replaced withusvg::TextSpan::is_visible()
- Always represent
feImage
content as a link to an element.
In SVG,feImage
can contain a link to an element or a base64 image data, just likeimage
. From now, the inlined base64 data will always be represented by a link to an actualimage
element.will be parsed as<filter> <feImage xlink:href="data:image/png;base64,..."/> </filter>
This simplifies<image id="image1" xlink:href="data:image/png;base64,..."/> <filter> <feImage xlink:href="#image1"/> </filter>
feImage
rendering, since we don't have to handle both cases now. - The
--list-fonts
resvg argument can be used without providing an SVG file now. Can simply callresvg --list-fonts
now. - The
--list-fonts
resvg argument includes generic font family names as well now. - Make sure all warning and errors are printed to stderr. Thanks to @ahaoboy.
usvg::ViewBox
,usvg::AspectRatio
,usvg::Align
types. Nol longer used.usvg::filter::Image::aspect
. No longer needed.usvg::filter::Image::rendering_mode
. No longer needed.usvg::filter::Image::data
. Useusvg::filter::Image::root
instead.usvg::Tree::view_box
. No longer needed.usvg::Image::view_box
. No longer needed.usvg::Image::pattern
. No longer needed.usvg::utils::align_pos
. No longer needed.usvg::Visibility
. No longer needed.- (c-api)
resvg_get_image_viewbox
. Useresvg_get_image_size
instead.
context-fill
handling. Thanks to @LaurenzV.
0.41.0 - 2024-04-03
context-fill
andcontext-stroke
support. Thanks to @LaurenzV.usvg::Text::layouted()
, which returns a list of glyph IDs. It can be used to manually draw glyphs, unlike withusvg::Text::flattened()
, which returns just vector paths. Thanks to @LaurenzV.
- Missing text when a
text
element uses multiple fonts and one of them produces ligatures. - Absolute transform propagation during
use
resolving. - Absolute transform propagation during nested
svg
resolving. Node::abs_transform
documentation. The current element's transform is included.
0.40.0 - 2024-02-17
usvg::Tree
isSend + Sync
compatible now.usvg::WriteOptions::preserve_text
to control howusvg
generates an SVG.usvg::Image::abs_bounding_box
- All types in
usvg
are immutable now. Meaning thatusvg::Tree
cannot be modified after creation anymore. - All struct fields in
usvg
are private now. Use getters instead. - All
usvg::Tree
parsing methods require thefontdb
argument now. - All
defs
children like gradients, patterns, clipPaths, masks and filters are guarantee to have a unique, non-empty ID. - All
defs
children like gradients, patterns, clipPaths, masks and filters are guarantee to haveuserSpaceOnUse
units now. NoobjectBoundingBox
units anymore. usvg::Mask
is allowed to have no children now.- Text nodes will not be parsed when the
text
build feature isn't enabled. usvg::Tree::clip_paths
,usvg::Tree::masks
,usvg::Tree::filters
returns a pre-collected slice of unique nodes now. It's no longer a closure and you do not have to deduplicate nodes by yourself.usvg::filter::Primitive::x
,y
,width
andheight
methods were replaced withusvg::filter::Primitive::rect
.- Split
usvg::Tree::paint_servers
intousvg::Tree::linear_gradients
,usvg::Tree::radial_gradients
,usvg::Tree::patterns
. All three returns pre-collected slices now. - A
usvg::Path
no longer can have an invalid bbox. Paths with an invalid bbox will be rejected during parsing. - All
usvg
methods that return bounding boxes return non-optionalRect
now. NoNonZeroRect
as well. usvg::Text::flattened
returns&Group
and notOption<&Group>
now.usvg::ImageHrefDataResolverFn
andusvg::ImageHrefStringResolverFn
requirefontdb::Database
argument.- All shared nodes are stored in
Arc
and notRc<RefCell>
now. resvg::render_node
now includes filters bounding box. Meaning that a node with a blur filter no longer be clipped.- Replace
usvg::utils::view_box_to_transform
withusvg::ViewBox::to_transform
. - Rename
usvg::XmlOptions
intousvg::WriteOptions
and embedxmlwriter::Options
.
usvg::Tree::postprocess()
andusvg::PostProcessingSteps
. No longer needed.usvg::ClipPath::units()
,usvg::Mask::units()
,usvg::Mask::content_units()
,usvg::Filter::units()
,usvg::Filter::content_units()
,usvg::LinearGradient::units()
,usvg::RadialGradient::units()
,usvg::Pattern::units()
,usvg::Pattern::content_units()
andusvg::Paint::units()
. They are alwaysuserSpaceOnUse
now.usvg::Units
. No longer needed.
- Text bounding box is accounted during SVG size resolving. Previously, only paths and images were included.
- Font selection when an italic font isn't explicitly marked as one.
- Preserve
image
aspect ratio when onlywidth
orheight
are present. Thanks to @LaurenzV.
0.39.0 - 2024-02-06
font
shorthand parsing. Thanks to @LaurenzV.usvg::Group::abs_bounding_box
usvg::Group::abs_stroke_bounding_box
usvg::Path::abs_bounding_box
usvg::Path::abs_stroke_bounding_box
usvg::Text::abs_bounding_box
usvg::Text::abs_stroke_bounding_box
- All
usvg-*
crates merged into one. There is just theusvg
crate now, as before.
usvg::Group::abs_bounding_box()
method. It's a field now.usvg::Group::abs_filters_bounding_box()
usvg::TreeParsing
,usvg::TreePostProc
andusvg::TreeWriting
traits. They are no longer needed.
font-family
parsing. Thanks to @LaurenzV.- Absolute bounding box calculation for paths.
0.38.0 - 2024-01-21
- Each
usvg::Node
stores its absolute transform now.Node::abs_transform()
executes in constant time now. usvg::Tree::calculate_bounding_boxes
to calculate all bounding boxes beforehand.usvg::Node::bounding_box
which returns a precalculated node's bounding box in object coordinates.usvg::Node::abs_bounding_box
which returns a precalculated node's bounding box in canvas coordinates.usvg::Node::stroke_bounding_box
which returns a precalculated node's bounding box, including stroke, in object coordinates.usvg::Node::abs_stroke_bounding_box
which returns a precalculated node's bounding box, including stroke, in canvas coordinates.- (c-api)
resvg_get_node_stroke_bbox
usvg::Node::filters_bounding_box
usvg::Node::abs_filters_bounding_box
usvg::Tree::postprocess
resvg
rendersusvg::Tree
directly again.resvg::Tree
is gone.usvg
no longer usesrctree
for the nodes tree implementation. The tree is a regularenum
now.- A caller no longer need to use the awkward
*node.borrow()
. - No more panics on incorrect mutable
Rc<RefCell>
access. - Tree nodes respect tree's mutability rules. Before, one could mutate tree nodes when the tree
itself is not mutable. Because
Rc<RefCell>
provides a shared mutable access.
- A caller no longer need to use the awkward
- Filters, clip paths, masks and patterns are stored as
Rc<RefCell<T>>
instead ofRc<T>
. This is required for proper mutability sinceNode
itself is no longer anRc
. - Rename
usvg::NodeKind
intousvg::Node
. - Upgrade to Rust 2021 edition.
resvg::Tree
. No longer needed.resvg
can renderusvg::Tree
directly once again.rctree::Node
methods. TheNode
API is completely different now.usvg::NodeExt
. No longer needed.usvg::Node::calculate_bbox
. Useusvg::Node::abs_bounding_box
instead.usvg::Tree::convert_text
. Useusvg::Tree::postprocess
instead.usvg::TreeTextToPath
trait. No longer needed.
- Mark
mask-type
as a presentation attribute. - Do not show needless warnings when parsing some attributes.
feImage
rendering with a non-default position. Thanks to @LaurenzV.
0.37.0 - 2023-12-16
usvg
can write text back to SVG now. Thanks to @LaurenzV.--preserve-text
flag to theusvg
CLI tool. Thanks to @LaurenzV.- Support
transform-origin
property. Thanks to @LaurenzV. - Support non-default markers order via
paint-order
. Previously, only fill and stroke could have been swapped. Thanks to @LaurenzV. usvg_tree::Text::flattened
that will contain a flattened/outlined text.usvg_tree::Text::bounding_box
. Will be set only after text flattening.- Optimize
usvg_tree::NodeExt::abs_transform
by storing absolute transforms in the tree instead of calculating them each time.
usvg_tree::Text::positions
was replaced withusvg_tree::Text::dx
andusvg_tree::Text::dy
.
usvg_tree::CharacterPosition::x
andusvg_tree::CharacterPosition::y
are gone. They were redundant and you should useusvg_tree::TextChunk::x
andusvg_tree::TextChunk::y
instead.usvg_tree::LinearGradient::id
andusvg_tree::RadialGradient::id
are moved tousvg_tree::BaseGradient::id
.- Do not generate element IDs during parsing. Previously, some elements like
clipPath
s andfilter
s could have generated IDs, but it wasn't very reliable and mostly unnecessary. Renderer doesn't rely on them and usvg writer would generate them anyway. - Text-to-paths conversion via
usvg_text_layout::Tree::convert_text
no longer replaces original text elements with paths, but instead puts them intousvg_tree::Text::flattened
.
- The
transform
field fromusvg_tree::Path
,usvg_tree::Image
andusvg_tree::Text
. Onlyusvg_tree::Group
can have it.
It doesn't break anything, because those properties were never used before anyway.
Thanks to @LaurenzV. usvg_tree::CharacterPosition
usvg_tree::Path::text_bbox
. Useusvg_tree::Text::bounding_box
instead.usvg_text_layout::TextToPath
trait forText
nodes. Only the whole tree can be converted at once.
- Path object bounding box calculation. We were using point bounds instead of tight contour bounds. Was broken since v0.34
- Convert text-to-paths in embedded SVGs as well. The one inside the
Image
node. Thanks to @LaurenzV. - Indirect
text-decoration
resolving in some cases. Thanks to @LaurenzV. - (usvg) Clip paths writing to SVG. Thanks to @LaurenzV.
0.36.0 - 2023-10-01
stroke-linejoin=miter-clip
support. SVG2. Thanks to @torokati44.- Quoted FuncIRI support. Like
fill="url('#gradient')"
. SVG2. Thanks to @romanzes. - Allow float values in
rgb()
andrgba()
colors. SVG2. Thanks to @yisibl. auto-start-reverse
variant support toorient
in markers. SVG2. Thanks to @EpicEricEE.
- Update dependencies.
- Increase precision of the zero-scale transform check. Was rejecting some valid transforms before.
- Panic when rendering a very specific text.
- Greatly improve parsing performance when an SVG has a lot of references. Thanks to @wez.
- (Qt API) Fix scaling factor calculation. Thanks to @missdeer.
0.35.0 - 2023-06-27
- Panic when an element is completely outside the viewbox.
FillPaint
andStrokePaint
filter inputs support. It's a mostly undocumented SVG feature that no one supports and no one uses. And it was adding a significant complexity to the codebase.usvg::filter::Filter::fill_paint
andusvg::filter::Filter::stroke_paint
.BackgroundImage
,BackgroundAlpha
,FillPaint
andStrokePaint
fromusvg::filter::Input
.usvg::Group::filter_fill_paint
andusvg::Group::filter_stroke_paint
.
0.34.1 - 2023-05-28
- Transform components order. Affects only
usvg
SVG output and C API.
0.34.0 - 2023-05-27
usvg
usestiny-skia
geometry primitives now, including thePath
container.
The main difference compared to the oldusvg
primitives is thattiny-skia
usesf32
instead off64
. So while in theory we could loose some precision, in practice,f32
is used mainly as a storage type and precise math operations are still done usingf64
.
tiny-skia
primitives are move robust, strict and have a nicer API.
More importantly, this change reduces the peak memory usages for SVGs with large paths (in terms of the number of segments). And removes the need to convertusvg::PathData
intotiny-skia::Path
before rendering. Which was just a useless reallocation.- All numbers are stored as
f32
instead off64
now. - Because we use
tiny-skia::Path
now, we allow quadratic curves as well. This includesusvg
CLI output. - Because we allow quadratic curves now, text might render slightly differently (better?). This is because TrueType fonts contain only quadratic curves and we were converting them to cubic before.
usvg::Path
no longer implementsDefault
. Useusvg::Path::new
instead.- Replace
usvg::Rect
withtiny_skia::NonZeroRect
. - Replace
usvg::PathBbox
withtiny_skia::Rect
. - Unlike the old
usvg::PathBbox
,tiny_skia::Rect
allows both width and height to be zero. This is not an error. usvg::filter::Turbulence::base_frequency
was split intobase_frequency_x
andbase_frequency_y
.usvg::NodeExt::calculate_bbox
no longer includes stroke bbox.- (c-api) Use
float
instead ofdouble
everywhere. - The
svgfilters
crate was merged intoresvg
. - The
rosvgtree
crate was merged intousvg-parser
. usvg::Group::filter_fill
moved tousvg::filter::Filter::fill_paint
.usvg::Group::filter_stroke
moved tousvg::filter::Filter::stroke_paint
.
usvg::Point
. Usetiny_skia::Point
instead.usvg::FuzzyEq
. Useusvg::ApproxEqUlps
instead.usvg::FuzzyZero
. Useusvg::ApproxZeroUlps
instead.- (c-api)
resvg_path_bbox
. Useresvg_rect
instead. svgfilters
crate.rosvgtree
crate.
- Write
transform
onclipPath
children inusvg
SVG output. - Do not duplicate marker children IDs.
Previously, each element resolved for a marker would preserve its ID.
Affects only
usvg
SVG output and doesn't affect rendering.
0.33.0 - 2023-05-17
- A new rendering algorithm.
When rendering isolated groups, aka layers, we have to know the layer bounding box beforehand, which is ridiculously hard in SVG.
Previously, resvg would simply use the canvas size for all the layers. Meaning that to render a 10x10px layer on a 1000x1000px canvas, we would have to allocate and then blend a 1000x1000px layer, which is just a waste of CPU cycles.
The new rendering algorithm is able to calculate layer bounding boxes, which dramatically improves performance when rendering a lot of tiny layers on a large canvas.
Moreover, it makes performance more linear with a canvas size increase.
The paris-30k.svg sample from google/forma is rendered 115 times faster on M1 Pro now. From ~33760ms down to ~290ms. 5269x3593px canvas.
If we restrict the canvas to 1000x1000px, which would contain only the actualparis-30k.svg
content, then we're 13 times faster. From ~3252ms down to ~253ms. resvg::Tree
, aka a render tree, which is an even simpler version ofusvg::Tree
.usvg::Tree
had to be converted intoresvg::Tree
before rendering now.
- Restructure the root directory. All crates are in the
crates
directory now. - Restructure tests. New directory structure and naming scheme.
- Use
resvg::Tree::render
instead ofresvg::render
. - resvg's
--export-area-drawing
option uses calculated bounds instead of trimming excessive alpha now. It's faster, but can lead to a slightly different output. - (c-api) Removed
fit_to
argument fromresvg_render
. - (c-api) Removed
fit_to
argument fromresvg_render_node
. usvg::ScreenSize
moved toresvg
.usvg::ScreenRect
moved toresvg
.- Rename
resvg::ScreenSize
intoresvg::IntSize
. - Rename
resvg::ScreenRect
intoresvg::IntRect
.
filter
build feature fromresvg
. Filters are always enabled now.resvg::FitTo
usvg::utils::view_box_to_transform_with_clip
usvg::Size::to_screen_size
. Useresvg::IntSize::from_usvg
instead.usvg::Rect::to_screen_size
. Useresvg::IntSize::from_usvg(rect.size())
instead.usvg::Rect::to_screen_rect
. Useresvg::IntRect::from_usvg
instead.- (c-api)
resvg_fit_to
- (c-api)
resvg_fit_to_type
- Double quotes parsing in
font-family
.
0.32.0 - 2023-04-23
- Clipping and masking is up to 20% faster.
mask-type
property support. SVG2usvg_tree::MaskType
usvg_tree::Mask::kind
- (rosvgtree) New SVG 2 mask attributes.
BackgroundImage
andBackgroundAlpha
filter inputs will produce the same output asSourceGraphic
andSourceAlpha
respectively.
enable-background
support. This feature was never supported by browsers and was deprecated in SVG 2. To my knowledge, only Batik has a good support of it. Also, it's a performance nightmare, which caused multiple issues in resvg already.usvg_tree::EnableBackground
usvg_tree::Group::enable_background
usvg_tree::NodeExt::filter_background_start_node
- Improve rectangular clipping anti-aliasing quality.
- Mask's RGB to Luminance converter was ignoring premultiplied alpha.
0.31.1 - 2023-04-22
- Use the latest
tiny-skia
to fix SVGs with large masks rendering.
0.31.0 - 2023-04-10
usvg::Tree::paint_servers
usvg::Tree::clip_paths
usvg::Tree::masks
usvg::Tree::filters
usvg::Node::subroots
- (usvg)
--coordinates-precision
and--transforms-precision
writing options. Thanks to @flxzt.
fill-opacity
andstroke-opacity
resolving.- Double
transform
when resolvingsymbol
. symbol
clipping when its viewbox is the same as the document one.- (usvg) Deeply nested gradients, patterns, clip paths, masks and filters were ignored during SVG writing.
- Missing text in nested clip paths and mask, text decoration patterns, filter inputs and feImage.
0.30.0 - 2023-03-25
- Readd
usvg
CLI tool. Can be installed via cargo as before.
- Extract most
usvg
internals into newusvg-tree
andusvg-parser
crates.usvg-tree
contains just the SVG tree and all the types.usvg-parser
parsers SVG intousvg-tree
. Andusvg
is just an umbrella crate now. - To use
usvg::Tree::from*
methods one should import theusvg::TreeParsing
trait now. - No need to import
usvg-text-layout
manually anymore. It is part ofusvg
now. rosvgtree
no longer reexportssvgtypes
.rosvgtree::Node::attribute
returns just a string now.rosvgtree::Node::find_attribute
returns just arosvgtree::Node
now.- Rename
usvg::Stretch
intousvg::FontStretch
. - Rename
usvg::Style
intousvg::FontStyle
. usvg::FitTo
moved toresvg::FitTo
.usvg::IsDefault
trait is private now.
rosvgtree::FromValue
. Due to Rust's orphan rules this trait is pretty useless.
- Recursive markers detection.
- Skip malformed
transform
attributes without skipping the whole element. - Clipping path rectangle calculation for nested
svg
elements. Thanks to @LaurenzV. - Panic when applying
text-decoration
on text with only one cluster. Thanks to @LaurenzV. - (Qt API) Image size wasn't initialized. Thanks to @missdeer.
resvg
CLI allows files with XML DTD again.- (svgtypes) Handle implicit MoveTo after ClosePath segments.
0.29.0 - 2023-02-04
resvg
CLI loads system fonts only when an input SVG has text nodes now. Fonts loading is an IO-heavy operation and by avoiding it we can speed upresvg
execution.usvg::Group::should_isolate
usvg::Tree::has_text_nodes
- Some
usvg
internals were moved into the newrosvgtree
crate. - Dummy groups are no longer removed. Use
usvg::Group::should_isolate
to check if a group affects rendering. usvg-text-layout::TreeTextToPath::convert_text
no longer has thekeep_named_groups
argument.- MSRV bumped to 1.65
- Update dependencies.
usvg::Options::keep_named_groups
. Dummy groups are no longer removed.- (c-api)
resvg_options_set_keep_named_groups
- (Qt API)
ResvgOptions::setKeepNamedGroups
- Missing
font-family
handling. font-weight
resolving.
0.28.0 - 2022-12-03
usvg::Text
andusvg::NodeKind::Text
.
usvg
isn't converting text to paths by default now. A caller must callusvg::Tree::convert_text
orusvg::Text::convert
fromusvg-text-layout
crate on demand.usvg
text layout implementation moved intousvg-text-layout
crate.- During SVG size recovery, when no
width
,height
andviewBox
attributes have been set, text nodes are no longer taken into an account. This is because a text node has no bbox before conversion into path(s), which we no longer doing during parsing. usvg
is purely an SVG parser now. It doesn't convert text to paths and doesn't write SVG anymore.usvg::filter::ConvolveMatrixData
methods are fields now.
usvg
CLI binary. No alternatives for now.- All
usvg
build features.filter
. Filter elements are always parsed byusvg
now.text
. Text elements are always parsed byusvg
now.export
.usvg
cannot write an SVG anymore.
usvg::Tree::to_string
.usvg
cannot write an SVG anymore.usvg::TransformFromBBox
trait. This is just a regularusvg::Transform
method now.usvg::OptionsRef
.usvg::Options
is enough from now.usvg::Options::fontdb
. Used only byusvg-text-layout
now.--dump-svg
fromresvg
.
0.27.0 - 2022-11-27
lengthAdjust
andtextLength
attributes support.- Support automatic
image
size detection.width
andheight
attributes can be omitted or set toauto
onimage
now. SVG2
--query-all
flag inresvg
CLI.- Percentage values resolving.
0.26.1 - 2022-11-21
- Allow
dominant-baseline
andalignment-baseline
to be set via CSS.
0.26.0 - 2022-11-20
- Minimal
dominant-baseline
andalignment-baseline
support. mix-blend-mode
andisolation
support. SVG2- Allow writing resvg output to stdout.
- Allow disabling text kerning using
kerning="0"
andstyle="font-kerning:none"
. SVG2 - Allow
<percentage>
values foropacity
,fill-opacity
,stroke-opacity
,flood-opacity
andstop-opacity
attributes.
You can writeopacity="50%"
now. SVG2
- Disable focal point correction on radial gradients to conform with SVG 2. SVG2
- Update
feMorphology
radius value resolving.
- Do not clip nested
svg
when only theviewBox
attribute is present.
0.25.0 - 2022-10-30
- Partial
paint-order
attribute support. Markers can only be under or above the shape.
- Compilation issues caused by
rustybuzz
update.
0.24.0 - 2022-10-22
- CSS3
writing-mode
variantsvertical-rl
andvertical-lr
. Thanks to yisibl. - (tiny-skia) AArch64 Neon SIMD support. Up to 3x faster on Apple M1.
usvg::Tree
stores onlyGroup
,Path
andImage
nodes now. Instead of emulating an SVG file structure, where gradients, patterns, filters, clips and masks are part of the nodes tree (usually inside thedefs
element), we reference them usingRc
from now. This change makesusvg
a bit simpler. Makesusvg
API way easier, since instead of looking for a node viausvg::Tree::defs_by_id
the caller can access the type directly viaRc
. And makes creation of customusvg::Tree
s way easier.clip_path
,mask
andfilters
usvg::Group
fields storeRc
instead ofString
now.usvg::NodeExt::units
was moved tousvg::Paint::units
.usvg::filter::ImageKind::Use
storesusvg::Node
instead ofString
.usvg::PathData
stores commands and points separately now to reduce overall memory usage.usvg::PathData
segments should be accessed viasegments()
now.- Most numeric types have been moved to the
strict-num
crate. - Rename
NormalizedValue
intoNormalizedF64
. - Rename
PositiveNumber
intoPositiveF64
. - Raw number of numeric types should be accessed via
get()
method instead ofvalue()
now. usvg::TextSpan::font_size
isNonZeroPositiveF64
instead off64
now.- Re-export
usvg
andtiny-skia
dependencies inresvg
. - Re-export
roxmltree
dependency inusvg
. - (usvg) Output float precision is reduced from 11 to 8 digits.
usvg::Tree::create
.usvg::Tree
is an open struct now.usvg::Tree::root
. It's a public field now.usvg::Tree::svg_node
. Replaced withusvg::Tree
public fields.defs
,is_in_defs
,append_to_defs
anddefs_by_id
fromusvg::Tree
. We no longer emulate SVG structure. No alternative.usvg::Tree::is_in_defs
. There are nodefs
anymore.usvg::Paint::Link
. We store gradient and patterns directly inusvg::Paint
now.usvg::Svg
. No longer needed.size
andview_box
areusvg::Tree
fields now.usvg::SubPathIter
andusvg::PathData::subpaths
. No longer used.
- Path bbox calculation scales stroke width too. Thanks to growler.
- (tiny-skia) Round caps roundness.
- (xmlparser) Stack overflow on specific files.
- (c-api)
resvg_is_image_empty
output was inverted.
0.23.0 - 2022-06-11
#RRGGBBAA
and#RGBA
color notation support. Thanks to demurgos.
- Panic during recursive
pattern
resolving. Thanks to FylmTM. - Spurious warning when using
--export-id
. Thanks to benoit-pierre.
0.22.0 - 2022-02-20
- Support
svg
referenced byuse
. External SVG files are still not supported.
ttf-parser
,fontdb
andrustybuzz
have been updated.
0.21.0 - 2022-02-13
usvg::ImageHrefResolver
that allows a customxlink:href
handling. Thanks to antmelnyk.usvg::Options::image_href_resolver
- Support for GIF images inside the
<image>
element. - (fontdb) Support for loading user fonts on Windows.
- (fontdb) Support for parsing fontconfig config files on Linux. For now, only to retrieve a list of font dirs.
- MSRV bumped to 1.51
usvg::ImageKind
stores data asArc<Vec<u8>>
and not justVec<u8>
now.
- Every nested
svg
element defines a new viewBox now. Previously, we were always using the root one. - Correctly handle SVG size calculation when SVG doesn't have a size and any elements.
- Improve groups ungrouping speed.
0.20.0 - 2021-12-29
resvg::render
andresvg::render_node
accept a transform now.- (c-api)
resvg_render
andresvg_render_node
accept a transform now. usvg::Color
is a custom type and not asvgtypes::Color
reexport now.usvg::Color
doesn't contain alpha anymore, which have been added in v0.16 Alpha would be automatically flattened. This makes Micro SVG compatible with SVG 1.1 again.- (c-api) Rename
RESVG_FIT_TO_*
intoRESVG_FIT_TO_TYPE_*
.
- The
--background
argument inresvg
correctly handles alpha now. - Fix building usvg without filter feature but with export.
0.19.0 - 2021-10-04
- Better text-on-path converter accuracy by accounting the current transform.
usvg::NodeExt::abs_transform
includes current node transform now.- Improved turbulence filter performance. Thanks to akindle.
- Multiple dependencies updated.
0.18.0 - 2021-09-12
filter
build feature. Enabled by default.usvg::PathBbox
andresvg_path_bbox
(to C API).
- (usvg) All filter related types are under the
filter
module now. - (usvg) Remove
Fe
prefix from all filter types. - (c-api)
resvg_get_node_bbox
returnsresvg_path_bbox
now.
- Horizontal and vertical lines processing.
- C API building without the
text
feature.
0.17.0 - 2021-09-04
tiny-skia
updated with support of images larger than 8000x8000 pixels.feDropShadow
support. SVG2<filter-value-list>
support. Meaning that thefilter
attribute can have multiple values now. Likeurl(#filter1) blur(2)
. SVG2- All filter functions. SVG2
- Support all new
feBlend
modes. SVG2 - Automatic SVG size detection when
width
/height
/viewBox
is not set. Thanks to reknih. usvg::Options::default_size
--default-width
and--default-height
to usvg.
usvg::Group::filter
is a list of filter IDs now.usvg::FeColorMatrixKind::Saturate
accepts any positivef64
value now.svgfilters::ColorMatrix::Saturate
accepts any positivef64
value now.- Fonts memory mapping was split into a separate build feature:
memmap-fonts
. Now you can build resvg/usvg withsystem-fonts
, but withoutmemmap-fonts
. Enabled by default. - The
--dump-svg
argument in resvg CLI tool should be enabled using--features dump-svg
now. No enabled by default. usvg::Tree::to_string
is behind theexport
build feature now.
- When writing SVG,
usvg
will usergba()
notations for colors instead of#RRGGBB
.
0.16.0 - 2021-08-22
- CSS3 colors support. Specifically
rgba
,hsl
,hsla
andtransparent
. SVG2 - Allow missing
rx
/ry
attributes onellipse
. SVG2 - Allow markers on all shapes. SVG2
textPath
can reference basic shapes now. SVG2usvg::OptionsRef
, which is a non-ownedusvg::Options
variant.simplecss
updated with CSS specificity support.turn
angle unit support. SVG2- Basic
font-variant=small-caps
support. No font fallback. --export-area-page
to resvg.--export-area-drawing
to resvg.
resvg::render_node
requiresusvg::Tree
now.usvg::Color
gained analpha
field.
usvg::Node::tree
. Cannot be implemented efficiently anymore.usvg::SystemFontDB
. No longer needed.
pattern
scaling.- Greatly improve
symbol
resolving speed inusvg
. - Whitespaces trimming on nested
tspan
.
0.15.0 - 2021-06-13
- Allow reading SVG from stdin in
resvg
binary. --id-prefix
tousvg
.FitTo::Size
resvg
binary accepts--width
and--height
args together now. Previously, only--width
or--height
were allowed.usvg::Path::text_bbox
- The maximum number of SVG elements is limited by 1_000_000 now. Mainly to prevent a billion laugh style attacks.
- The maximum SVG elements nesting is limited by 1024 now.
usvg::Error::ElementsLimitReached
- Improve clipping and masking performance on large images.
- Remove layers caching. This was a pointless optimization.
- Split Preprocessing into Reading and Parsing in
resvg --perf
. usvg::XmlOptions
rewritten.usvg::Tree::to_string
requires a reference toXmlOptions
now.
usvg::Tree::from_file
. Usefrom_data
orfrom_str
instead.usvg::Error::InvalidFileSuffix
usvg::Error::FileOpenFailed
- (c-api)
RESVG_ERROR_INVALID_FILE_SUFFIX
- Ignore tiny blur values. It could lead to a transparent image.
use
style propagation when used withsymbol
.- Vertical text layout with relative offsets.
- Text bbox calculation.
usvg
uses font metrics instead of path bbox now.
0.14.1 - 2021-04-18
- Allow
href
without thexlink
namespace. This feature is part of SVG 2 (which we do not support), but there are more and more files like this in the wild.
- (usvg) Do not write
usvg:version
to the output SVG.
- (usvg)
overflow='inherit'
resolving. - (usvg) SVG Path length calculation that affects
startOffset
property intextPath
. - (usvg) Fix
feImage
resolving when the linked element hasopacity
,clip-path
,mask
and/orfilter
attributes. - (usvg) Fix chained
feImage
resolving. - CLI arguments processing.
0.14.0 - 2021-03-06
- Multiple critical bugs in
tiny-skia
.
0.13.1 - 2021-01-20
image
with float size scaling.- Critical bug in
tiny-skia
.
0.13.0 - 2020-12-21
--resources-dir
option to CLI tools.- (usvg)
Tree::from_xmltree
- Remove the
Image
struct.render()
andrender_node()
methods now accepttiny_skia::PixmapMut
. - Update
fontdb
. - Update
tiny-skia
. - (c-api)
resvg_size
usesdouble
instead ofuint32_t
now. - (qt-api)
defaultSize()
anddefaultSizeF()
methods now return SVG size and not SVG viewbox size. - (usvg)
Options::path
changed toOptions::resources_dir
and requires a directory now. - (c-api)
resvg_options_set_file_path
changed toresvg_options_set_resources_dir
and requires a directory now. - (qt-api)
ResvgOptions::setFilePath
changed toResvgOptions::setResourcesDir
and requires a directory now.
- Support multiple values inside a
text-decoration
attribute.
Image
. Usetiny_skia::PixmapMut
instead.- (c-api)
resvg_image
struct andresvg_image_*
methods.resvg
renders onto the provided buffer now. - (c-api)
resvg_color
, because unused.
0.12.0 - 2020-12-05
- resvg no longer requires a C++ compiler!
tiny-skia
was updated to a pure Rust version, which means thatresvg
no longer depends onclang
and should work on 32bit targets.rustybuzz
was updated to a pure Rust version.tools/explorer-thumbnailer
is back and written in Rust now. Thanks to gentoo90.
- (usvg) Do not panic when a font has a zero-sized underline thickness.
- (usvg) Multiple
textPath
processing fixes by chubei-oppen. - (qt-api)
boundsOnElement
andboundingBox
were returning transposed bounds.
0.11.0 - 2020-07-04
- All backends except Skia were removed. Skia is the only official one from now.
- New C API implementation.
- Support for user-defined fonts in usvg, resvg and C API.
--serif-family
,--sans-serif-family
,--cursive-family
,--fantasy-family
--monospace-family
,--use-font-file
,--use-fonts-dir
,--skip-system-fonts
and--list-fonts
options to all CLI tools.- New tests suite. Instead of testing against the previous build, now we're testing against
prerendered PNG images. Which is way faster.
And you can test resvg without the internet connection now.
And all you need is justcargo test
.
- Library uses an embedded Skia by default now.
- Switch
harfbuzz_rs
withrustybuzz
. - Rendering doesn't require
usvg::Options
now. - (usvg) The
fontdb
module moved into its own crate. - (usvg)
fontconfig
is no longer used for matching generic fonts on Linux. Mainly because it's very slow. - (usvg) When an
image
element contains a file path, the file will be loaded into memory now, instead of simply storing a file path. And will be dumped as base64 on SVG save. In case of an SVG image, it will be loaded as aTree
and saved as base64 encoded XML on save. - (usvg)
ImageData
replaced withImageKind
. - (usvg) Fonts database is empty by default now and should be filled manually.
- (c-api) Almost a complete rewrite.
- All backends except the Skia one.
Options
from all backends. We don't use it anymore.- (usvg)
ImageFormat
. - (c-api) Rendering on a backends canvas no longer supported. Was constantly misused.
0.10.0 - 2020-06-19
- The
resvg
crate has been split into four: resvg-cairo, resvg-qt, resvg-skia and resvg-raqote.
So from now, instead of enabling a required backend via cargo features, you should select a required backend-specific crate.
This allows us to have a better integration with a selected 2D library.
And we also have separated C API implementations now.
And each backend has its own vendored archive too. - (qt-backend) Use
QImage
instead of Rust libraries for raster images loading.
- The
resvg
crate. Use backend-specific crates. tools/rendersvg
. Each backend has its own CLI tool now.tools/usvg
.usvg
implements CLI by default now.- (c-api)
resvg_*_render_to_file
methods. - (qt-backend)
jpeg-decoder
andpng
dependencies.
0.9.1 - 2020-06-03
- Stack overflow when
enable-background
andfilter
are set on the same element. - Grayscale PNG loading.
- Allow building on BSD.
- (usvg) Font fallback when shaping produces a different amount of glyphs.
- (usvg) Ignore a space after the last character during
letter-spacing
processing. - (usvg)
marker-end
rendering when the last segment is a curve with the second control point that coincides with end point. - (usvg) Accept embedded
image
data without mime. - (usvg) Fonts search in a home directory on Linux.
- (usvg)
dy
calculation fortextPath
thanks to Stoeoef - (usvg)
textPath
resolving when a referenced path has a transform.
Thanks to Stoeoef. - (usvg) Load user fonts on macOS too.
- (xmlparser) Parsing comment before DTD.
0.9.0 - 2020-01-18
feConvolveMatrix
,feMorphology
,feDisplacementMap
,feTurbulence
,feDiffuseLighting
andfeSpecularLighting
support.BackgroundImage
,BackgroundAlpha
,FillPaint
andStrokePaint
support as a filter input.- Load grayscale raster images.
enable-background
support.- resvg/usvg can be built without text rendering support now.
OutputImage::make_vec
andOutputImage::make_rgba_vec
.feImage
with a reference to an internal element.
feComposite
k1-4 coefficients can have any number now. This matches browsers behaviour.- Use
flate2
instead oflibflate
for GZip decoding. - (usvg)
fill
andstroke
attributes will always be set forpath
now. - (usvg)
g
,path
andimage
can now be set insidedefs
. Required byfeImage
. - (c-api) Rename
resvg_*_render_to_image
intoresvg_*_render_to_file
.
- (usvg) Transform processing during text-to-path conversion.
feComposite
with fully transparent region was producing an invalid result.- Fallback to
matrix
infeColorMatrix
whentype
is not set or invalid. - ID preserving for
use
elements. feFlood
with subregion andprimitiveUnits=objectBoundingBox
.- (harfbuzz_rs) Memory leak.
0.8.0 - 2019-08-17
- A Skia backend thanks to JaFenix.
feComponentTransfer
support.feColorMatrix
support.- A better CSS support.
- An
*.otf
fonts support. - (usvg)
dx
,dy
are supported insidetextPath
now. - Use a box blur for
feGaussianBlur
withstdDeviation
>=2. This is 4-8 times faster than IIR blur. Thanks to Shnatsel.
- All backends are using Rust crates for raster images loading now.
- Use
pico-args
instead ofgumdrop
to reduced the build time oftools/rendersvg
andtools/usvg
. - (usvg) The
xmlwriter
is used for SVG generation now. Almost 2x faster than generating ansvgdom
. - (usvg) Optimize font database initialization. Almost 50% faster.
- Use a lower PNG compression ratio to speed up PNG generation. Depending on a backend and image can be 2-4x faster.
OutputImage::save
->OutputImage::save_png
.- (usvg)
Path::segments
->Path::data
. - Cairo backend compilation is 2x faster now due to overall changes.
- Performance improvements (Oxygen Icon theme SVG-to-PNG):
- cairo-backend: 22% faster
- qt-backend: 20% faster
- raqote-backend: 34% faster
- (qt-api) A default font resolving.
- (usvg)
baseline-shift
processing insidetextPath
. - (usvg) Remove all
tref
element children. - (usvg)
tref
withxml:space
resolving. - (usvg) Ignore nested
tref
. - (usvg) Ignore invalid
clipPath
children that were referenced viause
. - (usvg)
currentColor
will always fallback to black now. Previously,stroke
was set tonone
which is incorrect. - (usvg)
use
can reference an element inside a non-SVG element now. - (usvg) Collect all styles for generic fonts and not only Regular.
- (usvg) Parse only presentation attributes from the
style
element and attribute.
- (cairo-backend)
gdk-pixbuf
dependency. - (qt-backend) JPEG image format plugin dependency.
svgdom
dependency.
0.7.0 - 2019-06-19
- New text layout implementation:
textPath
support.writing-mode
support, aka vertical text.- Text BIDI reordering.
- Better text shaping.
word-spacing
is supported for all backends now.harfbuzz
dependency.- Subscript, superscript offsets are extracted from font and not hardcoded now.
shape-rendering
,text-rendering
andimage-rendering
support.- The
arithmetic
operator forfeComposite
. - (usvg)
--quiet
argument. - (c-api)
resvg_get_image_bbox
. - (qt-api)
ResvgRenderer::boundingBox
. - (resvg) A raqote backend thanks to jrmuizel. Still experimental.
- Text will be converted into paths on the
usvg
side now. - (resvg) Do not rescale images before rendering. This is faster and better.
- (usvg) An
image
element with a zero or negative size will be skipped now. Previously, a linked image size was used, which is incorrect. - Geometry primitives (
Rect
,Size
, etc) are immutable and always valid now. - (usvg) The default
color-interpolation-filters
attribute will not be exported now.
- (usvg) All text related structures and enums. Text will be converted into
Path
now. InitObject
andinit()
because they are no longer needed.- (c-api)
resvg_handle
,resvg_init
,resvg_destroy
. - (c-api)
resvg_cairo_get_node_bbox
andresvg_qt_get_node_bbox
. Use backend-independentresvg_get_node_bbox
instead. - (cairo-backend)
pango
dependency. - (resvg)
Backend::calc_node_bbox
. UseNode::calculate_bbox()
instead.
letter-spacing
on cursive scripts (like Arabic).- (rctree) Prevent stack overflow on a huge, deeply nested SVG.
- (c-api)
resvg_is_image_empty
was always returningfalse
. - (resvg) Panic when
filter
withobjectBoudningBox
was set on an empty group. - (usvg)
mask
withobjectBoundingBox
resolving. - (usvg)
pattern
'sviewBox
attribute resolving viahref
. - (roxmltree) Namespace resolving.
0.6.1 - 2019-03-16
- (usvg)
transform
multiplication. - (usvg)
use
insideclipPath
resolving.
0.6.0 - 2019-03-16
- Nested
baseline-shift
support. - (qt-api)
renderToImage
. - (usvg) A better algorithm for unused defs (
defs
element children, like gradients) removal. - (usvg)
Error::InvalidSize
. - (c-api)
RESVG_ERROR_INVALID_SIZE
.
- (usvg) A major rewrite.
baseline-shift
withsub
,super
and percent values calculation.- Marker resolving moved completely to
usvg
. - If an SVG doesn't have a valid size than an error will occur. Previously, an empty tree was produced.
- (qt-api)
render
methods areconst
now. - (usvg) Disable default attributes exporting.
- (usvg) Marker element and attributes. Markers will be resolved just like
use
now.
- (resvg) During the
tspan
rendering, thetext
bbox will be used instead of thetspan
bbox itself. This is the correct behaviour by the SVG spec. - (cairo-backend)
font-family
parsing. - (usvg)
filter:none
processing. - (usvg)
text
insidetext
processing. - (usvg) Endless loop during
use
resolving. - (usvg) Endless loop when SVG has indirect recursive
xlink:href
links. - (usvg) Endless loop when SVG has recursive
marker-*
links. - (usvg) Panic during
use
resolving. - (usvg) Panic during inherited attributes resolving.
- (usvg) Groups regrouping.
- (usvg)
dx
/dy
processing ontext
. - (usvg)
textAnchor
resolving. - (usvg) Ignore
fill-rule
ontext
. - (svgtypes) Style with comments parsing.
- (roxmltree) Namespaces resolving.
0.5.0 - 2019-01-04
marker
support.- Partial
baseline-shift
support. letter-spacing
support.- (qt-backend)
word-spacing
support. Does not work on the cairo backend. - tools/explorer-thumbnailer
- tools/kde-dolphin-thumbnailer
- Object bounding box calculation.
- Pattern scaling.
- Nested
objectBoundigBox
support. - (usvg)
color
onuse
resolving. - (usvg)
offset
attribute resolving inside thestop
element. - (usvg) Ungrouping of groups with non-inheritable attributes.
- (usvg)
rotate
attribute resolving. - (usvg) Paths without stroke and fill will no longer be removed. Required for a proper bbox resolving.
- (usvg) Coordinates resolving when units are
userSpaceOnUse
. - (usvg) Groups regrouping. Caused an incorrect rendering of
clipPath
that hadfilter
on a child. - (usvg) Style attributes resolving on the root
svg
element. - (usvg)
SmoothCurveTo
andSmoothQuadratic
conversion. - (usvg)
symbol
resolving. - (cairo-backend) Font ascent calculation.
- (qt-backend) Stroking of LineTo specified as CurveTo.
- (svgdom)
stroke-miterlimit
attribute parsing. - (svgdom)
length
andnumber
attribute types parsing. - (svgdom)
offset
attribute parsing. - (svgdom) IRI resolving order when SVG has duplicated ID's.
0.4.0 - 2018-12-13
- (resvg) Initial filters support.
- (resvg) Nested
clipPath
andmask
support. - (resvg) MSVC support.
- (rendersvg)
font-family
,font-size
andlanguages
to args. - (usvg)
systemLanguage
attribute support. - (usvg) Default font family and size is configurable now.
- (c-api)
RESVG_ERROR_PARSING_FAILED
. - (c-api)
font_family
,font_size
andlanguages
toresvg_options
. - (qt-api)
ResvgRenderer::setDevicePixelRatio
.
- (rendersvg) Use
gumdrop
instead ofgetopts
. - (c-api) Qt wrapper is header-only now.
- (cairo-backend) Text layout.
- (cairo-backend) Rendering of a zero length subpath with a square cap.
- (qt-backend) Transform retrieving via Qt bindings.
- (resvg) Recursive SVG images via
image
tag. - (resvg) Bbox calculation of the text with rotate.
- (resvg) Invisible elements processing.
- (qt-api) SVG from QByteArray loading when data is invalid.
- (usvg)
display
attribute processing. - (usvg) Recursive
mask
resolving. - (usvg)
inherit
attribute value resolving. - (svgdom) XML namespaces resolving.
- (rendersvg)
failure
dependency.
0.3.0 - 2018-05-23
- (c-api)
resvg_is_image_empty
. - (c-api)
resvg_error
enum. - (c-api) Qt wrapper.
- (resvg) Advanced text layout support (lists of x, y, dx, dy and rotate).
- (resvg) SVG support for
image
element. - (usvg)
symbol
element support. - (usvg) Nested
svg
elements support. - (usvg) Paint fallback resolving.
- (usvg) Bbox validation for shapes that use painting servers.
- (svgdom) Elements from ENTITY resolving.
- (c-api)
resvg_parse_tree_from_file
,resvg_parse_tree_from_data
resvg_cairo_render_to_image
andresvg_qt_render_to_image
will return an error code now. - (cairo-backend) Use
gdk-pixbuf
crate instead ofimage
. - (resvg)
Render::render_to_image
andRender::render_node_to_image
will returnOption
and notResult
now. - (resvg) New geometry primitives implementation.
- (resvg) Rename
render_*
modules tobackend_
. - (rendersvg) Use
getopts
instead ofclap
to reduce the executable size. - (svgtypes)
StreamExt::parse_iri
andStreamExt::parse_func_iri
will parse not only well-formed data now.
- (qt-backend) Gradient with
objectBoundingBox
rendering. - (qt-backend) Text bounding box detection during the rendering.
- (cairo-backend)
image
element clipping. - (cairo-backend) Layers management.
- (c-api)
resvg_get_node_transform
will return a correct transform now. - (resvg)
text-decoration
thickness. - (resvg)
pattern
scaling. - (resvg)
image
without size rendering. - (usvg) Panic during
visibility
resolving. - (usvg) Gradients with one stop resolving.
- (usvg)
use
attributes resolving. - (usvg)
clipPath
andmask
attributes resolving. - (usvg)
offset
attribute instop
element resolving. - (usvg) Incorrect
font-size
attribute resolving. - (usvg) Gradient stops resolving.
- (usvg)
switch
element resolving. - (svgdom) Mixed
xml:space
processing. - (svgtypes)
Paint::from_span
poor performance.
- (c-api)
resvg_error_msg_destroy
. - (resvg)
parse_rtree_*
methods. Useusvg::Tree::from_
instead. - (resvg)
Error
.
0.2.0 - 2018-04-24
- (svg) Partial
clipPath
support. - (svg) Partial
mask
support. - (svg) Partial
pattern
support. - (svg)
preserveAspectRatio
support. - (svg) Check that an external image is PNG or JPEG.
- (rendersvg) Added
--query-all
and--export-id
arguments to render SVG items by ID. - (rendersvg) Added
--perf
argument for a simple performance stats.
- (resvg) API is completely new.
font-size
attribute inheritance duringuse
resolving.