43#include <FTGL/FTGLExtrdFont.h>
44#include <FTGL/FTGLPixmapFont.h>
45#include <FTGL/FTGLTextureFont.h>
46#include <FTGL/FTGLBitmapFont.h>
47#include <FTGL/FTGLOutlineFont.h>
48#include <FTGL/FTGLPolygonFont.h>
56void EMFTGL::render_string(
const string& message) {
61 cerr <<
"Couldn't open font, no action taken. Current font is " <<
font_file_name << endl;
65 font->Render(message.c_str());
72 cerr <<
"Couldn't open font, no action taken. Current font is " <<
font_file_name << endl;
73 return vector<float>();
75 vector<float> bounds(6);
76 font->BBox(message.c_str(),bounds[0],bounds[1],bounds[2],bounds[3],bounds[4],bounds[5]);
89EMFTGL::EMFTGLManager::~EMFTGLManager() {
100 for (vector<EMFTGLFontInstance*>::const_iterator it = font_instances.begin(); it != font_instances.end(); ++it ) {
102 return (*it)->get_font();
106 EMFTGLFontInstance* fi =
new EMFTGLFontInstance(
mode,file_name,
face_size,
depth,use_dl);
107 font_instances.push_back(fi);
108 return fi->get_font();
121 if (mode == EMFTGL::PIXMAP) {
122 font =
new FTGLPixmapFont(font_file_name.c_str());
124 else if (mode == EMFTGL::TEXTURE) {
125 font =
new FTGLTextureFont(font_file_name.c_str());
127 else if ( mode == EMFTGL::EXTRUDE ) {
128 font =
new FTGLExtrdFont(font_file_name.c_str());
131 else if ( mode == EMFTGL::BITMAP ) {
132 font =
new FTGLBitmapFont(font_file_name.c_str());
135 else if ( mode == EMFTGL::POLYGON ) {
136 font =
new FTGLPolygonFont(font_file_name.c_str());
139 else if ( mode == EMFTGL::OUTLINE ) {
140 font =
new FTGLOutlineFont(font_file_name.c_str());
144 LOGERR(
"Error, unsupported mode ");
150 LOGERR(
string(
"Could not open font file " + font_file_name).c_str());
154 font->UseDisplayList(use_display_lists);
155 font->FaceSize(face_size);
159bool EMFTGL::EMFTGLFontInstance::params_match(
EMFTGL::FontMode mode,
const string& file_name,
const unsigned int face_size,
const unsigned int depth,
const bool use_dl) {
EMFTGLFontInstance(EMFTGL::FontMode mode, const string &file_name, const unsigned int face_size, const unsigned int d, const bool use_dl)
Constructor - must supply the 5 important parameters.
EMFTGL::FontMode font_mode
Disallow copy construction.
vector< EMFTGLFontInstance * > font_instances
Disallow copy construction.
FTFont * get_font(EMFTGL::FontMode mode, const string &file_name, const unsigned int face_size, const unsigned int d, const bool use_dl)
Get a font with the associated parameters.
string font_file_name
Disallow copy construction.
vector< float > bounding_box(const string &message)
Obtains the bounding box of the given message, as would be rendered using the current state variables...
FontMode
FontModes correspond to the different FTFont types - this correspondence is EXTRUDE - FTGLExtrdFont,...