svgfont2layers.py revision 0835afe3942ce2dc112aab1201506b41a0bd6ab3
'''
Copyright (C) 2011 Felipe Correa da Silva Sanches <juca@members.fsf.org>
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
import simplepath
help="Load only the first 30 glyphs from the SVGFont (otherwise the loading process may take a very long time)")
if node is None:
return node
# Get access to main SVG document element
#TODO: detect files with multiple svg fonts declared.
# Current code only reads the first svgfont instance
if baseline is None:
baseline = 0
#TODO: where should we save the font family name?
#fontfamily = fontface.get("font-family")
#TODO: should we guarantee that <svg:font horiz-adv-x> equals <svg:font-face units-per-em> ?
#TODO: missing-glyph
if unicode_char is None:
continue
#TODO: interpret option 1
############################
#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?
############################
#Option 2:
# Using svg:paths as childnodes of svg:glyph
if d is None:
continue
############################
#Option 3:
# Using curve description in d attribute of svg:glyph
if d is None:
continue
break
if __name__ == '__main__':
e = SVGFont2Layers()
e.affect()