#include "GuiFontLoader.h"
#include "qt_helpers.h"
-#include "debug.h"
#include "LyXRC.h"
#include "support/convert.h"
+#include "support/debug.h"
#include "support/filetools.h"
#include "support/lstrings.h"
#include "support/Systemcall.h"
#include "support/Package.h"
#include "support/os.h"
-#include <boost/tuple/tuple.hpp>
-
#include <QFontInfo>
#include <QFontDatabase>
-using std::make_pair;
-
-using std::pair;
-using std::vector;
+using namespace std;
+using namespace lyx::support;
QString const math_fonts[] = {"cmex10", "cmmi10", "cmr10", "cmsy10",
"eufm10", "msam10", "msbm10", "wasy10", "esint10"};
namespace lyx {
-using support::contains;
-using support::package;
-using support::addPath;
-using support::addName;
-
extern docstring const stateText(FontInfo const & f);
namespace frontend {
}
-static pair<QFont, bool> const getSymbolFont(QString const & family)
+QFont symbolFont(QString const & family, bool * ok)
{
LYXERR(Debug::FONT, "Looking for font family "
<< fromqstr(family) << " ... ");
if (isChosenFont(font, family)) {
LYXERR(Debug::FONT, "normal!");
- return make_pair<QFont, bool>(font, true);
+ *ok = true;
+ return font;
}
LYXERR(Debug::FONT, "Trying " << fromqstr(upper) << " ... ");
if (isChosenFont(font, upper)) {
LYXERR(Debug::FONT, "upper!");
- return make_pair<QFont, bool>(font, true);
+ *ok = true;
+ return font;
}
// A simple setFamily() fails on Qt 2
if (isChosenFont(font, family)) {
LYXERR(Debug::FONT, "raw version!");
- return make_pair<QFont, bool>(font, true);
+ *ok = true;
+ return font;
}
LYXERR(Debug::FONT, " FAILED :-(");
- return make_pair<QFont, bool>(font, false);
+ *ok = false;
+ return font;
}
} // namespace anon
}
+GuiFontLoader::~GuiFontLoader()
+{
+ update();
+}
+
/////////////////////////////////////////////////
GuiFontInfo::GuiFontInfo(FontInfo const & f)
+ : metrics(QFont())
{
font.setKerning(false);
QString const pat = symbolFamily(f.family());
if (!pat.isEmpty()) {
- bool tmp;
- boost::tie(font, tmp) = getSymbolFont(pat);
+ bool ok;
+ font = symbolFont(pat, &ok);
} else {
switch (f.family()) {
case ROMAN_FAMILY: {
LYXERR(Debug::FONT, "The font has size: " << font.pointSizeF());
if (f.realShape() != SMALLCAPS_SHAPE) {
- metrics.reset(new GuiFontMetrics(font));
+ metrics = GuiFontMetrics(font);
} else {
// handle small caps ourselves ...
FontInfo smallfont = f;
font2.setPointSizeF(convert<double>(lyxrc.font_sizes[smallfont.size()])
* lyxrc.zoom / 100.0);
- metrics.reset(new GuiFontMetrics(font, font2));
+ metrics = GuiFontMetrics(font, font2);
}
-
}
// We don't care about non-symbol fonts
return false;
- pair<QFont, bool> tmp = getSymbolFont(pat);
- if (!tmp.second)
+ bool ok;
+ symbolFont(pat, &ok);
+ if (!ok)
return false;
cache[family] = true;