using default font with PNMTextMaker

I’m trying to use the default compiled-in dynamic font (sanpers) with PMNTextMaker. These are the constructors:

I try the following:

#include "default_font.h"

PNMTextMaker textMaker((const char *)default_font_data, default_font_size, 0);

But it doesn’t find those symbols for linkage, I guess they would have to be exported?

Another option would be TextProperties::get_default_font() but PNMTextMaker doesn’t accept a TextFont object, I don’t see how to retrieve the data from the TextFont instance either. If using the default font isn’t possible currently, how should I go about fixing it?

Hmm, I guess we could simply replace the lines:

extern const unsigned char default_font_data[];
extern const int default_font_size;

with:

extern EXPCL_PANDA_TEXT const unsigned char default_font_data[];
extern EXPCL_PANDA_TEXT const int default_font_size;

in default_font.h, and that should export these symbols for you to enable their use.

However, note that the “default font” isn’t always available in certain compilation modes (you should check COMPILE_IN_DEFAULT_FONT to be sure).

David

Thanks. I committed this.