共用方式為


SVG 支援

從 Windows 10 年度更新版開始,Direct2D 支援轉譯包含 SVG 字元外框的色彩字型,如OpenType 規格中所述 (請參閱SVG 表格) 。 從 Windows 10 Creators Update 開始,Direct2D 也支援轉譯獨立 SVG 影像。 不過,OpenType SVG 字型中不允許某些 SVG 功能,Direct2D 目前不支援某些 SVG 功能。  

本主題會識別 Windows 10 年度更新版和更新版本中 Direct2D 支援的SVG 1.1功能集。 本檔適用于 OpenType 字型中的 SVG 以及獨立 SVG 影像。

支援的 SVG 元素和屬性

Direct2D 支援轉譯下列 SVG 元素,以及每個元素的相關屬性。 會忽略其他元素和一般屬性。

元素 支援的一般屬性
id, style, transform, cx, cy, r
clipPath id, style, transform, clipPathUnits
defs id, style, transform
desc* id
橢圓 id, style, transform, cx, cy, rx, ry
G id, style, transform
image id, style, transform, x, y, width, height, preserveAspectRatio, xlink:href
line id, style, transform, x1, y1, x2, y2
linearGradient id, style, x1, y1, x2, y2, gradientUnits, gradientTransform, spreadMethod, xlink:href
path id, style, transform, d
多邊形 id, style, transform, points, id, style, transform, points
聚合線條 id, style, transform, points, id, style, transform, points
radialGradient id, style, cx, cy, r, fx, fy, gradientUnits, gradientTransform, spreadMethod, xlink:href
矩形 id, style, transform, x, y, width, height, rx, ry
停止 id, style, offset
Svg id, style, x, y, width, height, viewBox, preserveAspectRatio
標題* id
use id, style, transform, x, y, width, height, xlink:href

 

*僅支援 Windows 10 Creators Update 和更新版本

支援的 SVG 簡報屬性

Direct2D 也支援下列簡報屬性。 這些可以在任何 SVG 元素上指定,但只會影響 SVG 規格中所述之特定元素的外觀, (請參閱 簡報屬性) 。

  • clip-path
  • clip-rule
  • color
  • 顯示*
  • fill
  • fill-opacity
  • fill-rule
  • 不透明度
  • Overflow - 溢位
  • stop-color
  • stop-opacity
  • stroke (衝程)
  • stroke-dasharray
  • stroke-dashoffset
  • stroke-linecap
  • stroke-linejoin
  • stroke-miterlimit
  • stroke-opacity
  • stroke-width
  • 知名度*

*僅支援 Windows 10 Creators Update 和更新版本

不支援的 SVG 功能

不支援的專案和屬性

Direct2D 會將上述清單中未包含的任何元素或屬性視為不支援。 剖析包含不支援之專案或屬性的 SVG 內容時,會忽略不支援的實體。 內容的其餘部分會盡可能以穩定方式呈現。

不支援的長度單位

自 Windows 10 年度更新版起,Direct2D 僅支援使用者空間長度值和百分比長度值。 不支援使用單位尾碼的長度,例如 「mm」 或 「em」。

從 Windows 10 Fall Creators Update 開始,Direct2D 也支援絕對單位識別碼:px、pt、pc、cm、mm 和 in。 不支援 (em 的相對單位識別碼,例如) 。

不支援的映射來源

只有當影像元素的 xlink:href 屬性設定為 base64 編碼的影像時,才支援該影像。 不支援遠端參考。