I added the line “print font” to your code, and it displayed the following text:
Number of glyphs is: 6947
Glyph size (in pixels): 32
StaticTextFont bin_font; 6929 characters available in font:
92 162 163 167 168 172 176 177 180 182 215 247 913 914 915 916
Followed by thousands of specific character codes. None of these character codes are the Unicode characters for the letters in “test”, so it’s not surprising that it can’t render that string (and it gives you error messages about missing characters).
When I give it the string u’\x5c\xa2\xa3\xa7’ instead, which is the first four character codes mentioned, it doesn’t complain but I don’t see anything. This tells me that the individual glyphs you fed it are invisible, or their vertices are not within the range (0, 1).
So then I noticed that your vertex coordinates are Y-up instead of Panda’s default Z-up: addData3f(0,1,0) instead of addData3f(0,0,1). In a Z-up coordinate system, the Y coordinate should be 0, and the vertical coordinate is in Z. I corrected this, and now I can see the glyphs! (Your characters were just being viewed edge-on before.)
But there’s only one glyph. It looks like your offset value is also incorrect, it’s setting the offset in Y instead of X. I changed self.vwriter2.addData3f(0,1,0) to self.vwriter2.addData3f(1,0,0), and now I can see four glyphs.
The texture is white on black, whereas most fonts usually use white on transparent. Perhaps you meant to use FAlpha instead of FLuminance, and “A” instead of “G”, when you set up the texture. This also, of course, requires enabling transparency, with a call to fontNP.setTransparency(TransparencyAttrib.MAlpha).
Now I see white symbols on a transparent background.
I’ll leave it up to you to figure out what the character code mapping is supposed to be; I guess you’ve already solved this problem correctly in the .egg file case.
David