parent_line_spacing is a string instead of float
Using the Inkscape 1.0 version, the following error is returned:
Traceback (most recent call last):
File "hershey.py", line 1940, in <module>
Hershey().run()
File "D:\Program Files\Inkscape\share\inkscape\extensions\inkex\base.py", line 123, in run
self.save_raw(self.effect())
File "hershey.py", line 1922, in effect
self.recursively_traverse_svg(self.document.getroot(), self.doc_transform)
File "hershey.py", line 1309, in recursively_traverse_svg
self.recursively_traverse_svg(node, mat_new, vis)
File "hershey.py", line 1769, in recursively_traverse_svg
self.recursively_parse_text(node, node_info)
File "hershey.py", line 1219, in recursively_parse_text
self.line_number * parent_line_spacing * font_height_local
TypeError: can't multiply sequence by non-int of type 'float'
This is seemingly fixed by wrapping the parent_line_spacing
variable with float()
.
Reproducible with the following .svg:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
inkscape:version="1.0 (4035a4fb49, 2020-05-01)"
sodipodi:docname="businessasusual.svg"
id="svg110"
version="1.1"
fill="none"
viewBox="0 0 1123 794"
height="794"
width="1123">
<metadata
id="metadata116">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs114" />
<sodipodi:namedview
inkscape:current-layer="layer1"
inkscape:window-maximized="1"
inkscape:window-y="-11"
inkscape:window-x="-11"
inkscape:cy="397"
inkscape:cx="531.96837"
inkscape:zoom="1.252894"
showgrid="false"
id="namedview112"
inkscape:window-height="2066"
inkscape:window-width="3840"
inkscape:pageshadow="2"
inkscape:pageopacity="0"
guidetolerance="10"
gridtolerance="10"
objecttolerance="10"
borderopacity="1"
bordercolor="#666666"
pagecolor="#ffffff" />
<g
style="display:inline"
inkscape:label="1 Title Black"
id="layer1"
inkscape:groupmode="layer">
<text
id="1 Title black"
fill="#000000"
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:53.3333px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;letter-spacing:0em;white-space:pre;opacity:1;fill:#000000;"
font-family="Roboto"
font-size="50px"
font-weight="bold"
letter-spacing="0em"><tspan
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:53.33333333px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Bold';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;"
x="34.9571"
y="73.397903"
id="tspan6">Test Font</tspan></text>
</g>
</svg>
Edited by Jack