mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-07 03:13:49 +00:00
Implement linux support for OSD font settings
This commit is contained in:
parent
6d47fa5c48
commit
deb84826e4
|
@ -9,6 +9,7 @@
|
||||||
#include <QCursor>
|
#include <QCursor>
|
||||||
#include <QRegExpValidator>
|
#include <QRegExpValidator>
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
|
#include <QDirIterator>
|
||||||
|
|
||||||
#include "../Config.h"
|
#include "../Config.h"
|
||||||
#include "../DebugDump.h"
|
#include "../DebugDump.h"
|
||||||
|
@ -936,15 +937,15 @@ void ConfigDialog::on_tabWidget_currentChanged(int tab)
|
||||||
ui->tabWidget->setCursor(QCursor(Qt::WaitCursor));
|
ui->tabWidget->setCursor(QCursor(Qt::WaitCursor));
|
||||||
|
|
||||||
QMap<QString, QStringList> internalFontList;
|
QMap<QString, QStringList> internalFontList;
|
||||||
QDir fontDir(QStandardPaths::locate(QStandardPaths::FontsLocation, QString(), QStandardPaths::LocateDirectory));
|
QString fontDir = QStandardPaths::locate(QStandardPaths::FontsLocation, QString(), QStandardPaths::LocateDirectory);
|
||||||
QStringList fontFilter;
|
QStringList fontFilter;
|
||||||
fontFilter << "*.ttf";
|
fontFilter << "*.ttf";
|
||||||
fontDir.setNameFilters(fontFilter);
|
QDirIterator fontIt(fontDir, fontFilter, QDir::Files, QDirIterator::Subdirectories);
|
||||||
QFileInfoList fontList = fontDir.entryInfoList();
|
while (fontIt.hasNext()) {
|
||||||
for (int i = 0; i < fontList.size(); ++i) {
|
QString font = fontIt.next();
|
||||||
int id = QFontDatabase::addApplicationFont(fontList.at(i).absoluteFilePath());
|
int id = QFontDatabase::addApplicationFont(font);
|
||||||
QString fontListFamily = QFontDatabase::applicationFontFamilies(id).at(0);
|
QString fontListFamily = QFontDatabase::applicationFontFamilies(id).at(0);
|
||||||
internalFontList[fontListFamily].append(fontList.at(i).fileName());
|
internalFontList[fontListFamily].append(font);
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<QString, QStringList>::const_iterator i;
|
QMap<QString, QStringList>::const_iterator i;
|
||||||
|
|
|
@ -25,9 +25,10 @@
|
||||||
|
|
||||||
#include "TextDrawer.h"
|
#include "TextDrawer.h"
|
||||||
|
|
||||||
|
#include <osal_files.h>
|
||||||
|
|
||||||
#ifdef MUPENPLUSAPI
|
#ifdef MUPENPLUSAPI
|
||||||
#include "mupenplus/GLideN64_mupenplus.h"
|
#include "mupenplus/GLideN64_mupenplus.h"
|
||||||
#include <osal_files.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace graphics;
|
using namespace graphics;
|
||||||
|
@ -212,6 +213,12 @@ bool getFontFileName(char * _strName)
|
||||||
#else
|
#else
|
||||||
sprintf(_strName, "/usr/share/fonts/truetype/freefont/%s", config.font.name.c_str());
|
sprintf(_strName, "/usr/share/fonts/truetype/freefont/%s", config.font.name.c_str());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// if the font name is a full path, use that instead
|
||||||
|
if (osal_path_existsA(config.font.name.c_str())) {
|
||||||
|
sprintf(_strName, "%s", config.font.name.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef MUPENPLUSAPI
|
#ifdef MUPENPLUSAPI
|
||||||
if (!osal_path_existsA(_strName)) {
|
if (!osal_path_existsA(_strName)) {
|
||||||
const char * fontPath = ConfigGetSharedDataFilepath("font.ttf");
|
const char * fontPath = ConfigGetSharedDataFilepath("font.ttf");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user