fonttools/Documentation/robofabDocs/robofab.pens.svgPen.html
Erik van Blokland 3646055ea2 initial import
git-svn-id: http://svn.robofab.com/trunk@1 b5fa9d6c-a76f-4ffd-b3cb-f825fc41095c
2008-01-07 17:40:34 +00:00

221 lines
13 KiB
HTML

<!doctype html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module robofab.pens.svgPen</title>
</head><body bgcolor="#f0f0f8">
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="robofab.html"><font color="#ffffff">robofab</font></a>.<a href="robofab.pens.html"><font color="#ffffff">pens</font></a>.svgPen</strong></big></big> (version 0.1)</font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/code/projects/robofab/Lib/robofab/pens/svgPen.py">/code/projects/robofab/Lib/robofab/pens/svgPen.py</a></font></td></tr></table>
<p></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#fffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="os.html">os</a><br>
</td><td width="25%" valign=top><a href="re.html">re</a><br>
</td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="fontTools.pens.basePen.html#BasePen">fontTools.pens.basePen.BasePen</a>(<a href="fontTools.pens.basePen.html#AbstractPen">fontTools.pens.basePen.AbstractPen</a>)
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="robofab.pens.svgPen.html#FabToSVGPen">FabToSVGPen</a>
</font></dt></dl>
</dd>
<dt><font face="helvetica, arial"><a href="robofab.pens.svgPen.html#Description">Description</a>
</font></dt><dt><font face="helvetica, arial"><a href="robofab.pens.svgPen.html#ExtractGlyphFromSVG">ExtractGlyphFromSVG</a>
</font></dt><dt><font face="helvetica, arial"><a href="robofab.pens.svgPen.html#Line">Line</a>
</font></dt><dt><font face="helvetica, arial"><a href="robofab.pens.svgPen.html#SVGDocument">SVGDocument</a>
</font></dt><dt><font face="helvetica, arial"><a href="robofab.pens.svgPen.html#SVGPath">SVGPath</a>
</font></dt></dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="Description">class <strong>Description</strong></a></font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Simple&nbsp;wrapper&nbsp;for&nbsp;SVG&nbsp;descriptions.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Description-__init__"><strong>__init__</strong></a>(self, text)</dt></dl>
<dl><dt><a name="Description-write"><strong>write</strong></a>(self)</dt></dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="ExtractGlyphFromSVG">class <strong>ExtractGlyphFromSVG</strong></a></font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Extract&nbsp;glyph&nbsp;data&nbsp;from&nbsp;a&nbsp;SVG&nbsp;file.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="ExtractGlyphFromSVG-__init__"><strong>__init__</strong></a>(self, path, glyph)</dt></dl>
<dl><dt><a name="ExtractGlyphFromSVG-drawData"><strong>drawData</strong></a>(self)</dt></dl>
<dl><dt><a name="ExtractGlyphFromSVG-getGlyph"><strong>getGlyph</strong></a>(self)</dt></dl>
<dl><dt><a name="ExtractGlyphFromSVG-read"><strong>read</strong></a>(self, aFile)</dt></dl>
<dl><dt><a name="ExtractGlyphFromSVG-readPath"><strong>readPath</strong></a>(self, data)</dt></dl>
<dl><dt><a name="ExtractGlyphFromSVG-readSVGTree"><strong>readSVGTree</strong></a>(self, tree)</dt></dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="FabToSVGPen">class <strong>FabToSVGPen</strong></a>(<a href="fontTools.pens.basePen.html#BasePen">fontTools.pens.basePen.BasePen</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>A&nbsp;pen&nbsp;to&nbsp;create&nbsp;and&nbsp;draw&nbsp;the&nbsp;glyph&nbsp;as&nbsp;a&nbsp;path&nbsp;object&nbsp;into&nbsp;a&nbsp;SVG&nbsp;document.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="robofab.pens.svgPen.html#FabToSVGPen">FabToSVGPen</a></dd>
<dd><a href="fontTools.pens.basePen.html#BasePen">fontTools.pens.basePen.BasePen</a></dd>
<dd><a href="fontTools.pens.basePen.html#AbstractPen">fontTools.pens.basePen.AbstractPen</a></dd>
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="FabToSVGPen-__init__"><strong>__init__</strong></a>(self, glyphSet)</dt></dl>
<dl><dt><a name="FabToSVGPen-drawProportions"><strong>drawProportions</strong></a>(self)</dt><dd><tt>Additional&nbsp;boundinbox,&nbsp;baseline,&nbsp;xheight&nbsp;as&nbsp;simple&nbsp;lines.</tt></dd></dl>
<dl><dt><a name="FabToSVGPen-setName"><strong>setName</strong></a>(self, name)</dt></dl>
<dl><dt><a name="FabToSVGPen-setParentPath"><strong>setParentPath</strong></a>(self, parentPath)</dt></dl>
<dl><dt><a name="FabToSVGPen-setUnicode"><strong>setUnicode</strong></a>(self, unicode)</dt></dl>
<dl><dt><a name="FabToSVGPen-setWidth"><strong>setWidth</strong></a>(self, width)</dt></dl>
<dl><dt><a name="FabToSVGPen-write"><strong>write</strong></a>(self, filePath<font color="#909090">=None</font>)</dt><dd><tt>Finally,&nbsp;make&nbsp;an&nbsp;SVG&nbsp;document,&nbsp;add&nbsp;the&nbsp;path&nbsp;and&nbsp;save&nbsp;to&nbsp;file.</tt></dd></dl>
<hr>
Methods inherited from <a href="fontTools.pens.basePen.html#BasePen">fontTools.pens.basePen.BasePen</a>:<br>
<dl><dt><a name="FabToSVGPen-addComponent"><strong>addComponent</strong></a>(self, glyphName, transformation)</dt><dd><tt>This&nbsp;default&nbsp;implementation&nbsp;simply&nbsp;transforms&nbsp;the&nbsp;points<br>
of&nbsp;the&nbsp;base&nbsp;glyph&nbsp;and&nbsp;draws&nbsp;it&nbsp;onto&nbsp;self.</tt></dd></dl>
<dl><dt><a name="FabToSVGPen-closePath"><strong>closePath</strong></a>(self)</dt></dl>
<dl><dt><a name="FabToSVGPen-curveTo"><strong>curveTo</strong></a>(self, *points)</dt></dl>
<dl><dt><a name="FabToSVGPen-endPath"><strong>endPath</strong></a>(self)</dt></dl>
<dl><dt><a name="FabToSVGPen-lineTo"><strong>lineTo</strong></a>(self, pt)</dt></dl>
<dl><dt><a name="FabToSVGPen-moveTo"><strong>moveTo</strong></a>(self, pt)</dt></dl>
<dl><dt><a name="FabToSVGPen-qCurveTo"><strong>qCurveTo</strong></a>(self, *points)</dt></dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="Line">class <strong>Line</strong></a></font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>&lt;line&nbsp;x1="100"&nbsp;y1="300"&nbsp;x2="300"&nbsp;y2="100"&nbsp;stroke-width="5"&nbsp;&nbsp;/&gt;<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Line-__init__"><strong>__init__</strong></a>(self, (x1, y1), (x2, y2), strokeWidth<font color="#909090">=1</font>, strokeColor<font color="#909090">=None</font>)</dt></dl>
<dl><dt><a name="Line-write"><strong>write</strong></a>(self)</dt></dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="SVGDocument">class <strong>SVGDocument</strong></a></font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Very&nbsp;basic&nbsp;container&nbsp;for&nbsp;SVG&nbsp;data.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="SVGDocument-__init__"><strong>__init__</strong></a>(self, (width, height), units<font color="#909090">='pt'</font>)</dt></dl>
<dl><dt><a name="SVGDocument-add"><strong>add</strong></a>(self, item)</dt></dl>
<dl><dt><a name="SVGDocument-comment"><strong>comment</strong></a>(self, text)</dt></dl>
<dl><dt><a name="SVGDocument-save"><strong>save</strong></a>(self, path<font color="#909090">=None</font>)</dt></dl>
<dl><dt><a name="SVGDocument-scale"><strong>scale</strong></a>(self, (sx, sy))</dt></dl>
<dl><dt><a name="SVGDocument-setStrokeColor"><strong>setStrokeColor</strong></a>(self, colorName)</dt></dl>
<dl><dt><a name="SVGDocument-translate"><strong>translate</strong></a>(self, (dx, dy))</dt></dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="SVGPath">class <strong>SVGPath</strong></a></font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Path&nbsp;object&nbsp;for&nbsp;SVG&nbsp;vector&nbsp;paths.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="SVGPath-__init__"><strong>__init__</strong></a>(self, fillColor<font color="#909090">=None</font>, strokeColor<font color="#909090">=None</font>, strokeWidth<font color="#909090">=None</font>)</dt></dl>
<dl><dt><a name="SVGPath-closePath"><strong>closePath</strong></a>(self)</dt></dl>
<dl><dt><a name="SVGPath-curveTo"><strong>curveTo</strong></a>(self, (x1, y1, x2, y2, x3, y3))</dt></dl>
<dl><dt><a name="SVGPath-lineTo"><strong>lineTo</strong></a>(self, (x, y))</dt></dl>
<dl><dt><a name="SVGPath-moveTo"><strong>moveTo</strong></a>(self, (x, y))</dt></dl>
<dl><dt><a name="SVGPath-qCurveTo"><strong>qCurveTo</strong></a>(self, (x1, y1, x2, y2))</dt></dl>
<dl><dt><a name="SVGPath-write"><strong>write</strong></a>(self)</dt><dd><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;path&nbsp;d="M200,300&nbsp;L400,50&nbsp;L600,300&nbsp;<br>
&nbsp;&nbsp;&nbsp;L800,550&nbsp;L1000,300"<br>
fill="none"&nbsp;stroke="#888888"&nbsp;stroke-width="2"&nbsp;/&gt;</tt></dd></dl>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
<tr><td bgcolor="#eeaa77"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl><dt><a name="-exportGlyphToSVG"><strong>exportGlyphToSVG</strong></a>(glyph, glyphSet, dir)</dt><dd><tt>Export&nbsp;a&nbsp;glyph&nbsp;to&nbsp;a&nbsp;properly&nbsp;named&nbsp;SVG&nbsp;file&nbsp;in&nbsp;the<br>
specified&nbsp;directory.</tt></dd></dl>
<dl><dt><a name="-importFontFromSVG"><strong>importFontFromSVG</strong></a>(dir, font)</dt><dd><tt>Import&nbsp;glyphs&nbsp;from&nbsp;all&nbsp;SVG&nbsp;files&nbsp;in&nbsp;dir.</tt></dd></dl>
<dl><dt><a name="-importGlyphFromSVG"><strong>importGlyphFromSVG</strong></a>(filePath)</dt><dd><tt>Import&nbsp;a&nbsp;single&nbsp;glyph&nbsp;from&nbsp;the&nbsp;SVG&nbsp;file&nbsp;at&nbsp;filePath.</tt></dd></dl>
<dl><dt><a name="-intfloat"><strong>intfloat</strong></a>(x)</dt><dd><tt>Return&nbsp;a&nbsp;value&nbsp;as&nbsp;a&nbsp;&nbsp;nice&nbsp;looking&nbsp;stringified&nbsp;int&nbsp;if&nbsp;possible,&nbsp;return&nbsp;stringified&nbsp;float&nbsp;otherwise.</tt></dd></dl>
<dl><dt><a name="-testExportImport"><strong>testExportImport</strong></a>(ufoPath, glyphName, dir)</dt></dl>
</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><strong>__version__</strong> = '0.1'<br>
<strong>cmdSearch</strong> = &lt;_sre.SRE_Pattern object at 0x1902000&gt;<br>
<strong>declaration</strong> = '&lt;svg width="%s%s" height="%s%s" viewBox="0 0 %s ..."http://www.w3.org/2000/svg" version="1.1"&gt;<font color="#c040c0">\n</font> '<br>
<strong>fabEndTag</strong> = '#robofab_glyph_end'<br>
<strong>fabNameTag</strong> = '#robofab_glyph_name:'<br>
<strong>fabParentPathTag</strong> = '#robofab_glyph_parent:'<br>
<strong>fabStartTag</strong> = '#robofab_glyph_start'<br>
<strong>fabUnicodeTag</strong> = '#robofab_glyph_unicode:'<br>
<strong>fabWidthTag</strong> = '#robofab_glyph_width:'<br>
<strong>footer</strong> = '&lt;/svg&gt;'<br>
<strong>header</strong> = '&lt;?xml version="1.0" standalone="no"?&gt;<font color="#c040c0">\n</font>&lt;!DOCTYPE ...ttp://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"&gt;'<br>
<strong>pathSearch</strong> = &lt;_sre.SRE_Pattern object at 0x1167e10&gt;</td></tr></table>
</body></html>