I can’t seem to get PNMTextMaker to show me any results. I’m testing different geometry- and texture-making features in Panda, to see what works and what doesn’t. So far, it looks like PNMTextMaker thinks it’s working, but maybe it isn’t doing anything.
Here’s my test code:
xsize = white.getXSize() ysize = white.getYSize() text_img = PNMImage(xsize, ysize) text_img.fill(1.0) pt = PNMTextMaker("arial.ttf",0) b = pt.generate_into("testing testing",text_img,xsize/2,ysize/2) self.texts.images["orange"] = text_img print b
Where “white” is a PNMImage and self.texts.images is a dict containing a series of PNMImages. The above code simply replaces the “orange” image with a blank white image. Yet variable b reports a pixel width for the result, suggesting that something was supposed to have happened. The font file, “arial.ttf”, has been copied to the same directory as the script. I’m not 100% sure that .ttf fonts are meant to be compatible with this function. The information I found with Google suggested that .ttf should be FreeType compatible.
Is there a trick to this? Is it broken? Does it only work in Panda C++, perhaps? I’m coding in Python, as shown above. I tested to see if Canvas() was working, and Panda Python rejected my effort. I assume Canvas is C++ only, or no longer working at all. I wonder if PNMTextMaker is the same.