Comment 4 for bug 171007

Revision history for this message
su_v (suv-lp) wrote :

@Craig - tested with simple example in Inkscape 0.47 and 0.48(+devel), here are some of the issues I encountered [1]:

1) style inheritance
The extension fails to detect the font of most text objects, unless the user has explicitly assign a font to a highlighted part of a text object because the relevant style information is stored in the parent <text> object and not in the <tspan> object (which inherits the style from the parent). AFAICT both elements (text, tspan) need to be searched for the font name.

There are two attributes used to store the font name: 'font-family' and '-inkscape-font-specification'. I don't know details about how they inter-depend and whether a simple 'Find&Replace' gives the correct or expected result in all cases.

2) parser error
If the extension can't find a match (because the font names are stored in the <text> style attribute), or apparently as soon as it parses a <tspan> element which doesn't have a style attribute, it fails with this message:

Traceback (most recent call last):
  File "/Users/suv/.config/inkscape/extensions/replace_font-LeWitt.py", line 73, in <module>
    e.affect()
  File "/Volumes/blue/src/Inkscape/Inkscape-0.47-1.LEOPARD+/Inkscape-047-1.app/Contents/Resources/extensions/inkex.py", line 207, in affect
    self.effect()
  File "/Users/suv/.config/inkscape/extensions/replace_font-LeWitt.py", line 57, in effect
    style = el.attrib['style']
  File "lxml.etree.pyx", line 1984, in lxml.etree._Attrib.__getitem__ (src/lxml/lxml.etree.c:43068)
KeyError: 'style'

[1] There have been some changes to how text is stored in the source and other enhancements of the text tool in 0.48. Considering that 0.48 src is released (and packages imminent to be officially announced 'released') I focused on using the extension with 0.48 and current devel builds.