Package: inkscape
Version: 0.44-1
Followup-For: Bug #376558
attached is a patch which
a) uses better (still silly) svg parsing technique
b) does better tmp file creation
c) uses plot-svg pstoedit driver to produce svgs
d) does not use -output-dir with latex, but the solution is
*nix only =(
-- System Information:
Debian Release: testing/unstable
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.16-1-k7
Locale: LANG=ru_RU.KOI8-R, LC_CTYPE=ru_RU.KOI8-R (charmap=KOI8-R)
Versions of packages inkscape depends on:
ii libatk1.0-0 1.11.4-2 The ATK accessibility toolkit
ii libbonobo2-0 2.14.0-1 Bonobo CORBA interfaces library
ii libc6 2.3.6-15 GNU C Library: Shared libraries
ii libcairo2 1.2.0-2 The Cairo 2D vector graphics libra
ii libfontconfig1 2.3.2-7 generic font configuration library
ii libfreetype6 2.2.1-2 FreeType 2 font engine, shared lib
ii libgc1c2 1:6.6-2 conservative garbage collector for
ii libgcc1 1:4.1.1-7 GCC support library
ii libgconf2-4 2.14.0-1 GNOME configuration database syste
ii libglib2.0-0 2.10.3-2 The GLib library of C routines
ii libglibmm-2.4-1c2a 2.10.4-1 C++ wrapper for the GLib toolkit (
ii libgnomevfs2-0 2.14.2-1 GNOME virtual file-system (runtime
ii libgtk2.0-0 2.8.18-1 The GTK+ graphical user interface
ii libgtkmm-2.4-1c2a 1:2.8.8-1 C++ wrappers for GTK+ 2.4 (shared
ii liblcms1 1.15-1 Color management library
ii liborbit2 1:2.14.0-2 libraries for ORBit2 - a CORBA ORB
ii libpango1.0-0 1.12.3-1 Layout and rendering of internatio
ii libpng12-0 1.2.8rel-5.1 PNG library - runtime
ii libpopt0 1.10-2 lib for parsing cmdline parameters
ii libsigc++-2.0-0c2a 2.0.16-3 type-safe Signal Framework for C++
ii libstdc++6 4.1.1-7 The GNU Standard C++ Library v3
ii libx11-6 2:1.0.0-7 X11 client-side library
ii libxcursor1 1.1.5.2-5 X cursor management library
ii libxext6 1:1.0.0-4 X11 miscellaneous extension librar
ii libxfixes3 1:3.0.1.2-4 X11 miscellaneous 'fixes' extensio
ii libxft2 2.1.8.2-8 FreeType-based font drawing librar
ii libxi6 1:1.0.0-5 X11 Input extension library
ii libxinerama1 1:1.0.1-4 X11 Xinerama extension library
ii libxml2 2.6.26.dfsg-2 GNOME XML library
ii libxrandr2 2:1.1.0.2-4 X11 RandR extension library
ii libxrender1 1:0.9.0.2-4 X Rendering Extension client libra
ii libxslt1.1 1.1.17-2 XSLT processing library - runtime
ii zlib1g 1:1.2.3-12 compression library - runtime
Versions of packages inkscape recommends:
ii dia 0.95.0-4 Diagram editor
ii imagemagick 7:6.2.4.5.dfsg1-0.9 Image manipulation programs
ii libwmf-bin 0.2.8.3-3.1 Windows metafile conversion tools
ii perlmagick 7:6.2.4.5.dfsg1-0.9 A perl interface to the libMagick
ii pstoedit 3.44-1 PostScript and PDF files to editab
pn skencil <none> (no description available)
-- no debconf information
diff -urNBb inkscape-0.44.orig/share/extensions/eqtexsvg.py
inkscape-0.44/share/extensions/eqtexsvg.py
--- inkscape-0.44.orig/share/extensions/eqtexsvg.py 2006-07-06
23:11:01.000000000 +0700
+++ inkscape-0.44/share/extensions/eqtexsvg.py 2006-07-06 23:14:56.000000000
+0700
@@ -27,7 +27,7 @@
"""
-import inkex, os, tempfile
+import inkex, os, tempfile, xml.dom.minidom
def create_equation_tex(filename, equation):
tex = open(filename, 'w')
@@ -44,42 +44,28 @@
tex.close()
def svg_open(self,filename):
- # parsing of SVG file with the equation
- # real parsing XML to use!!!! it will be easier !!!
- svg = open(filename, 'r')
- svg_lines = svg.readlines()
-
- # trip top/bottom lines from svg file
- svg_lines.pop(0)
- svg_lines.pop(1)
- svg_lines.pop(len(svg_lines)-1)
+ def clone_and_rewrite(self, node_in):
+ if node_in.localName != 'svg':
+ node_out = self.document.createElement('svg:' + node_in.localName)
+ for i in range(0, node_in.attributes.length):
+ name = node_in.attributes.item(i).name
+ value = node_in.attributes.item(i).value
+ node_out.setAttribute(name, value)
+ else:
+ node_out = self.document.createElement('svg:g')
- group = self.document.createElement('svg:g')
- self.current_layer.appendChild(group)
+ for c in node_in.childNodes:
+ if c.localName in ('g', 'path'):
+ node_out.appendChild(clone_and_rewrite(self, c))
- # deleting "<g... >" "</g>" "<path d=" and "/>" from svg_lines
- nodegroup=''
- s_nodegroup_path=''
-
- for i in range(1,len(svg_lines)):
- if svg_lines[i].find("<g") != -1:
- nodegroup=svg_lines[i].split("<g")
- nodegroup=nodegroup[1].split(" >")
- nodegroup=nodegroup[0]+'\n'
- elif svg_lines[i].find("<path d=") != -1:
- s_nodegroup_path=svg_lines[i].split("<path d=")
- s_nodegroup_path=s_nodegroup_path[1]
- elif svg_lines[i].find("/>") != -1:
- s_nodegroup_path=s_nodegroup_path+'"\n'
- elif svg_lines[i].find("</g>") != -1:
- nodegroup_svg = self.document.createElement('svg:g')
- nodegroup_svg.setAttribute('style',nodegroup)
- nodegroup_path = self.document.createElement('svg:path')
- nodegroup_path.setAttribute('d',s_nodegroup_path)
- group.appendChild(nodegroup_svg)
- nodegroup_svg.appendChild(nodegroup_path)
- else:
- s_nodegroup_path=s_nodegroup_path+svg_lines[i]
+ return node_out
+
+ doc = xml.dom.minidom.parse(filename)
+ svg = doc.getElementsByTagName('svg')[0]
+
+ group = clone_and_rewrite(self, svg)
+ group.setAttribute('transform', 'scale(1000)')
+ self.current_layer.appendChild(group)
class EQTEXSVG(inkex.Effect):
def __init__(self):
@@ -89,19 +75,17 @@
dest="formule", default=10.0,
help="Formule LaTeX")
def effect(self):
-
- base_file = os.path.join(tempfile.gettempdir(), "inkscape-latex.tmp")
+ base_file = os.path.join(tempfile.gettempdir(), "inkscape-latex.tmp."
+ str(os.getpid()))
latex_file = base_file + ".tex"
create_equation_tex(latex_file, self.options.formule)
-
- out_file = os.path.join(tempfile.gettempdir(),
"inkscape-latex.tmp.output")
- os.system('latex -output-directory=' + tempfile.gettempdir() + ' ' +
latex_file + '> ' + out_file)
+ out_file = base_file + ".output"
+ os.system('cd ' + tempfile.gettempdir() + '; latex ' + latex_file + '
> ' + out_file)
ps_file = base_file + ".ps"
dvi_file = base_file + ".dvi"
svg_file = base_file + ".svg"
os.system('dvips -q -f -E -D 600 -y 5000 -o ' + ps_file + ' ' +
dvi_file)
- os.system('pstoedit -f svg -dt -ssp ' + ps_file + ' ' + svg_file + '>>
' + out_file)
+ os.system('cd ' + tempfile.gettempdir() + '; pstoedit -f plot-svg -dt
-ssp ' + ps_file + ' ' + svg_file + ' &> ' + out_file)
# ouvrir le svg et remplacer #7F7F7F par #000000
svg_open(self, svg_file)