Bundle an empty font file and pass it to projectM so it doesn't crash when FTGL is turned on.

This commit is contained in:
David Sansome 2010-07-18 13:26:01 +00:00
parent 11e18bb22f
commit 1a5f865d53
4 changed files with 15 additions and 1 deletions

BIN
data/blank.ttf Normal file

Binary file not shown.

View File

@ -250,5 +250,6 @@
<file>icons/32x32/go-down.png</file>
<file>icons/48x48/go-down.png</file>
<file>hypnotoad.gif</file>
<file>blank.ttf</file>
</qresource>
</RCC>

View File

@ -28,6 +28,7 @@
#include <QPaintEngine>
#include <QPainter>
#include <QSettings>
#include <QTemporaryFile>
#include <QtDebug>
#include <QTimerEvent>
@ -92,6 +93,12 @@ void ProjectMVisualisation::InitProjectM() {
break;
}
// Write an empty font out to a temporary directory. libprojectM dies if it's
// compiled with FTGL support and you pass it an empty font URL, so we have
// to give it a dummy font even though we won't use it.
temporary_font_.reset(QTemporaryFile::createLocalFile(":blank.ttf"));
const QString font_path = temporary_font_->fileName();
// Create projectM settings
projectM::Settings s;
s.meshX = 32;
@ -106,12 +113,14 @@ void ProjectMVisualisation::InitProjectM() {
s.shuffleEnabled = true;
s.easterEgg = 0; // ??
s.softCutRatingsEnabled = false;
s.menuFontURL = font_path.toStdString();
s.titleFontURL = font_path.toStdString();
projectm_.reset(new projectM(s));
preset_model_ = new ProjectMPresetModel(this, this);
Load();
if (preset_path.isNull()) {
if (font_path.isNull()) {
qWarning("ProjectM presets could not be found, search path was:\n %s",
paths.join("\n ").toLocal8Bit().constData());
QMessageBox::warning(NULL, tr("Missing projectM presets"),

View File

@ -29,6 +29,8 @@ class projectM;
class ProjectMPresetModel;
class QTemporaryFile;
class ProjectMVisualisation : public QGraphicsScene, public BufferConsumer {
Q_OBJECT
public:
@ -79,6 +81,8 @@ private:
Mode mode_;
int duration_;
boost::scoped_ptr<QTemporaryFile> temporary_font_;
std::vector<int> default_rating_list_;
int texture_size_;