mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Directly use the family name in QFontInfo to ascertain whether the requested
font is available. This is now possible because the old bug needing a workaround has been solved in Qt4. This also solves the problem of missing integral symbols in mathed on Windows when the esint10 font is not available. * src/frontends/qt4/GuiFontLoader.C (isSymbolFamily): directly check the family name in QFontInfo. (getSymbolFont): add some debugging info. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16191 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
fd44f28cae
commit
30ba00a0c3
@ -131,32 +131,19 @@ bool isSymbolFamily(LyXFont::FONT_FAMILY family)
|
||||
|
||||
bool isChosenFont(QFont & font, string const & family)
|
||||
{
|
||||
lyxerr[Debug::FONT] << "raw: " << fromqstr(font.rawName()) << endl;
|
||||
|
||||
QFontInfo fi(font);
|
||||
// QFontInfo won't find a font that has only a few glyphs at unusual
|
||||
// positions, e.g. the original esint10 font.
|
||||
// The workaround is to add dummy glyphs at least at all ASCII
|
||||
// positions.
|
||||
QFontInfo fi(font);
|
||||
|
||||
// Note Qt lies about family quite often
|
||||
lyxerr[Debug::FONT] << "alleged fi family: "
|
||||
<< fromqstr(fi.family()) << endl;
|
||||
lyxerr[Debug::FONT] << "got: " << fromqstr(fi.family()) << endl;
|
||||
|
||||
// So we check rawName first
|
||||
if (contains(fromqstr(font.rawName()), family)) {
|
||||
if (contains(fromqstr(fi.family()), family)) {
|
||||
lyxerr[Debug::FONT] << " got it ";
|
||||
return true;
|
||||
}
|
||||
|
||||
// Qt 4.1 returns "Multi" for all ? xft fonts
|
||||
if (font.rawName() == "xft" || font.rawName() == "Multi") {
|
||||
if (contains(fromqstr(fi.family()), family)) {
|
||||
lyxerr[Debug::FONT] << " got it (Xft) ";
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -177,6 +164,7 @@ pair<QFont, bool> const getSymbolFont(string const & family)
|
||||
return make_pair<QFont, bool>(font, true);
|
||||
}
|
||||
|
||||
lyxerr[Debug::FONT] << "Trying " << upper << " ... ";
|
||||
font.setFamily(toqstr(upper));
|
||||
|
||||
if (isChosenFont(font, upper)) {
|
||||
@ -186,7 +174,9 @@ pair<QFont, bool> const getSymbolFont(string const & family)
|
||||
|
||||
// A simple setFamily() fails on Qt 2
|
||||
|
||||
font.setRawName(toqstr(getRawName(family)));
|
||||
string const rawName = getRawName(family);
|
||||
lyxerr[Debug::FONT] << "Trying " << rawName << " ... ";
|
||||
font.setRawName(toqstr(rawName));
|
||||
|
||||
if (isChosenFont(font, family)) {
|
||||
lyxerr[Debug::FONT] << "raw version!" << endl;
|
||||
|
Loading…
Reference in New Issue
Block a user