SVG support.

This commit is contained in:
sebd 2005-06-23 10:22:50 +00:00
parent f98a9f188a
commit a4472a4231
8 changed files with 347 additions and 1 deletions

20
config-svgtest.xml Normal file
View File

@ -0,0 +1,20 @@
<?xml version="1.0"?>
<configuration xmlns="http://www.entrouvert.org/namespaces/expression/0.0">
<pidFilePath>expression.pid</pidFilePath>
<module name="expression.modules.svg"/>
<!-- Uncomment this in order to enable the xquery_svg.xml test
<module name="expression.modules.dbxmldatabases">
<environment dbHome="db"/>
<container name="test.dbxml"/>
<container name="test2.dbxml"/>
</module>
-->
<virtualHost>
<documentRoot>vhosts/svgtest/</documentRoot>
<port>1997</port>
<serverName>localhost</serverName>
<title>SVG Test Site</title>
</virtualHost>
</configuration>

View File

@ -66,6 +66,7 @@ mimeTypes = {
".std": "application/vnd.sun.xml.draw.template",
".sti": "application/vnd.sun.xml.impress.template",
".stw": "application/vnd.sun.xml.writer.template",
".svg": "image/svg+xml",
".sxc": "application/vnd.sun.xml.calc",
".sxd": "application/vnd.sun.xml.draw",
".sxg": "application/vnd.sun.xml.writer.global",
@ -684,7 +685,7 @@ class StaticDataHolder(DataHolder):
class ImageHolder(StaticDataHolder):
mimeTypes = ("image/gif", "image/jpeg", "image/png")
mimeTypes = ("image/gif", "image/jpeg", "image/png", "image/svg+xml")
def generateXml(self, layout):
import html

View File

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<configuration xmlns="http://www.entrouvert.org/namespaces/expression/0.0">
<defaultMode>index</defaultMode>
<mode name="source"><users commands="ACCESS GET PUT"><everybody/></users></mode>
<mode name="styled"><users commands="ACCESS GET"><everybody/></users></mode>
<mode name="unstyled"><users commands="ACCESS GET"><everybody/></users></mode>
<users commands="GET OPTIONS PROPFIND PUT"><everybody/></users>
</configuration>

118
vhosts/svgtest/image.svg Normal file
View File

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
id="svg922"
sodipodi:version="0.32"
inkscape:version="0.39"
width="128.00000pt"
height="128.00000pt"
sodipodi:docname="about.svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:cc="http://web.resource.org/cc/"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:xlink="http://www.w3.org/1999/xlink"
sodipodi:docbase="/home/seb/cvs/amedes/images/icons">
<defs
id="defs924">
<linearGradient
id="linearGradient1583">
<stop
style="stop-color:#1f6924;stop-opacity:1.0000000;"
offset="0.0000000"
id="stop1584" />
<stop
style="stop-color:#fff;stop-opacity:1;"
offset="1"
id="stop1585" />
</linearGradient>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0000000"
inkscape:pageshadow="2"
inkscape:zoom="1.0000000"
inkscape:cx="92.000000"
inkscape:cy="63.314819"
inkscape:window-width="750"
inkscape:window-height="538"
gridspacingy="8.0000000pt"
gridspacingx="8.0000000pt"
gridoriginy="0.0000000pt"
gridoriginx="0.0000000pt"
showgrid="true"
inkscape:grid-bbox="true"
inkscape:grid-points="true"
gridtolerance="5.0000000px"
inkscape:guide-bbox="false"
inkscape:guide-points="false"
inkscape:window-x="44"
inkscape:window-y="46" />
<metadata
id="metadata925">
<rdf:RDF
id="RDF926">
<cc:Work
rdf:about=""
id="Work927">
<dc:format
id="format928">image/svg+xml</dc:format>
<dc:type
id="type930"
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<cc:license
id="license931"
rdf:resource="http://creativecommons.org/licenses/by/2.0/" />
<dc:title
id="title946">Amedes</dc:title>
<dc:creator
id="creator948">
<cc:Agent
id="Agent949">
<dc:title
id="title950">Les Développements Durables</dc:title>
</cc:Agent>
</dc:creator>
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by/2.0/"
id="License939">
<cc:permits
rdf:resource="http://web.resource.org/cc/Reproduction"
id="permits940" />
<cc:permits
rdf:resource="http://web.resource.org/cc/Distribution"
id="permits941" />
<cc:requires
rdf:resource="http://web.resource.org/cc/Notice"
id="requires942" />
<cc:requires
rdf:resource="http://web.resource.org/cc/Attribution"
id="requires943" />
<cc:prohibits
rdf:resource="http://web.resource.org/cc/CommercialUse"
id="prohibits944" />
<cc:permits
rdf:resource="http://web.resource.org/cc/DerivativeWorks"
id="permits945" />
</cc:License>
</rdf:RDF>
</metadata>
<text
xml:space="preserve"
style="font-size:12.000000;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#f7b4bb;fill-opacity:1.0000000;fill-rule:nonzero;stroke:#000000;stroke-width:0.27832034;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans;text-anchor:middle;writing-mode:lr;"
x="4.7659397"
y="9.0498991"
id="text942"
transform="scale(17.40351,17.40351)"
sodipodi:linespacing="100%"><tspan
id="tspan943">?</tspan></text>
</svg>

After

Width:  |  Height:  |  Size: 4.0 KiB

118
vhosts/svgtest/image.xml Normal file
View File

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
id="svg922"
sodipodi:version="0.32"
inkscape:version="0.39"
width="128.00000pt"
height="128.00000pt"
sodipodi:docname="about.svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:cc="http://web.resource.org/cc/"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:xlink="http://www.w3.org/1999/xlink"
sodipodi:docbase="/home/seb/cvs/amedes/images/icons">
<defs
id="defs924">
<linearGradient
id="linearGradient1583">
<stop
style="stop-color:#1f6924;stop-opacity:1.0000000;"
offset="0.0000000"
id="stop1584" />
<stop
style="stop-color:#fff;stop-opacity:1;"
offset="1"
id="stop1585" />
</linearGradient>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0000000"
inkscape:pageshadow="2"
inkscape:zoom="1.0000000"
inkscape:cx="92.000000"
inkscape:cy="63.314819"
inkscape:window-width="750"
inkscape:window-height="538"
gridspacingy="8.0000000pt"
gridspacingx="8.0000000pt"
gridoriginy="0.0000000pt"
gridoriginx="0.0000000pt"
showgrid="true"
inkscape:grid-bbox="true"
inkscape:grid-points="true"
gridtolerance="5.0000000px"
inkscape:guide-bbox="false"
inkscape:guide-points="false"
inkscape:window-x="44"
inkscape:window-y="46" />
<metadata
id="metadata925">
<rdf:RDF
id="RDF926">
<cc:Work
rdf:about=""
id="Work927">
<dc:format
id="format928">image/svg+xml</dc:format>
<dc:type
id="type930"
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<cc:license
id="license931"
rdf:resource="http://creativecommons.org/licenses/by/2.0/" />
<dc:title
id="title946">Amedes</dc:title>
<dc:creator
id="creator948">
<cc:Agent
id="Agent949">
<dc:title
id="title950">Les Développements Durables</dc:title>
</cc:Agent>
</dc:creator>
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by/2.0/"
id="License939">
<cc:permits
rdf:resource="http://web.resource.org/cc/Reproduction"
id="permits940" />
<cc:permits
rdf:resource="http://web.resource.org/cc/Distribution"
id="permits941" />
<cc:requires
rdf:resource="http://web.resource.org/cc/Notice"
id="requires942" />
<cc:requires
rdf:resource="http://web.resource.org/cc/Attribution"
id="requires943" />
<cc:prohibits
rdf:resource="http://web.resource.org/cc/CommercialUse"
id="prohibits944" />
<cc:permits
rdf:resource="http://web.resource.org/cc/DerivativeWorks"
id="permits945" />
</cc:License>
</rdf:RDF>
</metadata>
<text
xml:space="preserve"
style="font-size:12.000000;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#f7b4bb;fill-opacity:1.0000000;fill-rule:nonzero;stroke:#000000;stroke-width:0.27832034;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans;text-anchor:middle;writing-mode:lr;"
x="4.7659397"
y="9.0498991"
id="text942"
transform="scale(17.40351,17.40351)"
sodipodi:linespacing="100%"><tspan
id="tspan943">?</tspan></text>
</svg>

After

Width:  |  Height:  |  Size: 4.0 KiB

26
vhosts/svgtest/index.html Normal file
View File

@ -0,0 +1,26 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Expression SVG Test Suite</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<h1>Expression SVG Test Suite</h1>
<h2>Pre-requisites</h2>
<p>Package svg2png must be installed for this to work.
<a href="http://cairographics.org/">Unofficial Debian packages</a> are available.
You can add <tt>deb http://cairographics.org/packages/debian/ unstable/</tt> to your source.list.</p>
<h2>Tests</h2>
<ul>
<li><a href="image.svg">image.svg</a>
Only for SVG-enabled web browsers.</li>
<li><a href="image.xml">image.xml</a>
Same, but with a different file extension, which makes Expression generate the SVG file as PNG.</li>
<li><a href="xhtml_svg.xml">xhtml_svg.xml</a>
XHTML with embedded SVG (SVG-enabled browsers only).</li>
<li><a href="xquery_svg.xml">xquery_svg.xml</a>
An XQuery that generates SVG contents (this will only work with DBXML support, see config-svgtest.xml).</li>
</ul>
</body>
</html>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>XHTML with embedded SVG</title></head>
<body>
<h1>XHTML with embedded SVG</h1>
<p>First, an external SVG image :</p>
<object type="image/svg+xml" data="image.svg" width="200px" height="300"/>
<p>Then, the same, but embedded in this page (does not work in Mozilla nor in Konqueror yet) :</p>
<svg xmlns="http://www.w3.org/2000/svg" style="width:200px; height:300px">
<text
style="font-size:12.000000;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#f7b4bb;fill-opacity:1.0000000;fill-rule:nonzero;stroke:#000000;stroke-width:0.27832034;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans;text-anchor:middle;writing-mode:lr;"
x="4.7659397"
y="9.0498991"
transform="scale(17.40351,17.40351)"
sodipodi:linespacing="100%"><tspan
id="tspan943">?</tspan></text>
</svg>
<p>That's it.</p>
</body>
</html>

View File

@ -0,0 +1,31 @@
<?xml version="1.0"?>
<yep:xquery xmlns:yep="http://www.entrouvert.org/namespaces/expression/0.0">
<svg width="512pt" height="512pt" xmlns="http://www.w3.org/2000/svg">
<text y="16" font-size="16">This SVG document is the result of a DB XML database query.</text>
{
for $t at $c in collection("test.dbxml")/*/*/text()
return <text
xml:space="preserve"
style="font-size:64;
font-style:normal;
font-variant:normal;
font-weight:bold;
font-stretch:normal;
fill:#f7b4bb;
fill-opacity:1;
fill-rule:nonzero;
stroke:#000000;
stroke-width:0.3;
stroke-linecap:round;
stroke-linejoin:round;
stroke-miterlimit:4;
stroke-opacity:1;
font-family:Bitstream Vera Sans;
text-anchor:left;
writing-mode:lr;"
x="0"
y="{16+64 * $c}"
>{$t}</text>
}
</svg>
</yep:xquery>