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.
0.40.0 - 2024-02-17
usvgr::Tree
isSend + Sync
compatible now.usvgr::WriteOptions::preserve_text
to control howusvgr
generates an SVG.usvgr::Image::abs_bounding_box
- All types in
usvgr
are immutable now. Meaning thatusvgr::Tree
cannot be modified after creation anymore. - All struct fields in
usvgr
are private now. Use getters instead. - All
usvgr::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. usvgr::Mask
is allowed to have no children now.- Text nodes will not be parsed when the
text
build feature isn't enabled. usvgr::Tree::clip_paths
,usvgr::Tree::masks
,usvgr::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.usvgr::filter::Primitive::x
,y
,width
andheight
methods were replaced withusvgr::filter::Primitive::rect
.- Split
usvgr::Tree::paint_servers
intousvgr::Tree::linear_gradients
,usvgr::Tree::radial_gradients
,usvgr::Tree::patterns
. All three returns pre-collected slices now. - A
usvgr::Path
no longer can have an invalid bbox. Paths with an invalid bbox will be rejected during parsing. - All
usvgr
methods that return bounding boxes return non-optionalRect
now. NoNonZeroRect
as well. usvgr::Text::flattened
returns&Group
and notOption<&Group>
now.usvgr::ImageHrefDataResolverFn
andusvgr::ImageHrefStringResolverFn
requirefontdb::Database
argument.- All shared nodes are stored in
Arc
and notRc<RefCell>
now. svgr::render_node
now includes filters bounding box. Meaning that a node with a blur filter no longer be clipped.- Replace
usvgr::utils::view_box_to_transform
withusvgr::ViewBox::to_transform
. - Rename
usvgr::XmlOptions
intousvgr::WriteOptions
and embedxmlwriter::Options
.
usvgr::Tree::postprocess()
andusvgr::PostProcessingSteps
. No longer needed.usvgr::ClipPath::units()
,usvgr::Mask::units()
,usvgr::Mask::content_units()
,usvgr::Filter::units()
,usvgr::Filter::content_units()
,usvgr::LinearGradient::units()
,usvgr::RadialGradient::units()
,usvgr::Pattern::units()
,usvgr::Pattern::content_units()
andusvgr::Paint::units()
. They are alwaysuserSpaceOnUse
now.usvgr::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.usvgr::Group::abs_bounding_box
usvgr::Group::abs_stroke_bounding_box
usvgr::Path::abs_bounding_box
usvgr::Path::abs_stroke_bounding_box
usvgr::Text::abs_bounding_box
usvgr::Text::abs_stroke_bounding_box
- All
usvgr-*
crates merged into one. There is just theusvgr
crate now, as before.
usvgr::Group::abs_bounding_box()
method. It's a field now.usvgr::Group::abs_filters_bounding_box()
usvgr::TreeParsing
,usvgr::TreePostProc
andusvgr::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
usvgr::Node
stores its absolute transform now.Node::abs_transform()
executes in constant time now. usvgr::Tree::calculate_bounding_boxes
to calculate all bounding boxes beforehand.usvgr::Node::bounding_box
which returns a precalculated node's bounding box in object coordinates.usvgr::Node::abs_bounding_box
which returns a precalculated node's bounding box in canvas coordinates.usvgr::Node::stroke_bounding_box
which returns a precalculated node's bounding box, including stroke, in object coordinates.usvgr::Node::abs_stroke_bounding_box
which returns a precalculated node's bounding box, including stroke, in canvas coordinates.- (c-api)
svgr_get_node_stroke_bbox
usvgr::Node::filters_bounding_box
usvgr::Node::abs_filters_bounding_box
usvgr::Tree::postprocess
svgr
rendersusvgr::Tree
directly again.svgr::Tree
is gone.usvgr
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
usvgr::NodeKind
intousvgr::Node
. - Upgrade to Rust 2021 edition.
svgr::Tree
. No longer needed.svgr
can renderusvgr::Tree
directly once again.rctree::Node
methods. TheNode
API is completely different now.usvgr::NodeExt
. No longer needed.usvgr::Node::calculate_bbox
. Useusvgr::Node::abs_bounding_box
instead.usvgr::Tree::convert_text
. Useusvgr::Tree::postprocess
instead.usvgr::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
usvgr
can write text back to SVG now. Thanks to @LaurenzV.--preserve-text
flag to theusvgr
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. usvgr_tree::Text::flattened
that will contain a flattened/outlined text.usvgr_tree::Text::bounding_box
. Will be set only after text flattening.- Optimize
usvgr_tree::NodeExt::abs_transform
by storing absolute transforms in the tree instead of calculating them each time.
usvgr_tree::Text::positions
was replaced withusvgr_tree::Text::dx
andusvgr_tree::Text::dy
.
usvgr_tree::CharacterPosition::x
andusvgr_tree::CharacterPosition::y
are gone. They were redundant and you should useusvgr_tree::TextChunk::x
andusvgr_tree::TextChunk::y
instead.usvgr_tree::LinearGradient::id
andusvgr_tree::RadialGradient::id
are moved tousvgr_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 usvgr writer would generate them anyway. - Text-to-paths conversion via
usvgr_text_layout::Tree::convert_text
no longer replaces original text elements with paths, but instead puts them intousvgr_tree::Text::flattened
.
- The
transform
field fromusvgr_tree::Path
,usvgr_tree::Image
andusvgr_tree::Text
. Onlyusvgr_tree::Group
can have it.
It doesn't break anything, because those properties were never used before anyway.
Thanks to @LaurenzV. usvgr_tree::CharacterPosition
usvgr_tree::Path::text_bbox
. Useusvgr_tree::Text::bounding_box
instead.usvgr_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. - (usvgr) 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.usvgr::filter::Filter::fill_paint
andusvgr::filter::Filter::stroke_paint
.BackgroundImage
,BackgroundAlpha
,FillPaint
andStrokePaint
fromusvgr::filter::Input
.usvgr::Group::filter_fill_paint
andusvgr::Group::filter_stroke_paint
.
0.34.1 - 2023-05-28
- Transform components order. Affects only
usvgr
SVG output and C API.
0.34.0 - 2023-05-27
usvgr
usestiny-skia
geometry primitives now, including thePath
container.
The main difference compared to the oldusvgr
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 convertusvgr::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 includesusvgr
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.
usvgr::Path
no longer implementsDefault
. Useusvgr::Path::new
instead.- Replace
usvgr::Rect
withtiny_skia::NonZeroRect
. - Replace
usvgr::PathBbox
withtiny_skia::Rect
. - Unlike the old
usvgr::PathBbox
,tiny_skia::Rect
allows both width and height to be zero. This is not an error. usvgr::filter::Turbulence::base_frequency
was split intobase_frequency_x
andbase_frequency_y
.usvgr::NodeExt::calculate_bbox
no longer includes stroke bbox.- (c-api) Use
float
instead ofdouble
everywhere. - The
svgfilters
crate was merged intosvgr
. - The
rosvgtree
crate was merged intousvgr-parser
. usvgr::Group::filter_fill
moved tousvgr::filter::Filter::fill_paint
.usvgr::Group::filter_stroke
moved tousvgr::filter::Filter::stroke_paint
.
usvgr::Point
. Usetiny_skia::Point
instead.usvgr::FuzzyEq
. Useusvgr::ApproxEqUlps
instead.usvgr::FuzzyZero
. Useusvgr::ApproxZeroUlps
instead.- (c-api)
svgr_path_bbox
. Usesvgr_rect
instead. svgfilters
crate.rosvgtree
crate.
- Write
transform
onclipPath
children inusvgr
SVG output. - Do not duplicate marker children IDs.
Previously, each element resolved for a marker would preserve its ID.
Affects only
usvgr
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, svgr 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. svgr::Tree
, aka a render tree, which is an even simpler version ofusvgr::Tree
.usvgr::Tree
had to be converted intosvgr::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
svgr::Tree::render
instead ofsvgr::render
. - svgr'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 fromsvgr_render
. - (c-api) Removed
fit_to
argument fromsvgr_render_node
. usvgr::ScreenSize
moved tosvgr
.usvgr::ScreenRect
moved tosvgr
.- Rename
svgr::ScreenSize
intosvgr::IntSize
. - Rename
svgr::ScreenRect
intosvgr::IntRect
.
filter
build feature fromsvgr
. Filters are always enabled now.svgr::FitTo
usvgr::utils::view_box_to_transform_with_clip
usvgr::Size::to_screen_size
. Usesvgr::IntSize::from_usvgr
instead.usvgr::Rect::to_screen_size
. Usesvgr::IntSize::from_usvgr(rect.size())
instead.usvgr::Rect::to_screen_rect
. Usesvgr::IntRect::from_usvgr
instead.- (c-api)
svgr_fit_to
- (c-api)
svgr_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. SVG2usvgr_tree::MaskType
usvgr_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 svgr already.usvgr_tree::EnableBackground
usvgr_tree::Group::enable_background
usvgr_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
usvgr::Tree::paint_servers
usvgr::Tree::clip_paths
usvgr::Tree::masks
usvgr::Tree::filters
usvgr::Node::subroots
- (usvgr)
--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.- (usvgr) 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
usvgr
CLI tool. Can be installed via cargo as before.
- Extract most
usvgr
internals into newusvgr-tree
andusvgr-parser
crates.usvgr-tree
contains just the SVG tree and all the types.usvgr-parser
parsers SVG intousvgr-tree
. Andusvgr
is just an umbrella crate now. - To use
usvgr::Tree::from*
methods one should import theusvgr::TreeParsing
trait now. - No need to import
usvgr-text-layout
manually anymore. It is part ofusvgr
now. rosvgtree
no longer reexportssvgrtypes
.rosvgtree::Node::attribute
returns just a string now.rosvgtree::Node::find_attribute
returns just arosvgtree::Node
now.- Rename
usvgr::Stretch
intousvgr::FontStretch
. - Rename
usvgr::Style
intousvgr::FontStyle
. usvgr::FitTo
moved tosvgr::FitTo
.usvgr::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.
svgr
CLI allows files with XML DTD again.- (svgrtypes) Handle implicit MoveTo after ClosePath segments.
0.29.0 - 2023-02-04
svgr
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 upsvgr
execution.usvgr::Group::should_isolate
usvgr::Tree::has_text_nodes
- Some
usvgr
internals were moved into the newrosvgtree
crate. - Dummy groups are no longer removed. Use
usvgr::Group::should_isolate
to check if a group affects rendering. usvgr-text-layout::TreeTextToPath::convert_text
no longer has thekeep_named_groups
argument.- MSRV bumped to 1.65
- Update dependencies.
usvgr::Options::keep_named_groups
. Dummy groups are no longer removed.- (c-api)
svgr_options_set_keep_named_groups
- (Qt API)
ResvgOptions::setKeepNamedGroups
- Missing
font-family
handling. font-weight
resolving.
0.28.0 - 2022-12-03
usvgr::Text
andusvgr::NodeKind::Text
.
usvgr
isn't converting text to paths by default now. A caller must callusvgr::Tree::convert_text
orusvgr::Text::convert
fromusvgr-text-layout
crate on demand.usvgr
text layout implementation moved intousvgr-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. usvgr
is purely an SVG parser now. It doesn't convert text to paths and doesn't write SVG anymore.usvgr::filter::ConvolveMatrixData
methods are fields now.
usvgr
CLI binary. No alternatives for now.- All
usvgr
build features.filter
. Filter elements are always parsed byusvgr
now.text
. Text elements are always parsed byusvgr
now.export
.usvgr
cannot write an SVG anymore.
usvgr::Tree::to_string
.usvgr
cannot write an SVG anymore.usvgr::TransformFromBBox
trait. This is just a regularusvgr::Transform
method now.usvgr::OptionsRef
.usvgr::Options
is enough from now.usvgr::Options::fontdb
. Used only byusvgr-text-layout
now.--dump-svg
fromsvgr
.
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 insvgr
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 svgr 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.
usvgr::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 makesusvgr
a bit simpler. Makesusvgr
API way easier, since instead of looking for a node viausvgr::Tree::defs_by_id
the caller can access the type directly viaRc
. And makes creation of customusvgr::Tree
s way easier.clip_path
,mask
andfilters
usvgr::Group
fields storeRc
instead ofString
now.usvgr::NodeExt::units
was moved tousvgr::Paint::units
.usvgr::filter::ImageKind::Use
storesusvgr::Node
instead ofString
.usvgr::PathData
stores commands and points separately now to reduce overall memory usage.usvgr::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. usvgr::TextSpan::font_size
isNonZeroPositiveF64
instead off64
now.- Re-export
usvgr
andtiny-skia
dependencies insvgr
. - Re-export
roxmltree
dependency inusvgr
. - (usvgr) Output float precision is reduced from 11 to 8 digits.
usvgr::Tree::create
.usvgr::Tree
is an open struct now.usvgr::Tree::root
. It's a public field now.usvgr::Tree::svg_node
. Replaced withusvgr::Tree
public fields.defs
,is_in_defs
,append_to_defs
anddefs_by_id
fromusvgr::Tree
. We no longer emulate SVG structure. No alternative.usvgr::Tree::is_in_defs
. There are nodefs
anymore.usvgr::Paint::Link
. We store gradient and patterns directly inusvgr::Paint
now.usvgr::Svg
. No longer needed.size
andview_box
areusvgr::Tree
fields now.usvgr::SubPathIter
andusvgr::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)
svgr_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
usvgr::ImageHrefResolver
that allows a customxlink:href
handling. Thanks to antmelnyk.usvgr::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
usvgr::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
svgr::render
andsvgr::render_node
accept a transform now.- (c-api)
svgr_render
andsvgr_render_node
accept a transform now. usvgr::Color
is a custom type and not asvgrtypes::Color
reexport now.usvgr::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 insvgr
correctly handles alpha now. - Fix building usvgr without filter feature but with export.
0.19.0 - 2021-10-04
- Better text-on-path converter accuracy by accounting the current transform.
usvgr::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.usvgr::PathBbox
andsvgr_path_bbox
(to C API).
- (usvgr) All filter related types are under the
filter
module now. - (usvgr) Remove
Fe
prefix from all filter types. - (c-api)
svgr_get_node_bbox
returnssvgr_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. usvgr::Options::default_size
--default-width
and--default-height
to usvgr.
usvgr::Group::filter
is a list of filter IDs now.usvgr::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 svgr/usvgr withsystem-fonts
, but withoutmemmap-fonts
. Enabled by default. - The
--dump-svg
argument in svgr CLI tool should be enabled using--features dump-svg
now. No enabled by default. usvgr::Tree::to_string
is behind theexport
build feature now.
- When writing SVG,
usvgr
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. SVG2usvgr::OptionsRef
, which is a non-ownedusvgr::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 svgr.--export-area-drawing
to svgr.
svgr::render_node
requiresusvgr::Tree
now.usvgr::Color
gained analpha
field.
usvgr::Node::tree
. Cannot be implemented efficiently anymore.usvgr::SystemFontDB
. No longer needed.
pattern
scaling.- Greatly improve
symbol
resolving speed inusvgr
. - Whitespaces trimming on nested
tspan
.
0.15.0 - 2021-06-13
- Allow reading SVG from stdin in
svgr
binary. --id-prefix
tousvgr
.FitTo::Size
svgr
binary accepts--width
and--height
args together now. Previously, only--width
or--height
were allowed.usvgr::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.
usvgr::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
svgr --perf
. usvgr::XmlOptions
rewritten.usvgr::Tree::to_string
requires a reference toXmlOptions
now.
usvgr::Tree::from_file
. Usefrom_data
orfrom_str
instead.usvgr::Error::InvalidFileSuffix
usvgr::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.
usvgr
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.
- (usvgr) Do not write
usvgr:version
to the output SVG.
- (usvgr)
overflow='inherit'
resolving. - (usvgr) SVG Path length calculation that affects
startOffset
property intextPath
. - (usvgr) Fix
feImage
resolving when the linked element hasopacity
,clip-path
,mask
and/orfilter
attributes. - (usvgr) 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.- (usvgr)
Tree::from_xmltree
- Remove the
Image
struct.render()
andrender_node()
methods now accepttiny_skia::PixmapMut
. - Update
fontdb
. - Update
tiny-skia
. - (c-api)
svgr_size
usesdouble
instead ofuint32_t
now. - (qt-api)
defaultSize()
anddefaultSizeF()
methods now return SVG size and not SVG viewbox size. - (usvgr)
Options::path
changed toOptions::resources_dir
and requires a directory now. - (c-api)
svgr_options_set_file_path
changed tosvgr_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)
svgr_image
struct andsvgr_image_*
methods.svgr
renders onto the provided buffer now. - (c-api)
svgr_color
, because unused.
0.12.0 - 2020-12-05
- svgr no longer requires a C++ compiler!
tiny-skia
was updated to a pure Rust version, which means thatsvgr
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.
- (usvgr) Do not panic when a font has a zero-sized underline thickness.
- (usvgr) 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 usvgr, svgr 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 svgr 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
usvgr::Options
now. - (usvgr) The
fontdb
module moved into its own crate. - (usvgr)
fontconfig
is no longer used for matching generic fonts on Linux. Mainly because it's very slow. - (usvgr) 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. - (usvgr)
ImageData
replaced withImageKind
. - (usvgr) 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.- (usvgr)
ImageFormat
. - (c-api) Rendering on a backends canvas no longer supported. Was constantly misused.
0.10.0 - 2020-06-19
- The
svgr
crate has been split into four: svgr-cairo, svgr-qt, svgr-skia and svgr-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
svgr
crate. Use backend-specific crates. tools/rendersvg
. Each backend has its own CLI tool now.tools/usvgr
.usvgr
implements CLI by default now.- (c-api)
svgr_*_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.
- (usvgr) Font fallback when shaping produces a different amount of glyphs.
- (usvgr) Ignore a space after the last character during
letter-spacing
processing. - (usvgr)
marker-end
rendering when the last segment is a curve with the second control point that coincides with end point. - (usvgr) Accept embedded
image
data without mime. - (usvgr) Fonts search in a home directory on Linux.
- (usvgr)
dy
calculation fortextPath
thanks to Stoeoef - (usvgr)
textPath
resolving when a referenced path has a transform.
Thanks to Stoeoef. - (usvgr) 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.- svgr/usvgr 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. - (usvgr)
fill
andstroke
attributes will always be set forpath
now. - (usvgr)
g
,path
andimage
can now be set insidedefs
. Required byfeImage
. - (c-api) Rename
svgr_*_render_to_image
intosvgr_*_render_to_file
.
- (usvgr) 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. - (usvgr)
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/usvgr
. - (usvgr) The
xmlwriter
is used for SVG generation now. Almost 2x faster than generating ansvgdom
. - (usvgr) 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
.- (usvgr)
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.
- (usvgr)
baseline-shift
processing insidetextPath
. - (usvgr) Remove all
tref
element children. - (usvgr)
tref
withxml:space
resolving. - (usvgr) Ignore nested
tref
. - (usvgr) Ignore invalid
clipPath
children that were referenced viause
. - (usvgr)
currentColor
will always fallback to black now. Previously,stroke
was set tonone
which is incorrect. - (usvgr)
use
can reference an element inside a non-SVG element now. - (usvgr) Collect all styles for generic fonts and not only Regular.
- (usvgr) 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
. - (usvgr)
--quiet
argument. - (c-api)
svgr_get_image_bbox
. - (qt-api)
ResvgRenderer::boundingBox
. - (svgr) A raqote backend thanks to jrmuizel. Still experimental.
- Text will be converted into paths on the
usvgr
side now. - (svgr) Do not rescale images before rendering. This is faster and better.
- (usvgr) 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. - (usvgr) The default
color-interpolation-filters
attribute will not be exported now.
- (usvgr) All text related structures and enums. Text will be converted into
Path
now. InitObject
andinit()
because they are no longer needed.- (c-api)
svgr_handle
,svgr_init
,svgr_destroy
. - (c-api)
svgr_cairo_get_node_bbox
andsvgr_qt_get_node_bbox
. Use backend-independentsvgr_get_node_bbox
instead. - (cairo-backend)
pango
dependency. - (svgr)
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)
svgr_is_image_empty
was always returningfalse
. - (svgr) Panic when
filter
withobjectBoudningBox
was set on an empty group. - (usvgr)
mask
withobjectBoundingBox
resolving. - (usvgr)
pattern
'sviewBox
attribute resolving viahref
. - (roxmltree) Namespace resolving.
0.6.1 - 2019-03-16
- (usvgr)
transform
multiplication. - (usvgr)
use
insideclipPath
resolving.
0.6.0 - 2019-03-16
- Nested
baseline-shift
support. - (qt-api)
renderToImage
. - (usvgr) A better algorithm for unused defs (
defs
element children, like gradients) removal. - (usvgr)
Error::InvalidSize
. - (c-api)
RESVG_ERROR_INVALID_SIZE
.
- (usvgr) A major rewrite.
baseline-shift
withsub
,super
and percent values calculation.- Marker resolving moved completely to
usvgr
. - 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. - (usvgr) Disable default attributes exporting.
- (usvgr) Marker element and attributes. Markers will be resolved just like
use
now.
- (svgr) 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. - (usvgr)
filter:none
processing. - (usvgr)
text
insidetext
processing. - (usvgr) Endless loop during
use
resolving. - (usvgr) Endless loop when SVG has indirect recursive
xlink:href
links. - (usvgr) Endless loop when SVG has recursive
marker-*
links. - (usvgr) Panic during
use
resolving. - (usvgr) Panic during inherited attributes resolving.
- (usvgr) Groups regrouping.
- (usvgr)
dx
/dy
processing ontext
. - (usvgr)
textAnchor
resolving. - (usvgr) Ignore
fill-rule
ontext
. - (svgrtypes) 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. - (usvgr)
color
onuse
resolving. - (usvgr)
offset
attribute resolving inside thestop
element. - (usvgr) Ungrouping of groups with non-inheritable attributes.
- (usvgr)
rotate
attribute resolving. - (usvgr) Paths without stroke and fill will no longer be removed. Required for a proper bbox resolving.
- (usvgr) Coordinates resolving when units are
userSpaceOnUse
. - (usvgr) Groups regrouping. Caused an incorrect rendering of
clipPath
that hadfilter
on a child. - (usvgr) Style attributes resolving on the root
svg
element. - (usvgr)
SmoothCurveTo
andSmoothQuadratic
conversion. - (usvgr)
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
- (svgr) Initial filters support.
- (svgr) Nested
clipPath
andmask
support. - (svgr) MSVC support.
- (rendersvg)
font-family
,font-size
andlanguages
to args. - (usvgr)
systemLanguage
attribute support. - (usvgr) Default font family and size is configurable now.
- (c-api)
RESVG_ERROR_PARSING_FAILED
. - (c-api)
font_family
,font_size
andlanguages
tosvgr_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.
- (svgr) Recursive SVG images via
image
tag. - (svgr) Bbox calculation of the text with rotate.
- (svgr) Invisible elements processing.
- (qt-api) SVG from QByteArray loading when data is invalid.
- (usvgr)
display
attribute processing. - (usvgr) Recursive
mask
resolving. - (usvgr)
inherit
attribute value resolving. - (svgdom) XML namespaces resolving.
- (rendersvg)
failure
dependency.
0.3.0 - 2018-05-23
- (c-api)
svgr_is_image_empty
. - (c-api)
svgr_error
enum. - (c-api) Qt wrapper.
- (svgr) Advanced text layout support (lists of x, y, dx, dy and rotate).
- (svgr) SVG support for
image
element. - (usvgr)
symbol
element support. - (usvgr) Nested
svg
elements support. - (usvgr) Paint fallback resolving.
- (usvgr) Bbox validation for shapes that use painting servers.
- (svgdom) Elements from ENTITY resolving.
- (c-api)
svgr_parse_tree_from_file
,svgr_parse_tree_from_data
svgr_cairo_render_to_image
andsvgr_qt_render_to_image
will return an error code now. - (cairo-backend) Use
gdk-pixbuf
crate instead ofimage
. - (svgr)
Render::render_to_image
andRender::render_node_to_image
will returnOption
and notResult
now. - (svgr) New geometry primitives implementation.
- (svgr) Rename
render_*
modules tobackend_
. - (rendersvg) Use
getopts
instead ofclap
to reduce the executable size. - (svgrtypes)
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)
svgr_get_node_transform
will return a correct transform now. - (svgr)
text-decoration
thickness. - (svgr)
pattern
scaling. - (svgr)
image
without size rendering. - (usvgr) Panic during
visibility
resolving. - (usvgr) Gradients with one stop resolving.
- (usvgr)
use
attributes resolving. - (usvgr)
clipPath
andmask
attributes resolving. - (usvgr)
offset
attribute instop
element resolving. - (usvgr) Incorrect
font-size
attribute resolving. - (usvgr) Gradient stops resolving.
- (usvgr)
switch
element resolving. - (svgdom) Mixed
xml:space
processing. - (svgrtypes)
Paint::from_span
poor performance.
- (c-api)
svgr_error_msg_destroy
. - (svgr)
parse_rtree_*
methods. Useusvgr::Tree::from_
instead. - (svgr)
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.
- (svgr) API is completely new.
font-size
attribute inheritance duringuse
resolving.