def main(argv): gs = GS() document = dsc_document("My first textbox example and testbed") page = document.page() canvas = page.canvas(margin=mm(18), border=False) tr = gs.font("Times-Roman") tr = page.register_font(tr) he = gs.font("Helvetica") he = page.register_font(he) al = type1("Kerkis.pfa", "Kerkis.afm") al = page.register_font(al) ba = type1("BlackadderITC-Regular.pfa", "BlackadderITC-Regular.afm") ba = page.register_font(ba) for counter, bb in enumerate(eight_squares(canvas)): func = globals().get("box%i" % counter, None) if func is None: break else: box = textbox.from_bounding_box(canvas, bb, border=True) canvas.append(box) func(**locals()) fp = open(sys.argv[0] + ".ps", "w") document.write_to(fp) fp.close()
def main(argv): gs = GS() ff = gs.font_family("Helvetica") print ff print ff.regular.full_name print ff.italic.full_name print ff.bold.full_name print ff.bolditalic.full_name print print ff.fonts()
def main(argv): gs = GS() sans = gs.font("FeGWitten-Bold") # for u, g in sans.metrics.items(): # print u, g.ps_name document = dsc_document("Hello, world!") page = document.page() canvas = page.canvas(margin=mm(18), border=True) canvas = canvas_with_lines(canvas, 30.0) # The regular say print >> canvas, "/%s findfont" % sans.ps_name print >> canvas, "20 scalefont" print >> canvas, "setfont" print >> canvas, ps_escape("Hello, world! (no Kerning at all)"), " show" canvas.newline() # Kerned say message = u"Hello, world! (Pair-wise Kerning on!) € äöüÄÖÜß" # äöüÄÖÜß offsets = [] sans_wrapper = page.register_font(sans) print >> canvas, "/%s findfont" % sans_wrapper.ps_name() print >> canvas, "20 scalefont" print >> canvas, "setfont" for kerning_delta in glyph_iterator(sans_wrapper, 20, message): offsets.append(kerning_delta) offsets = map(str, offsets) tpl = ( sans_wrapper.postscript_representation(message), join(offsets, " "), ) print >> canvas, "(%s) [ %s ] xshow" % tpl fp = open("kerning.ps", "w") document.write_to(fp) fp.close()