# parameters ascent = 1500 descent = 500 bar_resolution = 100 bar_base = 0xE000 line_resolution = 50 line_base = 0xE100 # header print "" print "" print "" print "" print "" % (int(ascent / 3) + 1) print "" \ % { "a" : ascent, "d" : -descent } # glyphs def GenBarPath(ix): global ascent, bar_resolution width = ascent / 3 delta = (ascent - 5) / bar_resolution return "M 50 0 V %(v)d H %(h)d V 0 H 50 Z" \ % { "v" : 5 + int(ix * delta), "h": width - 100 } def GenBarGlyph(ix): global ascent, bar_base, bar_resolution print "" \ % { "h" : int(ascent / 3), "p" : GenBarPath(ix) } def GenLinePath(ix0, ix1): global ascent, line_resolution width = ascent / 4 thickness = 40 delta = (ascent - thickness) / line_resolution return "M 0 %(y0)d V %(y0p)d L %(w)d %(y1)d V %(y1p)d L 0 %(y0)d Z" \ % { "y0" : int(ix0 * delta), "y0p" : int(ix0 * delta) + thickness, "w" : width, "y1" : int(ix1 * delta) + thickness, "y1p" : int(ix1 * delta) } def GenLineGlyph(ix0, ix1): global ascent, line_base, line_resolution print "" \ % { "h" : int(ascent / 4), "p" : GenLinePath(ix0, ix1) } for i in range(bar_resolution): GenBarGlyph(i) for i in range(line_resolution): for j in range(line_resolution): GenLineGlyph(i, j) # footer print "" print "" print "" # end