From: André W. <wo...@us...> - 2011-06-17 11:42:06
|
Dear Bastian, Am 17.06.2011 um 12:20 schrieb R. Bastian: > Thanks, André. I can write a convenient ergonomic class for my use. > I am not sure that I understand the sense of the 'a' : is it a trick or placeholder > before entering in the decoding ? Yes, the decoding is a mapping from an item in the list passed as text to the name of the corresponding glyph. We use a list of characters (a string) and map each character to the corresponding glyph name. As we want access a single glyph only, we can savely use the very same character all the time. I made some modifications yesterday evening in the subversion repository which make this use case much simple. In case you are interested, using a subversion checkout of PyX you can now do the following: from pyx import * from pyx import filelocator, font from pyx.font import t1file name = 'musix11' t1 = filelocator.open(name, [filelocator.format.type1]) f = font.T1font(t1file.from_PFB_bytes(t1.read())) c = canvas.canvas() for x in range(16): for y in range(16): i = x+16*y c.stroke(path.rect_pt(-25+50*x, -25-50*y, 50, 50)) c.text_pt(50*x, 15-50*y, str(i), [text.halign.center]) c.insert(f.text_pt(x*50, -y*50, [i], 10, decoding=None)) c.writePDFfile() I expect this low level functionality to use type1 fonts to be pretty stable now, so it might be worth to consider to use a svn version for your development as it removes the ugly hack you needed before. However, in the end it might not be important once you wrap it all in a class of your own. You can either switch to this improved solution now (using a svn checkout) or later (once we make the next PyX release). Best, André -- by _ _ _ Dr. André Wobst, Amselweg 22, 85716 Unterschleißheim / \ \ / ) wo...@us..., http://www.wobsta.de/ / _ \ \/\/ / PyX - High quality PostScript and PDF figures (_/ \_)_/\_/ with Python & TeX: visit http://pyx.sourceforge.net/ |