#include "frontends/font_metrics.h"
#include "frontends/lyx_gui.h"
-#include "Application.h"
+#include "GuiApplication.h"
#include "FontLoader.h"
#include "qt_helpers.h"
LyXFont smallfont = f;
smallfont.decSize().decSize().setShape(LyXFont::UP_SHAPE);
- QFontMetrics const & qm = theApp->fontLoader().metrics(f);
- QFontMetrics const & qsmallm = theApp->fontLoader().metrics(smallfont);
+ QFontMetrics const & qm = guiApp->guiFontLoader().metrics(f);
+ QFontMetrics const & qsmallm = guiApp->guiFontLoader().metrics(smallfont);
int w = 0;
- size_t const ls = s.size();
+ int const ls = s.size();
- for (size_t i = 0; i < ls; ++i) {
+ for (int i = 0; i < ls; ++i) {
QChar const & c = s[i];
QChar const uc = c.toUpper();
if (c != uc)
{
if (!lyx_gui::use_gui)
return 1;
- return theApp->fontLoader().metrics(f).ascent();
+ return guiApp->guiFontLoader().metrics(f).ascent();
}
return 1;
// We add 1 as the value returned by QT is different than X
// See http://doc.trolltech.com/2.3/qfontmetrics.html#200b74
- return theApp->fontLoader().metrics(f).descent() + 1;
+ return guiApp->guiFontLoader().metrics(f).descent() + 1;
}
{
if (!lyx_gui::use_gui)
return 1;
- QRect const & r = theApp->fontLoader().metrics(f).boundingRect(ucs4_to_qchar(c));
+ QRect const & r = guiApp->guiFontLoader().metrics(f).boundingRect(ucs4_to_qchar(c));
// Qt/Win 3.2.1nc (at least) corrects the GetGlyphOutlineA|W y
// value by the height: (x, -y-height, width, height).
// Other versions return: (x, -y, width, height)
{
if (!lyx_gui::use_gui)
return 1;
- QRect const & r = theApp->fontLoader().metrics(f).boundingRect(ucs4_to_qchar(c));
+ QRect const & r = guiApp->guiFontLoader().metrics(f).boundingRect(ucs4_to_qchar(c));
// Qt/Win 3.2.1nc (at least) corrects the GetGlyphOutlineA|W y
// value by the height: (x, -y-height, width, height).
// Other versions return: (x, -y, width, height)
{
if (!lyx_gui::use_gui)
return 1;
- return theApp->fontLoader().metrics(f).leftBearing(ucs4_to_qchar(c));
+ return guiApp->guiFontLoader().metrics(f).leftBearing(ucs4_to_qchar(c));
}
{
if (!lyx_gui::use_gui)
return 1;
- QFontMetrics const & m = theApp->fontLoader().metrics(f);
+ QFontMetrics const & m = guiApp->guiFontLoader().metrics(f);
// Qt rbearing is from the right edge of the char's width().
QChar sc = ucs4_to_qchar(c);
if (f.realShape() == LyXFont::SMALLCAPS_SHAPE)
return smallcapswidth(ucs2, f);
- QLFontInfo & fi = theApp->fontLoader().fontinfo(f);
+ lyx::frontend::QLFontInfo & fi = guiApp->guiFontLoader().fontinfo(f);
if (ls == 1)
return fi.width(ucs2[0].unicode());
int w = 0;
- for (size_t i = 0; i < ls; ++i)
+ for (unsigned int i = 0; i < ls; ++i)
w += fi.width(ucs2[i].unicode());
return w;
void font_metrics::rectText(docstring const & str, LyXFont const & f,
int & w, int & ascent, int & descent)
{
- QFontMetrics const & m = theApp->fontLoader().metrics(f);
+ QFontMetrics const & m = guiApp->guiFontLoader().metrics(f);
static int const d = 2;
w = width(str, f) + d * 2 + 2;
ascent = m.ascent() + d;
void font_metrics::buttonText(docstring const & str, LyXFont const & f,
int & w, int & ascent, int & descent)
{
- QFontMetrics const & m = theApp->fontLoader().metrics(f);
+ QFontMetrics const & m = guiApp->guiFontLoader().metrics(f);
static int const d = 3;
w = width(str, f) + d * 2 + 2;
ascent = m.ascent() + d;