<< Click to Display Table of Contents > 

SAMLight Manual > Import-Export > Import > SVG Import Supported Objects

SVG Import Supported Objects
Previous pageReturn to chapter overviewNext page

SAMLight currently offers 2 different import filters for SVG files:

1)SVG  -  Scalable Vector Graphics, SCAPS (*.svg): new filter, based on open source SVG++

2)SVG  -  Scalable Vector Graphics, Old (*.svg): old filter, might be outdated in the future, not recommended

In the following tables, different attributes and elements of SVG files are listed. For the two import filters, information is given if these attributes and elements are supported or not. Additional information on specific interpretation is also given in some cases.

note

These lists are not complete due to the complexity of the SVG file format.

 

Recommended SVG properties and import filter options:

Use SVG - SCAPS import filter with "Import with 96 dpi".

Don't use viewBox to avoid scaling.

Use elements with unit mm to get a 1:1 interpretation in SAMLight.

Use UTF-8 coding for the SVG

 

Coordinates and Units

"SVG - Old" Import Filter

"SVG - SCAPS" Import Filter

Units

supported units: 'em', 'px', 'pt', 'pc', 'cm', 'mm', 'in', '%' and unitless

not supported: 'ex'

Coordiantes with the unit 'em', 'pt', 'pc', 'cm', 'mm' and 'in' are first converted to 'px' with 96 dpi. Unitless coordiantes are interpreted as 'px'.

The Viewport unit defines how the 'px' coordinates are converted to 'mm', see Viewport in table  1. This double conversion causes wrong scaling for coordinates with units other than 'px' and unitless.

 

supported units: 'em', 'px', 'pt', 'pc', 'cm', 'mm', 'in', '%' and unitless

not supported: 'ex'

Unitless coordiantes are interpreted as 'px'.

If the 'Import with 96 dpi' is checked, 'px' are converted to mm with 96 dpi

If the 'Import with 96 dpi' is not checked, 'px' are converted to mm with 25.4 dpi ('px' equals 'mm').

Coordinates of Elements

Coordiantes of elements are scaled by a factor.

Coordiantes of elements are scaled by a factor.

Table 38: Differences between the two import filters "SVG - Old" and "SVG - SCAPS": Coordinates and Units

 

Attributes of SVG Element

"SVG - Old" Import Filter

"SVG - SCAPS" Import Filter

Namespace <xmlns>

not required.

xmlns='http://www.w3.org/2000/svg' in SVG element is mandatory.

Viewport <width>, <height>

supported as reference for coordinates in '%'.

Please consider the table -1.

Coordiantes with the unit 'em', 'pt', 'pc', 'cm', 'mm' and 'in' are first converted to 'px' with 96 dpi. This cause wrong scaling.

Unitless coordiantes are interpreted as 'px'.

The Viewport unit defines how the 'px' coordinates are converted to 'mm'.

oIf the Viewport is not specified or the Viewport unit is 'mm', 'px' are converted to 'mm' with 25.4 dpi ('px' equals 'mm').

oIf the Viewport unit is not specified or 'px', 'px' are converted to 'mm' with 72 dpi.

oIf the Viewport is 'pt', 'pc', 'cm', or 'in', then 'px' are interpreted in the same unit as defined by the Viewport and then converted to 'mm'.

supported as reference for coordinates in '%'.

If the Viewport is not specified, a default Viewport of 100 px is set.

How the 'px' coordinates are converted to mm depends on the state of the 'Import with 96 dpi' checkbox, see table -1.

viewBox <viewBox>

supported for scaling and positioning.

viewBox origin shifts elements.

viewBox is always interpreted in the same unit as defined by the Viewport.

In order to avoid scaling, the viewBox must not be specified or be of the same size as the Viewport.

supported for scaling and positioning.

viewBox origin shifts elements.

viewBox is unitless. How the unitless coordinates are converted to 'mm' depends on the state of the 'Import with 96 dpi' checkbox, see table -1.

In order to avoid scaling, the viewBox must not be specified or be of the same size as the Viewport.

Table 39: Differences between the two import filters "SVG - Old" and "SVG - SCAPS": Attributes of SVG Element

Element Attributes

"SVG - Old" Import Filter

"SVG - SCAPS" Import Filter

Color of stroke and fill (for pen mapping)

Fill color is used. 'Read Pen Info' must be checked.

Default fill color is black.

If fill color is black or none, stroke color is used.

Stroke none is the same as stroke black.

If color of stroke and fill are both "none", the SVG element will not be imported at all.

The stroke color is used. 'Read Pen Info' must be checked.

Stroke none is treated as the default color black.

Fill color is usually ignored. Only when "import with default hatch style" is activated, elements with fill will be hatched.

If color of stroke and fill are both "none", the SVG element will not be imported at all. Default fill color is black.

CSS options

supported

partially supported

Inline CSS (each element has its own CSS statement) is supported.

CSS cascading (a global style element, a.k.a. CSS stylesheet in style element) is ignored.

xml:space

not supported

not supported

Vertical alignment <dominant-baseline>

not supported

supported

Horizontal alignment <text-anchor>

not supported

supported. The text-anchor sets the horizontal alignment.

Default is used for start.

Em-Center is used for middle.

Em-Right is used for end.

<tspan>

supported

supported

 

Font weight <font-weight>

partially supported

 

Normal is used for "lighter", "normal", "bolder" and any number.

Bold is used for "bold".

partially supported

 

Normal is used for "lighter", "normal" and a number < 700.

Bold is used for "bold", "bolder" and a number >= 700.

Path attribute <d>

supported

Lineto command with multiple positions is not supported

Horizontal and vertical lines with intermediate points are not supported.

supported

Transformation Matrices

supported

supported

Filling

not supported

color see above

not supported

Stroking

not supported

color see above

not supported

color see above

Marker

not supported

not supported

Linking

not supported

not supported

Clipping, Masking, and Compositing

not supported

not supported

Table 40: Differences between the two import filters "SVG - Old" and "SVG - SCAPS": Attributes

Elements

"SVG - Old" Import Filter

"SVG - SCAPS" Import Filter

Path

supported

If an empty path is present, the whole import is cancelled.

Open polyline with fill is closed.

 

supported

Use

supported

not supported

Image

not supported

not supported

Unspecified

not supported

not supported

Embedded Font (<glyph>)

 

not supported

not supported

Basic shapes (<circle>, <ellipse>, <line>, <polygon>,

<polyline>, <rect>)

supported

Open polyline with fill is closed.

Polygon is not supported.

supported

 

Group (<g>)

supported

supported

Text

supported

Font rendering has some issues.

supported

Em size and DirectWrite character generation is forced.

Text path <textPath>

not supported

not supported

Filter Effects

not supported

not supported

Gradients (<linearGradient>, <radialGradient>, <stop>)

not supported

not supported

Patterns

not supported

not supported

Interactivity

not supported

not supported

Hyperlink <a>

not supported

not supported

Animation (<animate>, <animateMotion>, <animateTransform>, <mpath>, <set>)

not supported

not supported

Table 41: Differences between the two import filters "SVG - Old" and "SVG - SCAPS": Elements