diff options
| author | su_v <suv-sf@users.sourceforge.net> | 2013-03-29 19:54:30 +0000 |
|---|---|---|
| committer | ~suv <suv-sf@users.sourceforge.net> | 2013-03-29 19:54:30 +0000 |
| commit | 8b605523195bcad80c4a3134134066e677282640 (patch) | |
| tree | 7258ae78c0ae7e2ee7519dcecead8b1fc34ca78f /share | |
| parent | merge from trunk (r12240) (diff) | |
| parent | Header cleanup (diff) | |
| download | inkscape-8b605523195bcad80c4a3134134066e677282640.tar.gz inkscape-8b605523195bcad80c4a3134134066e677282640.zip | |
merge from trunk (r12258)
(bzr r11668.1.65)
Diffstat (limited to 'share')
| -rwxr-xr-x | share/extensions/measure.py | 17 | ||||
| -rw-r--r-- | share/extensions/scour.inx | 10 |
2 files changed, 19 insertions, 8 deletions
diff --git a/share/extensions/measure.py b/share/extensions/measure.py index a1ae00ce1..8aa940ed2 100755 --- a/share/extensions/measure.py +++ b/share/extensions/measure.py @@ -83,7 +83,10 @@ def csparea(csp): bezarea += ( 3.0*sp[i-1][1][1] - 1.0*sp[i-1][2][1] - 2.0*sp[i][0][1] + 0.0*sp[i][1][1])*sp[i][1][0] area += 0.15*bezarea return abs(area) - +def appendSuperScript(node, text): + super = inkex.etree.SubElement(node, inkex.addNS('tspan', 'svg'), {'style': 'font-size:65%;baseline-shift:super'}) + super.text = text + class Length(inkex.Effect): def __init__(self): inkex.Effect.__init__(self) @@ -180,7 +183,11 @@ class Length(inkex.Effect): new.set('startOffset', startOffset) new.set('dy', str(dy)) # dubious merit #new.append(tp) - new.text = str(text) + if text[-2:] == "^2": + appendSuperScript(new, "2") + new.text = str(text)[:-2] + else: + new.text = str(text) #node.set('transform','rotate(180,'+str(-x)+','+str(-y)+')') node.set('x', str(x)) node.set('y', str(y)) @@ -193,7 +200,11 @@ class Length(inkex.Effect): 'font-weight': 'normal', 'font-style': 'normal', 'fill': '#000000'} new.set('style', simplestyle.formatStyle(s)) new.set('dy', str(dy)) - new.text = str(text) + if text[-2:] == "^2": + appendSuperScript(new, "2") + new.text = str(text)[:-2] + else: + new.text = str(text) node.set('x', str(x)) node.set('y', str(y)) node.set('transform', 'rotate(%s, %s, %s)' % (angle, x, y)) diff --git a/share/extensions/scour.inx b/share/extensions/scour.inx index de01a1927..ee245b149 100644 --- a/share/extensions/scour.inx +++ b/share/extensions/scour.inx @@ -35,13 +35,13 @@ <page name="OptionHelp" _gui-text="Help (Options)"> <_param name="OptionsInstructions" type="description" xml:space="preserve">This extension optimizes the SVG file according to the following options: * Shorten color names: convert all colors to #RRGGBB or #RGB format. - * Convert CSS attributes to XML attributes: convert styles from <style> tags and inline style="" declarations into XML attributes. - * Group collapsing: removes useless <g> elements, promoting their contents up one level. Requires "Remove unused ID names for elements" to be set. - * Create groups for similar attributes: create <g> elements for runs of elements having at least one attribute in common (e.g. fill color, stroke opacity, ...). + * Convert CSS attributes to XML attributes: convert styles from style tags and inline style="" declarations into XML attributes. + * Group collapsing: removes useless g elements, promoting their contents up one level. Requires "Remove unused ID names for elements" to be set. + * Create groups for similar attributes: create g elements for runs of elements having at least one attribute in common (e.g. fill color, stroke opacity, ...). * Embed rasters: embed raster images as base64-encoded data URLs. * Keep editor data: don't remove Inkscape, Sodipodi or Adobe Illustrator elements and attributes. - * Remove metadata: remove <metadata> tags along with all the information in them, which may include license metadata, alternate versions for non-SVG-enabled browsers, etc. - * Remove comments: remove <!-- --> tags. + * Remove metadata: remove metadata tags along with all the information in them, which may include license metadata, alternate versions for non-SVG-enabled browsers, etc. + * Remove comments: remove comment tags. * Work around renderer bugs: emits slightly larger SVG data, but works around a bug in librsvg's renderer, which is used in Eye of GNOME and other various applications. * Enable viewboxing: size image to 100%/100% and introduce a viewBox. * Number of significant digits for coords: all coordinates are output with that number of significant digits. For example, if 3 is specified, the coordinate 3.5153 is output as 3.51 and the coordinate 471.55 is output as 472. |
