hershey.py revision d101dfb382647fc1ecbe6c71ea4e24bcb06cac41
# -*- coding: utf-8 -*-
"""
Hershey Text - renders a line of text using "Hershey" fonts for plotters
Copyright 2011, Windell H. Oskay, www.evilmadscientist.com
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 hersheydata #data file w/ Hershey font data
import inkex
import simplestyle
help="The active tab when Apply was pressed" )
help="The input text to render")
help="The active option when Apply was pressed" )
help="The selected font face when Apply was pressed" )
# Embed text in group to make manipulation easier:
#Baseline: modernized roman simplex from JHF distribution.
w = 0 #Initial spacing offset
#evaluate text string
for q in letterVals:
if (q < 0) or (q > 95):
w += 2*spacing
else:
else:
#Generate glyph table
wmax = 0;
w = 0
r = p*10 + q
if (r < 0) or (r > 95):
w += 5*spacing
else:
w = draw_svg_text(r, clearfont, w, v, g)
w = draw_svg_text(r, font, w, v, g)
w += 5*spacing
if w > wmax:
wmax = w
w = wmax
# Translate group to center of view, approximately
g.set( 'transform',t)
if __name__ == '__main__':
e = Hershey()
e.affect()
# vim: expandtab shiftwidth=4 tabstop=8 softtabstop=4 fileencoding=utf-8 textwidth=99