summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorJabiertxof <jtx@jtx>2016-12-10 18:29:40 +0000
committerJabiertxof <jtx@jtx>2016-12-10 18:29:40 +0000
commit1904ea574a4078d53bb297d5fbf0ea6bbb824d1b (patch)
treeffd88cee518044c2132c49511fe9616f2e1637a8 /share
parentUpdate to trunk (diff)
parentApply suv patch to handle containers https://bugs.launchpad.net/inkscape/+bug... (diff)
downloadinkscape-1904ea574a4078d53bb297d5fbf0ea6bbb824d1b.tar.gz
inkscape-1904ea574a4078d53bb297d5fbf0ea6bbb824d1b.zip
Update to trunk
(bzr r15295.1.21)
Diffstat (limited to 'share')
-rw-r--r--share/extensions/dpiswitcher.py65
-rw-r--r--share/icons/icons.svg14
2 files changed, 71 insertions, 8 deletions
diff --git a/share/extensions/dpiswitcher.py b/share/extensions/dpiswitcher.py
index e7adbc0cf..46dad5ee5 100644
--- a/share/extensions/dpiswitcher.py
+++ b/share/extensions/dpiswitcher.py
@@ -20,9 +20,59 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'''
-
-import inkex, sys, re, string
+# standard libraries
+import sys
+import re
+import string
from lxml import etree
+# local libraries
+import inkex
+
+
+# globals
+REFERENCED_CONTAINERS = [
+ # These container elements - which may be referenced by other
+ # elements - do not need to be scaled directly. The referencing
+ # elements will be either insided scaled containers or scaled
+ # directly as graphics elements in SVG root.
+ 'defs',
+ 'glyph',
+ 'marker',
+ 'mask',
+ 'missing-glyph',
+ 'pattern',
+ 'symbol',
+]
+CONTAINER_ELEMENTS = [
+ # These element types have graphics elements and other container
+ # elements as child elements. They need to be scaled if in SVG root.
+ 'a',
+ 'g',
+ 'switch',
+]
+GRAPHICS_ELEMENTS = [
+ # These element types cause graphics to be drawn. They need to be
+ # scaled if in SVG root.
+ 'circle',
+ 'ellipse',
+ 'image',
+ 'line',
+ 'path',
+ 'polygon',
+ 'polyline',
+ 'rect',
+ 'text',
+ 'use',
+]
+# FIXME: instances and referenced elements
+# If for example a referenced element in SVG root is directly scaled,
+# and its instance (referencing element e.g. <use>) is inside a scaled
+# top-level container, the instance in the end will be rendered at an
+# incorrect scale relative to the viewport (page area) and the other
+# drawing content. Another unsupported case is both the referenced
+# element and the instance in SVG root: the clone will in the end be
+# rendered with the scale factor applied twice.
+
class DPISwitcher(inkex.Effect):
@@ -56,14 +106,14 @@ class DPISwitcher(inkex.Effect):
if self.options.switcher == "1":
self.scaleGuides(svg)
self.scaleGrid(svg)
- for element in svg:
+ for element in svg: # iterate all top-level elements of SVGRoot
box3DSide = element.get(inkex.addNS('box3dsidetype', 'inkscape'))
if box3DSide:
continue
uri, tag = element.tag.split("}")
width_scale = self.factor_a
height_scale = self.factor_a
- if tag == "rect" or tag == "image" or tag == "path" or tag == "circle" or tag == "ellipse" or tag == "text":
+ if tag in GRAPHICS_ELEMENTS or tag in CONTAINER_ELEMENTS:
if element.get('width') is not None and \
(re.sub("[0-9]*\.?[0-9]", "", element.get('width')) == "%" or \
re.sub("[0-9]*\.?[0-9]", "", element.get('width')) == "px"):
@@ -102,7 +152,7 @@ class DPISwitcher(inkex.Effect):
__uuconv = {'in':96.0, 'pt':1.33333333333, 'px':1.0, 'mm':3.77952755913, 'cm':37.7952755913,
'm':3779.52755913, 'km':3779527.55913, 'pc':16.0, 'yd':3456.0 , 'ft':1152.0}
- __uuconvLegazy = {'in':90.0, 'pt':1.25, 'px':1, 'mm':3.5433070866, 'cm':35.433070866, 'm':3543.3070866,
+ __uuconvLegacy = {'in':90.0, 'pt':1.25, 'px':1, 'mm':3.5433070866, 'cm':35.433070866, 'm':3543.3070866,
'km':3543307.0866, 'pc':15.0, 'yd':3240 , 'ft':1080}
def scaleElement(self, m):
@@ -166,11 +216,10 @@ class DPISwitcher(inkex.Effect):
grid.set("originy", str(originy))
def effect(self):
- action = self.options.action.strip("\"") # TODO Is this a bug? (Extra " characters)
saveout = sys.stdout
sys.stdout = sys.stderr
svg = self.document.getroot()
- if action == "page_info":
+ if self.options.action == '"page_info"':
print ":::SVG document related info:::"
print "version: " + str(svg.get(inkex.addNS('version',u'inkscape')))
width = svg.get('width')
@@ -211,7 +260,7 @@ class DPISwitcher(inkex.Effect):
if self.options.switcher == "0":
self.unitExponent = 1.0/(self.factor_a/self.__uuconv[self.units])
else:
- self.unitExponent = 1.0/(self.factor_a/self.__uuconvLegazy[self.units])
+ self.unitExponent = 1.0/(self.factor_a/self.__uuconvLegacy[self.units])
self.scaleRoot(svg);
sys.stdout = saveout
diff --git a/share/icons/icons.svg b/share/icons/icons.svg
index 5ceaac9bb..fa5ea4626 100644
--- a/share/icons/icons.svg
+++ b/share/icons/icons.svg
@@ -3812,6 +3812,20 @@ http://www.inkscape.org/</dc:description>
</g>
<rect y="51.96389" x="1353.87" height="28" width="28" id="rect6752" style="fill:none" />
</g>
+<g id="text_outer_style" transform="translate(690,322)">
+<rect id="text_outer_style_rect" x="0" y="0" width="28" height="28" style="fill:none" />
+<g aria-label="T" style="font-weight:bold;font-size:20px;font-family:sans-serif;text-anchor:middle;fill:#4d4d4d;stroke:#000000;stroke-width:0.75">
+<path id="BigT" d="m 2.28125,2.4199219 h 13.4375 V 5.2617187 H 10.884766 V 17 H 7.125 V 5.2617187 H 2.28125 Z" />
+</g>
+<g aria-label="T" style="font-weight:bold;font-size:12px;font-family:sans-serif;text-anchor:middle;fill:#4d4d4d;stroke:#000000;stroke-width:0.75">
+<path id="LittleT" d="m 13.96875,13.251953 h 8.0625 v 1.705078 H 19.130859 V 22 H 16.875 v -7.042969 h -2.90625 z" />
+</g>
+<path id="text_outer_style_path1" d="m 20,2 h 6 V 26 H 2 V 10" style="fill:none;stroke:#000000;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round" />
+<path id="text_outer_style_path2" d="M 3,3 H 15" style="fill:none;stroke:#999999;stroke-width:0.75;stroke-linecap:round" />
+<path id="text_outer_style_path3" d="M 7.8,5.5 V 16.25" style="fill:none;stroke:#999999;stroke-width:0.75;stroke-linecap:round" />
+<path id="text_outer_style_path4" d="m 14.6,13.75 h 6.8" style="fill:#4d4d4d;stroke:#999999;stroke-width:0.5;stroke-linecap:round" />
+<path id="text_outer_style_path5" d="m 17.5,14.85 v 6.5" style="fill:#4d4d4d;stroke:#999999;stroke-width:0.5;stroke-linecap:round" />
+</g>
<g id="text_line_spacing" transform="translate(-0.0508118,0.0123038)">
<rect y="321.9877" x="480.0508" height="28" width="28" id="rect6696" style="fill:none" />
<g transform="translate(-787.9306,270.3015)" id="g7600">