Skip to content

0.30.0 Filters, masks and more

Latest

Choose a tag to compare

@swhitty swhitty released this 15 Nov 11:09
· 109 commits to main since this release
184372f

Thank you @sakamura 🙏

Most of this release comes from @sakamura's roadmap in #142, a huge, carefully researched effort to bring SwiftDraw's rendering in line with the browsers. To land it safely we first built swiftdraw-diff (#148), which scores every sample against WebKit, then cherry-picked each roadmap item into its own PR with his original commits preserved. Items from #142 are marked ⭐.

Highlights

Filters

  • ⭐ feGaussianBlur (#159), plus feOffset, feFlood, feComposite, feMerge, feBlend and feColorMatrix with a full filter graph (#175)
  • feDropShadow (#181)
  • New options: disableFilters draws filtered elements without applying the filter; hideUnsupportedFilters hides elements whose filters can't be rendered (#159)

Painting and structure

  • ⭐ stroke-dasharray and stroke-dashoffset (#147)
  • ⭐ Complete <pattern> support, including fill resets and paint fallbacks (#149, #151)
  • ⭐ Gradient spreadMethod and single-stop gradients (#168), gradient inheritance through href by @fishloa (#143), and correct objectBoundingBox gradients (#166)
  • ⭐ Clip paths and masks to spec (#169), masks with translucent contents (#162) and mask-type: alpha (#164)
  • ⭐ display and visibility (#153, #161)
  • ⭐ preserveAspectRatio (#154)
  • ⭐ Units and percentages on geometry (#165); fractional SVG dimensions by @mishchenko11 (#140); comma-separated viewBox (#138)
  • <symbol> (#182), markers (#184) and <textPath> (#183)
  • <use> prefers href, with an xlink:href fallback, by @MaelRB (#136)

CSS and text

  • ⭐ CSS cascade with selectors, specificity and tolerant stylesheets (#176)
  • font-weight and font-style matching (#170), local() in @font-face (#171), and synthetic bold and oblique (#174)
  • An invalid @font-face no longer discards the whole <style> (#173)

Robustness

  • ⭐ Invalid elements and definitions are skipped instead of failing the document (#150)
  • ⭐ Tolerant parsing of attributes and of invalid geometry (#157, #158)
  • ⭐ Hostile SVGs can no longer trap or recurse forever, by @surprisetalk (#146), with bounded <use>, mask and pattern expansion (#155)

Performance

  • Filter results are cached and shared between views, and computed off the main thread in SVGView. The filter kernels are fast in Debug builds: a filtered SVG's first draw went from 2.6 s to 0.4 s. Tiled drawing renders one tile and repeats it (#178)
  • Fixed a rare macOS deadlock in CoreText font lookups (#180)

Other

  • Customisable logging output by @AF-cgi (#139)
  • Generated SF Symbols are validated after normalising path interpolation, by @AF-cgi (#135)
  • Fixed nested <svg> content being parsed twice (#160) and "invalid context" log noise (#163)
  • Android and Windows build fixes (#156, #185)

New Contributors

Full Changelog: 0.29.0...0.30.0