mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-14 04:21:56 +00:00
Fix crash with old versions (earlier than 2.2.92) of fontconfig.
* src/frontends/qt4/GuiFontLoader.{cpp,h} (GuiFontLoader::GuiFontLoader): don't store font IDs anymore, as we are not going to clean up after ourselves. (GuiFontLoader::~GuiFontLoader): make it virtual again and do nothing (avoids a crash with fontconfig < 2.2.92). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_5_X@20247 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
4a9c102a5e
commit
23456280af
@ -202,19 +202,17 @@ pair<QFont, bool> const getSymbolFont(string const & family)
|
|||||||
GuiFontLoader::GuiFontLoader()
|
GuiFontLoader::GuiFontLoader()
|
||||||
{
|
{
|
||||||
#if QT_VERSION >= 0x040200
|
#if QT_VERSION >= 0x040200
|
||||||
fontID = new int[num_math_fonts];
|
|
||||||
|
|
||||||
string const fonts_dir =
|
string const fonts_dir =
|
||||||
addPath(package().system_support().absFilename(), "fonts");
|
addPath(package().system_support().absFilename(), "fonts");
|
||||||
|
|
||||||
for (int i = 0 ; i < num_math_fonts; ++i) {
|
for (int i = 0 ; i < num_math_fonts; ++i) {
|
||||||
string const font_file = lyx::support::os::external_path(
|
string const font_file = lyx::support::os::external_path(
|
||||||
addName(fonts_dir, math_fonts[i] + ".ttf"));
|
addName(fonts_dir, math_fonts[i] + ".ttf"));
|
||||||
fontID[i] = QFontDatabase::addApplicationFont(toqstr(font_file));
|
int fontID = QFontDatabase::addApplicationFont(toqstr(font_file));
|
||||||
|
|
||||||
LYXERR(Debug::FONT) << "Adding font " << font_file
|
LYXERR(Debug::FONT) << "Adding font " << font_file
|
||||||
<< static_cast<const char *>
|
<< static_cast<const char *>
|
||||||
(fontID[i] < 0 ? " FAIL" : " OK")
|
(fontID < 0 ? " FAIL" : " OK")
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -227,19 +225,6 @@ GuiFontLoader::GuiFontLoader()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GuiFontLoader::~GuiFontLoader()
|
|
||||||
{
|
|
||||||
#if QT_VERSION >= 0x040200
|
|
||||||
for (int i = 0 ; i < num_math_fonts; ++i) {
|
|
||||||
if (fontID[i] >= 0)
|
|
||||||
QFontDatabase::removeApplicationFont(fontID[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
delete [] fontID;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GuiFontLoader::update()
|
void GuiFontLoader::update()
|
||||||
{
|
{
|
||||||
for (int i1 = 0; i1 < Font::NUM_FAMILIES; ++i1)
|
for (int i1 = 0; i1 < Font::NUM_FAMILIES; ++i1)
|
||||||
|
@ -47,7 +47,7 @@ public:
|
|||||||
GuiFontLoader();
|
GuiFontLoader();
|
||||||
|
|
||||||
/// Destructor
|
/// Destructor
|
||||||
~GuiFontLoader();
|
virtual ~GuiFontLoader() {}
|
||||||
|
|
||||||
virtual void update();
|
virtual void update();
|
||||||
virtual bool available(Font const & f);
|
virtual bool available(Font const & f);
|
||||||
@ -73,9 +73,6 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#if QT_VERSION >= 0x040200
|
|
||||||
int * fontID;
|
|
||||||
#endif
|
|
||||||
/// BUTT ugly !
|
/// BUTT ugly !
|
||||||
QLFontInfo * fontinfo_[Font::NUM_FAMILIES][2][4][10];
|
QLFontInfo * fontinfo_[Font::NUM_FAMILIES][2][4][10];
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user