Difference between revisions of "SpecFXGExport"

From Inkscape Wiki
Jump to navigation Jump to search
m
m
 
Line 5: Line 5:
Initial XSLT file done. Initial unit and global tests done.
Initial XSLT file done. Initial unit and global tests done.


== Design ==
== Specification ==
=== Design ===
This export extension uses the XSLT extension system (already used by XAML export).
This export extension uses the XSLT extension system (already used by XAML export).
=== Discussion ===


== TODO ==
== Implementation ==
=== TODO ===
*More tests.
*More tests.
*Implement workarounds for gradients limitations (needs exslt). Radial gradient orientation already implemented with exslt math function, but doesn't work with Inkcape currently (works with xsltproc).
*Implement workarounds for gradients limitations (needs exslt). Radial gradient orientation already implemented with exslt math function, but doesn't work with Inkcape currently (works with xsltproc).
Line 16: Line 19:
*Implement some of the FXG improvements to the XAML export.
*Implement some of the FXG improvements to the XAML export.


== Discussion ==
=== Known limitations ===
Some SVG features are not are partially supported by FXG. When possible, a workaround has been implemented in the export filter to render the missing features. Some elements that can't be created with Inkscape are not supported.
 
{| border="0" align="center" valign="top" cellpadding="5px" style="width:100%; border: 1px solid #999; background-color: #ffffff;"
|- bgcolor="#EEEEEE"
! scope=col |
! scope=col |Partial support
! scope=col |Not supported
 
|- style="border: 1px solid #999;"
! scope=row |Root level and groups
|width="40%"|Limited support for nested SVG elements (the first one is converted to Graphics and the others to Groups).
|width="40%"|Viewbox.
 
|- style="border: 1px solid #999;"
! scope=row |Defs
|Limited support for switch (always pass).
|Use.<br />Markers.<br />Patterns.<br />Symbols.
 
|- style="border: 1px solid #999;"
! scope=row |Transforms
|
|Skew, multiple values rotation (only the first one is converted).
 
|- style="border: 1px solid #999;"
! scope=row |Filters
|
|Support limited to blurs.
 
|- style="border: 1px solid #999;"
! scope=row |Gradients and color
|
|Gradient positioning, shaping and transformation (they are currently centered and restricted to the object bounding box).<br />CurrentColor.<br />Fill colors with both an url and a rgb value.


== Known limitations ==
|- style="border: 1px solid #999;"
Some SVG features are not are partially supported by FXG. When possible, a workaround has been implemented in the export filter to render the missing features. Some elements that can't be created with Inkscape are not supported.
! scope=row |Stroke
|Mitterlimit doesn't give the same result.
|Dasharrays and dashoffset.<br />Butt linecap.
 
|- style="border: 1px solid #999;"
! scope=row |Clip and mask
|
|clipPathUnits="objectBoundingBox" and maskUnits="objectBoundingBox".<br />Clipping and masking with text (workaround: convert text to path).


=== Root level and groups ===
|- style="border: 1px solid #999;"
* '''[Partial]''' Limited support for nested SVG elements (the first one is converted to Graphics and the others to Groups).
! scope=row |Text
* '''[Not supported]''' Viewbox.
|Text rotation (0, 90, 180 and 270 degrees only) -> not implemented.<br/>Font weight (normal and bold only) -> values under 500 are considered normal, the others bold.<br/>Whitespace handling, issues with xml:whitespace='preserve'.<br/>Text frames (only works with rectangles, and flowRegion transform not supported).
=== Defs ===
|Generic fonts (workaround: Sans font is converted to Arial).<br/>Embedded fonts (in defs).<br/>Character rotation.<br/>Character positioning (x and y).<br/>Text span (from tspan or flowSpan) positioning.<br/>Text-anchor.<br/>Text stroke.
* '''[Partial]''' Limited support for switch (always pass).
* '''[Not supported]''' Use.
* '''[Not supported]''' Markers.
* '''[Not supported]''' Patterns.
* '''[Not supported]''' Symbols.
=== Transforms ===
* '''[Not supported]''' Skew.
* '''[Not supported]''' Multiple values rotation (only the first one is converted).
=== Filters ===
* '''[Partial]''' Support limited to blurs.
=== Gradients and color===
* '''[Not supported]''' Gradient positioning, shaping and transformation. They are currently centered and restricted to the object bounding box.
* '''[Not supported]''' CurrentColor.
* '''[Not supported]''' Fill colors with both an url and a rgb value.
=== Stroke ===
* Mitterlimit doesn't give the same result.
* '''[Not supported]''' Dasharrays and dashoffset.
* '''[Not supported]''' Butt linecap.
=== Clip and mask ===
* '''[Not supported]''' clipPathUnits="objectBoundingBox" and maskUnits="objectBoundingBox".
* '''[Not supported]''' clipping and masking with text (workaround: convert text to path).
=== Text ===
* '''[Partial]''' Text rotation (0, 90, 180 and 270 degrees only) -> not implemented.
* '''[Partial]''' Font weight (normal and bold only) -> values under 500 are considered normal, the others bold.
* '''[Partial]''' Whitespace handling, issues with xml:whitespace='preserve'.
* '''[Partial]''' Text frames (only works with rectangles, and flowRegion transform not supported).
* '''[Not supported]''' Generic fonts (workaround: Sans font is converted to Arial).
* '''[Not supported]''' Embedded fonts (in defs).
* '''[Not supported]''' Character rotation.
* '''[Not supported]''' Character positioning (x and y).
* '''[Not supported]''' Text span (from tspan or flowSpan) positioning.
* '''[Not supported]''' Text-anchor.
* '''[Not supported]''' Text stroke.
General workaround for text: convert everything to path before exporting will resolve most issues.
General workaround for text: convert everything to path before exporting will resolve most issues.
=== Shapes ===
* '''[Not supported]''' Polygons.
* '''[Not supported]''' Polylines.
* '''[Not supported]''' Elliptical arc curve path commands (workaround: convert ellipse and circle to path first). Converting arcs to curves in XSLT 1.0 looks awfully complex (it requires some exslt math and strings functions -which needs some changes in the Windows build to include and link the exslt dll- and a path parser template).
=== Images ===
* '''[Not supported]''' Embedded images (base64).
* '''[Not supported]''' Preserve ratio.
=== Other ===
* '''[Partial]''' Limited support for layers blend mode (screen and lighten add clipping).
* '''[Not supported]''' Object title and description.
* '''[Not supported]''' em, ex and % units (FXG only knows pixel values)
* '''[Not supported]''' No RDF and metadata support.
* '''[Not supported]''' DOCTYPE (crashes the XSLT conversion).


== Detailed tests ==
|- style="border: 1px solid #999;"
! scope=row |Shapes
|
|Polygons.<br/>Polylines.<br/>Elliptical arc curve path commands (workaround: convert ellipse and circle to path first). Converting arcs to curves in XSLT 1.0 looks awfully complex (it requires some exslt math and strings functions -which needs some changes in the Windows build to include and link the exslt dll- and a path parser template).
 
|- style="border: 1px solid #999;"
! scope=row |Images
|
|Embedded images (base64).Preserve ratio.
 
|- style="border: 1px solid #999;"
! scope=row |Other
|Limited support for layers blend mode (screen and lighten add clipping).
|Object title and description.<br/>em, ex and % units (FXG only knows pixel values).<br/>No RDF and metadata support.<br/>DOCTYPE (crashes the XSLT conversion).
|}
 
=== Detailed tests ===
(from the official SVG1.1 test suite at http://www.w3.org/Graphics/SVG/WG/wiki/Test_Suite_Overview)
(from the official SVG1.1 test suite at http://www.w3.org/Graphics/SVG/WG/wiki/Test_Suite_Overview)
=== Colors ===
==== Colors ====
*color-prop-01-b - CurrentColor value not supported
*color-prop-01-b - CurrentColor value not supported
*color-prop-03-t - Ok (except polygons, but unrelated to the color test)
*color-prop-03-t - Ok (except polygons, but unrelated to the color test)


=== coords ===
==== coords ====
*coords-coord-01-t - Ok.
*coords-coord-01-t - Ok.
*coords-coord-02-t - Ok.
*coords-coord-02-t - Ok.
Line 93: Line 105:
*coords-viewattr-03-b - Viewbox not implemented.
*coords-viewattr-03-b - Viewbox not implemented.


=== Filters ===
==== Filters ====
*filters-gauss-01-b - Blurs work, but not rendered exactly as with SVG (blur bounding box not supported).
*filters-gauss-01-b - Blurs work, but not rendered exactly as with SVG (blur bounding box not supported).


=== Masking ===
==== Masking ====
*masking-mask-01-b - Ok (except font issue).
*masking-mask-01-b - Ok (except font issue).
*masking-opacity-01-b - Ok.
*masking-opacity-01-b - Ok.
Line 104: Line 116:
*masking-path-04-b - Clip with text doesn't work (but no compile error).
*masking-path-04-b - Clip with text doesn't work (but no compile error).


=== Painting ===
==== Painting ====
*painting-fill-01-t - Ok.
*painting-fill-01-t - Ok.
*painting-fill-02-t - CurrentColor value not supported.
*painting-fill-02-t - CurrentColor value not supported.
Line 117: Line 129:
*painting-stroke-07-t - Miter limit differs from SVG.
*painting-stroke-07-t - Miter limit differs from SVG.


=== Path ===
==== Path ====
*paths-data-01-t - Ok.
*paths-data-01-t - Ok.
*paths-data-02-t - Ok.
*paths-data-02-t - Ok.
Line 132: Line 144:
*paths-data-15-t - Ok.
*paths-data-15-t - Ok.


=== Pserver ===
==== Pserver ====
*pservers-grad-01-b - Ok (except gradient bbox).
*pservers-grad-01-b - Ok (except gradient bbox).
*pservers-grad-02-b - Partialy fails (radial gradient not fully supported).
*pservers-grad-02-b - Partialy fails (radial gradient not fully supported).
Line 151: Line 163:
*pservers-grad-19-b - inherit value not supported.
*pservers-grad-19-b - inherit value not supported.


=== Render ===
==== Render ====
*render-elems-01-t - Ok.
*render-elems-01-t - Ok.
*render-elems-02-t - Ok.
*render-elems-02-t - Ok.
Line 158: Line 170:
*render-groups-03-t - Ok (except glyphs).
*render-groups-03-t - Ok (except glyphs).


=== Shapes ===
==== Shapes ====
*shapes-circle-01-t- Ok.
*shapes-circle-01-t- Ok.
*shapes-circle-02-t - Ok.
*shapes-circle-02-t - Ok.
Line 170: Line 182:
*shapes-rect-02-t - Stroke still shown when H or W is 0.
*shapes-rect-02-t - Stroke still shown when H or W is 0.


=== Struct ===
==== Struct ====
*struct-defs-01-t - Ok.
*struct-defs-01-t - Ok.
*struct-frags-01-t - Ok.
*struct-frags-01-t - Ok.
Line 181: Line 193:
*struct-image-06-t - PreserveRation not supported.
*struct-image-06-t - PreserveRation not supported.


=== Text ===
==== Text ====
*text-align-01-b - Text-anchor not supported.
*text-align-01-b - Text-anchor not supported.
*text-align-02-b - sub and super values reduce the font size.
*text-align-02-b - sub and super values reduce the font size.
Line 211: Line 223:
*text-ws-02-t - Some xml:space="preserve" issues.
*text-ws-02-t - Some xml:space="preserve" issues.


=== Other tests ===
==== Other tests ====
(from the scour trunk: http://bazaar.launchpad.net/~scouring/scour/trunk/files/head%3A/fulltests/)
(from the scour trunk: http://bazaar.launchpad.net/~scouring/scour/trunk/files/head%3A/fulltests/)
*acid - Ok.
*acid - Ok.

Latest revision as of 13:23, 18 January 2011

Summary

The goal of this extension is to provide an FXG format export from the File>Save AS dialog. Since Adobe has abandoned SVG support in its Flash applications, Flash developer need a way to create their drawings with Inkscape.

Release Note

Initial XSLT file done. Initial unit and global tests done.

Specification

Design

This export extension uses the XSLT extension system (already used by XAML export).

Discussion

Implementation

TODO

  • More tests.
  • Implement workarounds for gradients limitations (needs exslt). Radial gradient orientation already implemented with exslt math function, but doesn't work with Inkcape currently (works with xsltproc).
  • The elliptical arc issue has an easy workaround, but it would be great to implement an arc to curve convertor (see https://github.com/DmitryBaranovskiy/raphael/raw/master/raphael.js for ideas, and http://www.exslt.org/math/index.html for exslt math functions).
  • Implement markers support. Should be feasible by passing the object's style attributes to the marker.
  • Improve blend mode (screen and lighten add clipping). See if it's possible to use normal blend filters
  • Implement some of the FXG improvements to the XAML export.

Known limitations

Some SVG features are not are partially supported by FXG. When possible, a workaround has been implemented in the export filter to render the missing features. Some elements that can't be created with Inkscape are not supported.

Partial support Not supported
Root level and groups Limited support for nested SVG elements (the first one is converted to Graphics and the others to Groups). Viewbox.
Defs Limited support for switch (always pass). Use.
Markers.
Patterns.
Symbols.
Transforms Skew, multiple values rotation (only the first one is converted).
Filters Support limited to blurs.
Gradients and color Gradient positioning, shaping and transformation (they are currently centered and restricted to the object bounding box).
CurrentColor.
Fill colors with both an url and a rgb value.
Stroke Mitterlimit doesn't give the same result. Dasharrays and dashoffset.
Butt linecap.
Clip and mask clipPathUnits="objectBoundingBox" and maskUnits="objectBoundingBox".
Clipping and masking with text (workaround: convert text to path).
Text Text rotation (0, 90, 180 and 270 degrees only) -> not implemented.
Font weight (normal and bold only) -> values under 500 are considered normal, the others bold.
Whitespace handling, issues with xml:whitespace='preserve'.
Text frames (only works with rectangles, and flowRegion transform not supported).
Generic fonts (workaround: Sans font is converted to Arial).
Embedded fonts (in defs).
Character rotation.
Character positioning (x and y).
Text span (from tspan or flowSpan) positioning.
Text-anchor.
Text stroke.

General workaround for text: convert everything to path before exporting will resolve most issues.

Shapes Polygons.
Polylines.
Elliptical arc curve path commands (workaround: convert ellipse and circle to path first). Converting arcs to curves in XSLT 1.0 looks awfully complex (it requires some exslt math and strings functions -which needs some changes in the Windows build to include and link the exslt dll- and a path parser template).
Images Embedded images (base64).Preserve ratio.
Other Limited support for layers blend mode (screen and lighten add clipping). Object title and description.
em, ex and % units (FXG only knows pixel values).
No RDF and metadata support.
DOCTYPE (crashes the XSLT conversion).

Detailed tests

(from the official SVG1.1 test suite at http://www.w3.org/Graphics/SVG/WG/wiki/Test_Suite_Overview)

Colors

  • color-prop-01-b - CurrentColor value not supported
  • color-prop-03-t - Ok (except polygons, but unrelated to the color test)

coords

  • coords-coord-01-t - Ok.
  • coords-coord-02-t - Ok.
  • coords-trans-01-b - Skew not supported.
  • coords-trans-02-t - Ok.
  • coords-trans-03-t - Skew not supported.
  • coords-trans-04-t - Ok.
  • coords-trans-05-t - Ok.
  • coords-trans-06-t - Ok.
  • coords-units-01-b - Gradients transformation and positionning not supported (Full convertion to FXG would require some math).
  • coords-units-02-b - % positionning not supported.
  • coords-units-03-b - em, ex and % not implemented.
  • coords-viewattr-03-b - Viewbox not implemented.

Filters

  • filters-gauss-01-b - Blurs work, but not rendered exactly as with SVG (blur bounding box not supported).

Masking

  • masking-mask-01-b - Ok (except font issue).
  • masking-opacity-01-b - Ok.
  • masking-path-01-b - Ok.
  • masking-path-02-b - clipPathUnits="objectBoundingBox" and *maskUnits="objectBoundingBox" not supported.
  • masking-path-03-b - Viewbox not supported.
  • masking-path-04-b - Clip with text doesn't work (but no compile error).

Painting

  • painting-fill-01-t - Ok.
  • painting-fill-02-t - CurrentColor value not supported.
  • painting-fill-03-t - Miter limit differs from SVG.
  • painting-fill-04-t - Ok.
  • painting-fill-05-t - Ok.
  • painting-render-01-b - Ok.
  • painting-stroke-01-t - Ok.
  • painting-stroke-02-t - Ok.
  • painting-stroke-03-t - Ok.
  • painting-stroke-04-t - Dash-array and dash-offset not supported.
  • painting-stroke-07-t - Miter limit differs from SVG.

Path

  • paths-data-01-t - Ok.
  • paths-data-02-t - Ok.
  • paths-data-04-t - Ok.
  • paths-data-05-t - Ok.
  • paths-data-06-t - Ok.
  • paths-data-07-t - Ok.
  • paths-data-08-t - Ok.
  • paths-data-09-t - Ok
  • paths-data-10-t - Partialy fails (with Open, join=round and cap=butt).
  • paths-data-12-t - Ok.
  • paths-data-13-t - Ok.
  • paths-data-14-t - Ok.
  • paths-data-15-t - Ok.

Pserver

  • pservers-grad-01-b - Ok (except gradient bbox).
  • pservers-grad-02-b - Partialy fails (radial gradient not fully supported).
  • pservers-grad-03-b - Patterns not supported.
  • pservers-grad-04-b - Partialy fails (gradients not fully supported). Gradients color stops ok.
  • pservers-grad-05-b - Partialy fails (gradients not fully supported). Gradients color stops and opacity ok.
  • pservers-grad-06-b - Fails (gradient positioning and tranformation are very different in FXG).
  • pservers-grad-07-b - Ok (except gradient bbox).
  • pservers-grad-08-b - Gradient on text not supported.
  • pservers-grad-09-b - Gradient units not supported.
  • pservers-grad-10-b - Ok (but gradient bbox not...).
  • pservers-grad-11-b - Gradients not fully supported, gradient on text not supported.
  • pservers-grad-12-b - Gradient bbox not supported.
  • pservers-grad-13-b -> 15-b - Gradients not fully supported.
  • pservers-grad-16-b - Ok.
  • pservers-grad-17-b - Multiple values rotation not supported.
  • pservers-grad-18-b - inherit value not supported.
  • pservers-grad-19-b - inherit value not supported.

Render

  • render-elems-01-t - Ok.
  • render-elems-02-t - Ok.
  • render-elems-03-t - !ENTITY support not implemented.
  • render-elems-06-t (and following) - Glyphs (defs) support not implemented.
  • render-groups-03-t - Ok (except glyphs).

Shapes

  • shapes-circle-01-t- Ok.
  • shapes-circle-02-t - Ok.
  • shapes-ellipse-01-t - Ok.
  • shapes-ellipse-02-t - Stroke still shown when H or W is 0.
  • shapes-intro-01-t - Stroke still shown when H or W is 0; Test position.
  • shapes-line-01-t - Ok.
  • shapes-polygon-01-t - Not supported.
  • shapes-polyline-01-t - Not supported.
  • shapes-rect-01-t - Ok.
  • shapes-rect-02-t - Stroke still shown when H or W is 0.

Struct

  • struct-defs-01-t - Ok.
  • struct-frags-01-t - Ok.
  • struct-frags-02-t - Viewbox not supported.
  • struct-group-01-t - Ok.
  • struct-group-02-b - Multiple svg elements and viewbox not implemented.
  • struct-group-03-t - Use not implemented in Inkscape (but could be changed into Library element in FXG).
  • struct-image-01-t - Ok.
  • struct-image-04-t - Image embedding not supported.
  • struct-image-06-t - PreserveRation not supported.

Text

  • text-align-01-b - Text-anchor not supported.
  • text-align-02-b - sub and super values reduce the font size.
  • text-align-03-b - Text-anchor and span element positioning not supported.
  • text-align-04-b - Text-anchor and span element positioning not supported.
  • text-align-05-b - Text-anchor not supported, and ugly hack to make writing-mode work as expected (textRotation attribute added manualy).
  • text-align-06-b - Text-anchor not supported, and ugly hack to make writing-mode work as expected (textRotation attribute added manualy).
  • text-align-08-b - SVG fonts not supported.
  • text-deco-01-b - Ok (except text strokes, not supported).
  • text-fonts-01-t - Generic fonts not supported.
  • text-fonts-02-t - Only supports Normal and Bold (values mapped).
  • text-fonts-03-t - Fonts from defs not supported.
  • text-intro-01-t - Looks good (Chinese and Japanese not tested).
  • text-intro-02-b - Text direction doesn't work as expected.
  • text-intro-03-b - Glyph orientation not implemented.
  • text-intro-04-t - Looks good (Chinese and Japanese not tested).
  • text-intro-05-t - Text-anchor not supported.
  • text-path-01-b - Text on path not supported.
  • text-spacing-01-b - Letter and word spacing not supported.
  • text-text-01-b - textLength and LengthAdjust not supported.
  • text-text-03-b - Ok.
  • text-text-04-t to text-text-06-t - Text-anchor not supported; multiple x and y values not supported.
  • text-text-07-t - Text rotation not supported.
  • text-text-08-b - Text stroke (and thus text stroke opacity) not supported.
  • text-tref-01-b - tref not supported.
  • text-tselect-01-b - span positioning not supported.
  • text-tspan-01-b - span positioning not supported.
  • text-ws-01-t - Ok.
  • text-ws-02-t - Some xml:space="preserve" issues.

Other tests

(from the scour trunk: http://bazaar.launchpad.net/~scouring/scour/trunk/files/head%3A/fulltests/)

  • acid - Ok.
  • appartment - Partial (gradients limitations and flowRegion transform not supported).
  • boom - Ok.
  • cgmail - elliptical arc curve commands not supported; almost ok after *convertion (gradients limitations).
  • Degri_Energy_Saving_Lightbulb - elliptical arc curve commands not supported; almost ok after convertion (gradients limitations).
  • dragonfly - Ok.
  • gimp - elliptical arc curve commands not supported; almost ok after convertion (gradients limitations).
  • git-cola-icons - partial (use not supported and gradients limitations).
  • grapes - Patterns and polygons not supported.
  • GusEinstein_Angel - Partial (gradients limitations).
  • inkscape - elliptical arc curve commands not supported; almost ok after convertion (gradients limitations).
  • lightning - DOCTYPE not supported, fill colors with both an url and a rgb value not supported.
  • manchester - Nested matrix doesn't work as expected.
  • News_Papers - Partial (gradients limitations).