forked from wang-bin/QtAV
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ass: use libass supported path. No fonts dir if font file is set
if ass_set_fonts_dir is called, libass will scan fonts and it's slow
- Loading branch information
Showing
1 changed file
with
7 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
/****************************************************************************** | ||
QtAV: Media play library based on Qt and LibASS | ||
Copyright (C) 2014-2016 Wang Bin <[email protected]> | ||
QtAV: Multimedia framework based on Qt and LibASS | ||
Copyright (C) 2012-2016 Wang Bin <[email protected]> | ||
* This file is part of QtAV | ||
* This file is part of QtAV (from 2014) | ||
This library is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public | ||
|
@@ -570,16 +570,17 @@ void SubtitleProcessorLibASS::updateFontCache() | |
family = QByteArrayLiteral("Arial"); | ||
} | ||
// prefer user settings | ||
const QString kFont = font_file.isEmpty() ? sFont : font_file; | ||
const QString kFontsDir = fonts_dir.isEmpty() ? sFontsDir : fonts_dir; | ||
const QString kFont = font_file.isEmpty() ? sFont : Internal::Path::toLocal(font_file); | ||
const QString kFontsDir = fonts_dir.isEmpty() ? sFontsDir : Internal::Path::toLocal(fonts_dir); | ||
qDebug() << "font file: " << kFont << "; fonts dir: " << kFontsDir; | ||
// setup libass | ||
#ifdef Q_OS_WINRT | ||
if (!kFontsDir.isEmpty()) | ||
qDebug("BUG: winrt libass set a valid fonts dir results in crash. skip fonts dir setup."); | ||
#else | ||
// will call strdup, so safe to use temp array .toUtf8().constData() | ||
ass_set_fonts_dir(m_ass, kFontsDir.isEmpty() ? 0 : kFontsDir.toUtf8().constData()); // look up fonts in fonts dir can be slow. force font file to skip lookup | ||
if (!force_font_file || (!font_file.isEmpty() && !QFile::exists(kFont))) | ||
ass_set_fonts_dir(m_ass, kFontsDir.isEmpty() ? 0 : kFontsDir.toUtf8().constData()); // look up fonts in fonts dir can be slow. force font file to skip lookup | ||
#endif | ||
/* ass_set_fonts: | ||
* fc/dfp=false(auto font provider): Prefer font provider to find a font(FC needs fonts.conf) in font_dir, or provider's configuration. If failed, try the given font | ||
|