summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorFelipe Corr??a da Silva Sanches <juca@members.fsf.org>2011-05-19 21:10:45 +0000
committerFelipe C. da S. Sanches <juca@members.fsf.org>2011-05-19 21:10:45 +0000
commit88ca7fa527c1588dc0eed7d89c400e48807b1dc6 (patch)
tree361f9e7113beb15ad6cd807b409985708b6273ac /share
parentExtension for setting up the document dimension according to font metrics pro... (diff)
downloadinkscape-88ca7fa527c1588dc0eed7d89c400e48807b1dc6.tar.gz
inkscape-88ca7fa527c1588dc0eed7d89c400e48807b1dc6.zip
extension to add a glyph layer. It is rather simple now, but may be more usefull in the future. It is supposed to be used with a future extension that handles those layers with id="GlyphLayer-<unicode char>" and convert them into an svg font
(bzr r10213)
Diffstat (limited to 'share')
-rw-r--r--share/extensions/Makefile.am2
-rw-r--r--share/extensions/new_glyph_layer.inx17
-rwxr-xr-xshare/extensions/new_glyph_layer.py45
3 files changed, 64 insertions, 0 deletions
diff --git a/share/extensions/Makefile.am b/share/extensions/Makefile.am
index 38c8354c4..4beb0e663 100644
--- a/share/extensions/Makefile.am
+++ b/share/extensions/Makefile.am
@@ -100,6 +100,7 @@ extensions = \
markers_strokepaint.py \
measure.py \
motion.py \
+ new_glyph_layer.py \
outline2svg.pl \
param_curves.py \
pathalongpath.py\
@@ -269,6 +270,7 @@ modules = \
markers_strokepaint.inx \
measure.inx \
motion.inx \
+ new_glyph_layer.inx \
outline2svg.inx \
param_curves.inx \
pathalongpath.inx\
diff --git a/share/extensions/new_glyph_layer.inx b/share/extensions/new_glyph_layer.inx
new file mode 100644
index 000000000..3c46f5caa
--- /dev/null
+++ b/share/extensions/new_glyph_layer.inx
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
+ <_name>Add Glyph Layer</_name>
+ <id>org.inkscape.typography.newglyphlayer</id>
+ <dependency type="executable" location="extensions">inkex.py</dependency>
+ <dependency type="executable" location="extensions">new_glyph_layer.py</dependency>
+ <param name="unicode" type="string" _gui-text="Unicode character:"></param>
+ <effect>
+ <object-type>all</object-type>
+ <effects-menu>
+ <submenu _name="Typography"/>
+ </effects-menu>
+ </effect>
+ <script>
+ <command reldir="extensions" interpreter="python">new_glyph_layer.py</command>
+ </script>
+</inkscape-extension>
diff --git a/share/extensions/new_glyph_layer.py b/share/extensions/new_glyph_layer.py
new file mode 100755
index 000000000..3d38fb433
--- /dev/null
+++ b/share/extensions/new_glyph_layer.py
@@ -0,0 +1,45 @@
+'''
+Copyright (C) 2011 Felipe Correa da Silva Sanches
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+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
+import sys
+
+class NewGlyphLayer(inkex.Effect):
+ def __init__(self):
+ inkex.Effect.__init__(self)
+ self.OptionParser.add_option("-u", "--unicodechar",
+ action="store", type="string",
+ dest="unicodechar", default='',
+ help="Unicode char")
+
+ def effect(self):
+ # Get all the options
+ unicode_char = self.options.unicodechar
+
+ # Get access to main SVG document element
+ svg = self.document.getroot()
+
+ # Create a new layer.
+ layer = inkex.etree.SubElement(svg, 'g')
+ layer.set(inkex.addNS('label', 'inkscape'), 'GlyphLayer-'+unicode_char)
+ layer.set(inkex.addNS('groupmode', 'inkscape'), 'layer')
+
+if __name__ == '__main__':
+ e = NewGlyphLayer()
+ e.affect()
+