SpecFXGExport
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).