
On 17-11-2013 17:45, TimeWaster wrote:
hi,
i think with the change from inkex.unittouu to Effect.unittouu in inkex.py (r12722) was a bug introduced (regression).
am i right that a user unit is equivalent to a pixel?
It's a little different. In the trunk version, we set the viewbox according to the user selected document unit, so that the SVG values are expressed in the document unit. The document unit == user unit, or what the extension should output. The uuconv table is really an internal conversion table, and should not be used by extensions. I do not know much about python. Perhaps we can simply make the uuconv table private, so no-one is going to use it outside of inkex.py.
regards, Johan
if yes, the actual implementation is converting to *something* but not to user units.
i think the code should look like this (or the method should be renamed to something other than *touu):
if u: try: return retval * self.uuconv[u.string[u.start():u.end()]] except KeyError: pass else: # default take document unit return retval * self.uuconv[self.getDocumentUnit()]
can somebody confirm this?
its also the same with uutounit, it should be:
def uutounit(self, val, unit): return val / self.uuconv[unit]
regards, TimeWaster