summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelipe Corr??a da Silva Sanches <juca@members.fsf.org>2011-05-26 01:44:55 +0000
committerFelipe C. da S. Sanches <juca@members.fsf.org>2011-05-26 01:44:55 +0000
commitbaf104b879e4f98e96b7be5a3719fdca868ccf68 (patch)
tree675d86c15dc5bce1d8b45fe03bccb8009cf0e603
parent* extension module to parse and encode path descriptions (diff)
downloadinkscape-baf104b879e4f98e96b7be5a3719fdca868ccf68.tar.gz
inkscape-baf104b879e4f98e96b7be5a3719fdca868ccf68.zip
Saving curve description in d attribute of svg:glyph instead of svg:path elements as childnodes of svg:glyph because this is compatible with current fontforge svg loader
(bzr r10223)
-rw-r--r--share/extensions/layers2svgfont.py28
1 files changed, 23 insertions, 5 deletions
diff --git a/share/extensions/layers2svgfont.py b/share/extensions/layers2svgfont.py
index 49f81852c..6c11d9c5f 100644
--- a/share/extensions/layers2svgfont.py
+++ b/share/extensions/layers2svgfont.py
@@ -93,16 +93,34 @@ class Layers2SVGFont(inkex.Effect):
glyph = self.get_or_create_glyph(font, unicode_char)
glyph.set("unicode", unicode_char)
+ ############################
+ #Option 1:
+ # Using clone (svg:use) as childnode of svg:glyph
+
#use = self.get_or_create(glyph, inkex.addNS('use', 'svg'))
#use.set(inkex.addNS('href', 'xlink'), "#"+group.get("id"))
#TODO: This code creates <use> nodes but they do not render on svg fonts dialog. why?
- paths = group.findall(inkex.addNS('path', 'svg'))
+ ############################
+ #Option 2:
+ # Using svg:paths as childnodes of svg:glyph
+
+ #paths = group.findall(inkex.addNS('path', 'svg'))
+ #for p in paths:
+ # d = p.get("d")
+ # d = self.flip_cordinate_system(d, units_per_em, baseline)
+ # path = inkex.etree.SubElement(glyph, inkex.addNS('path', 'svg'))
+ # path.set("d", d)
+
+ ############################
+ #Option 3:
+ # Using curve description in d attribute of svg:glyph
+
+ paths = group.findall(inkex.addNS('path', 'svg'))
+ d = ""
for p in paths:
- path = inkex.etree.SubElement(glyph, inkex.addNS('path', 'svg'))
- d = p.get("d")
- d = self.flip_cordinate_system(d, units_per_em, baseline)
- path.set("d", d)
+ d += " " + self.flip_cordinate_system(p.get("d"), units_per_em, baseline)
+ glyph.set("d", d)
if __name__ == '__main__':
e = Layers2SVGFont()