QString Paths::fontPath() { QString path = appPath() + "/mplayer/fonts"; QDir font_dir(path); QStringList files = font_dir.entryList(QStringList() << "*.ttf" << "*.otf", QDir::Files); //qDebug("Paths:fontPath: files in %s: %d", path.toUtf8().constData(), files.count()); if (files.count() > 0) { return path; } else { return appPath() + "/open-fonts"; } }
void font_impl::get_font_dir() { #ifdef WIN32 smart_pointer<wchar_t, true> buf(new wchar_t[MAX_PATH]); if (SUCCEEDED(SHGetFolderPath(0, CSIDL_WINDOWS, 0, 0, buf))) { string path(buf); io::directory font_dir(path); const_cast<string &>(FONT_DIR) = font_dir.get_full_path() + L"Fonts" + io::directory::SEPARATOR; } else { throw io_exception(L"unable to find system font directory"); } #endif } // font_impl::get_font_dir()