SVG Support

Beginning in Windows 10 Anniversary Update, Direct2D supports rendering color fonts that contain SVG glyph outlines, as described in the OpenType specification (see the ‘SVG ’ table). Beginning in Windows 10 Creators Update, Direct2D also supports rendering standalone SVG images. However, certain SVG features are disallowed within OpenType SVG fonts, and certain SVG features are currently unsupported by Direct2D.  

This topic identifies the set of SVG 1.1 features supported by Direct2D in Windows 10 Anniversary Update and newer. This document applies to SVG in OpenType fonts as well as standalone SVG images.

Supported SVG elements and attributes

Direct2D supports rendering the following SVG elements and the associated attributes for each element. Other elements and regular attributes are ignored.

ElementSupported regular attributes
circleid, style, transform, cx, cy, r
clipPathid, style, transform, clipPathUnits
defsid, style, transform
desc*id
ellipseid, style, transform, cx, cy, rx, ry
gid, style, transform
imageid, style, transform, x, y, width, height, preserveAspectRatio, xlink:href
lineid, style, transform, x1, y1, x2, y2
linearGradientid, style, x1, y1, x2, y2, gradientUnits, gradientTransform, spreadMethod, xlink:href
pathid, style, transform, d
polygonid, style, transform, points
polylineid, style, transform, points
radialGradientid, style, cx, cy, r, fx, fy, gradientUnits, gradientTransform, spreadMethod, xlink:href
rectid, style, transform, x, y, width, height, rx, ry
stopid, style, offset
svgid, style, x, y, width, height, viewBox, preserveAspectRatio
title*id
useid, style, transform, x, y, width, height, xlink:href

 

* Only supported in Windows 10 Creators Update and newer

Supported SVG presentation attributes

Direct2D also supports the following presentation attributes. These can be specified on any SVG elements, but they only affect the appearance of certain elements as described in the SVG specification (see Presentation attributes).

  • clip-path
  • clip-rule
  • color
  • display*
  • fill
  • fill-opacity
  • fill-rule
  • opacity
  • overflow
  • stop-color
  • stop-opacity
  • stroke
  • stroke-dasharray
  • stroke-dashoffset
  • stroke-linecap
  • stroke-linejoin
  • stroke-miterlimit
  • stroke-opacity
  • stroke-width
  • visibility*

* Only supported in Windows 10 Creators Update and newer

Unsupported SVG features

Unsupported elements and attributes

Any element or attribute not included in the above lists is considered unsupported by Direct2D. When parsing SVG content that contains an unsupported element or attribute, the unsupported entity is ignored. The remainder of the content is rendered as faithfully as possible.

Unsupported length units

As of Windows 10 Anniversary Update, Direct2D only supports user-space length values and percentage length values. Lengths with unit suffixes, like “mm” or “em,” are unsupported.

Starting in Windows 10 Fall Creators Update, Direct2D also supports absolute unit identifiers: px, pt, pc, cm, mm, and in. Relative unit identifiers (em, ex) are not supported.

Unsupported image sources

The image element is only supported if its xlink:href attribute is set to a base64-encoded image. Remote references are not supported.

 

 

Show: