Difference between revisions of "SVG"
(new) |
|||
(6 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
− | < [[Graphics]] | [[Using_Graphics]] | [[MetaPost]] | [[File_Formats]] > | + | < [[Graphics]] | [[Using_Graphics]] | [[MetaPost]] | [[File_Formats]] | [[Inkscape]] > |
− | SVG (Scalable Vector Graphics, a [[XML]] based format) | + | SVG (Scalable Vector Graphics, a [[XML]] based format) can be converted to the PDF format at runtime by ConTeXt MkIV (LuaTeX), provided you have Inkscape installed as below. |
− | There is a workaround, though, using | + | Supported vector graphics formats of MkII/MKIV are [[MetaPost]] (and [[MetaFun]]). |
+ | |||
+ | There is a workaround, though, using Inkscape to convert SVG to PDF. Inkscape must be installed and callable (i.e. in your PATH): | ||
<texcode> | <texcode> | ||
− | + | \setupexternalfigures[location=local,directory=.,conversion=pdf] % lowres,prefix=lowres/] | |
− | |||
− | \setupexternalfigures[location=local,directory=.,conversion=pdf] % | ||
− | lowres,prefix=lowres/] | ||
\starttext | \starttext | ||
Line 17: | Line 16: | ||
\stoptext | \stoptext | ||
</texcode> | </texcode> | ||
− | ( | + | |
+ | == ConTeXt and Inkscape == | ||
+ | |||
+ | Inkscape changed its command line interface in version 1.0. | ||
+ | As a consequence, if you use an old version of ConTeXt and you have Inkscape 1.0 or newer installed, the conversion from SVG to PDF fails. | ||
+ | |||
+ | Newer versions of ConTeXt (since May 7th, 2020) will detect Inkscape's version and manage to convert SVG to PDF anyway. | ||
+ | But it's a temporary workaround, until version 1.0 of Inkscape gets widespread, because version detection has a performance cost. | ||
+ | |||
+ | == LMTX and SVG == | ||
+ | |||
+ | LMTX has a direct support for SVG. It uses MetaPost (MetaFun) to process SVG, so you don't need an external tool like Inkscape. | ||
+ | |||
+ | Using MetaPost to process SVG opens many opportunities to work on it. | ||
+ | |||
+ | Anyway it's a work in progress, not every feature (or inconsistency) of SVG is supported, though many are. | ||
+ | Just try and ask in the mailing list. | ||
+ | |||
+ | You can find more in the docs that come with LMTX distribution, in particular in svg-lmtx.pdf and luametafun.pdf. | ||
==General information on SVG:== | ==General information on SVG:== | ||
Line 36: | Line 53: | ||
===Libraries and Tools=== | ===Libraries and Tools=== | ||
− | * [http://inkscape.org/ | + | * [http://inkscape.org/ Inkscape vector graphics editor] |
* [http://xmlgraphics.apache.org/batik/ Batik Java SVG Toolkit] (by Apache) | * [http://xmlgraphics.apache.org/batik/ Batik Java SVG Toolkit] (by Apache) | ||
* [http://cairographics.org Cairo graphics library] | * [http://cairographics.org Cairo graphics library] |
Revision as of 10:13, 7 May 2020
< Graphics | Using_Graphics | MetaPost | File_Formats | Inkscape >
SVG (Scalable Vector Graphics, a XML based format) can be converted to the PDF format at runtime by ConTeXt MkIV (LuaTeX), provided you have Inkscape installed as below.
Supported vector graphics formats of MkII/MKIV are MetaPost (and MetaFun).
There is a workaround, though, using Inkscape to convert SVG to PDF. Inkscape must be installed and callable (i.e. in your PATH):
\setupexternalfigures[location=local,directory=.,conversion=pdf] % lowres,prefix=lowres/] \starttext \externalfigure[svg/sample.svg][frame=on] \stoptext
Contents
ConTeXt and Inkscape
Inkscape changed its command line interface in version 1.0. As a consequence, if you use an old version of ConTeXt and you have Inkscape 1.0 or newer installed, the conversion from SVG to PDF fails.
Newer versions of ConTeXt (since May 7th, 2020) will detect Inkscape's version and manage to convert SVG to PDF anyway. But it's a temporary workaround, until version 1.0 of Inkscape gets widespread, because version detection has a performance cost.
LMTX and SVG
LMTX has a direct support for SVG. It uses MetaPost (MetaFun) to process SVG, so you don't need an external tool like Inkscape.
Using MetaPost to process SVG opens many opportunities to work on it.
Anyway it's a work in progress, not every feature (or inconsistency) of SVG is supported, though many are. Just try and ask in the mailing list.
You can find more in the docs that come with LMTX distribution, in particular in svg-lmtx.pdf and luametafun.pdf.
General information on SVG:
Specs and References
- SVG Standard Specs (by W3C)
- SVG 1.1 reference (by Systinet)
Tutorials and Examples
- Basic SVG: Getting started (by Adobe)
- SVG - learning by coding (by Thomas Meinike)
- Scale a Vector (by Petra Kukofka; also in German)
- Learn SVG
- SVG Developer Knowledgebase (by Adobe)
Community
Libraries and Tools
- Inkscape vector graphics editor
- Batik Java SVG Toolkit (by Apache)
- Cairo graphics library
- samples and tools (by Jan Kollhof)