From 88ca7fa527c1588dc0eed7d89c400e48807b1dc6 Mon Sep 17 00:00:00 2001 From: Felipe Corr??a da Silva Sanches Date: Thu, 19 May 2011 18:10:45 -0300 Subject: 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-" and convert them into an svg font (bzr r10213) --- share/extensions/Makefile.am | 2 ++ share/extensions/new_glyph_layer.inx | 17 ++++++++++++++ share/extensions/new_glyph_layer.py | 45 ++++++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 share/extensions/new_glyph_layer.inx create mode 100755 share/extensions/new_glyph_layer.py 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 @@ + + + <_name>Add Glyph Layer + org.inkscape.typography.newglyphlayer + inkex.py + new_glyph_layer.py + + + all + + + + + + 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() + -- cgit v1.2.3