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