use theApp directly for default fonts.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15214 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2006-10-03 14:21:15 +00:00
parent f1d2dfadbc
commit 1b8c2a95df
7 changed files with 18 additions and 47 deletions

View File

@ -45,30 +45,4 @@ FuncStatus getStatus(FuncRequest const & ev)
}
string const roman_font_name()
{
if (!use_gui)
return "serif";
return theApp->romanFontName();
}
string const sans_font_name()
{
if (!use_gui)
return "sans";
return theApp->sansFontName();
}
string const typewriter_font_name()
{
if (!use_gui)
return "monospace";
return theApp->typewriterFontName();
}
}; // namespace lyx_gui

View File

@ -36,15 +36,6 @@ namespace lyx_gui {
/// are we using the GUI at all
extern bool use_gui;
/// return a suitable serif font name (called from non-gui context too !)
std::string const roman_font_name();
/// return a suitable sans serif font name (called from non-gui context too !)
std::string const sans_font_name();
/// return a suitable monospaced font name (called from non-gui context too !)
std::string const typewriter_font_name();
/**
* set up GUI parameters. At this point lyxrc may
* be used.

View File

@ -439,13 +439,13 @@ void setComboxFont(QComboBox * cb, string const & family, string const & foundry
QFont font;
if (family == lyx_gui::roman_font_name()) {
if (family == theApp->romanFontName()) {
font.setStyleHint(QFont::Serif);
font.setFamily(family.c_str());
} else if (family == lyx_gui::sans_font_name()) {
} else if (family == theApp->sansFontName()) {
font.setStyleHint(QFont::SansSerif);
font.setFamily(family.c_str());
} else if (family == lyx_gui::typewriter_font_name()) {
} else if (family == theApp->typewriterFontName()) {
font.setStyleHint(QFont::TypeWriter);
font.setFamily(family.c_str());
} else {

View File

@ -40,7 +40,7 @@ void QViewSource::build_dialog()
dialog_->viewSourceTV->setReadOnly(true);
dialog_->viewSourceTV->setTextFormat(Qt::PlainText);
// this is personal. I think source code should be in fixed-size font
QFont font(toqstr(lyx_gui::typewriter_font_name()));
QFont font(toqstr(theApp->typewriterFontName()));
font.setFixedPitch(true);
font.setStyleHint(QFont::TypeWriter);
dialog_->viewSourceTV->setFont(font);

View File

@ -130,13 +130,13 @@ void setComboxFont(QComboBox * cb, string const & family, string const & foundry
QFont font;
if (family == lyx_gui::roman_font_name()) {
if (family == theApp->romanFontName()) {
font.setStyleHint(QFont::Serif);
font.setFamily(family.c_str());
} else if (family == lyx_gui::sans_font_name()) {
} else if (family == theApp->sansFontName()) {
font.setStyleHint(QFont::SansSerif);
font.setFamily(family.c_str());
} else if (family == lyx_gui::typewriter_font_name()) {
} else if (family == theApp->typewriterFontName()) {
font.setStyleHint(QFont::TypeWriter);
font.setFamily(family.c_str());
} else {

View File

@ -14,7 +14,8 @@
#include "QViewSource.h"
#include "QViewSourceDialog.h"
#include "qt_helpers.h"
#include "lyx_gui.h"
#include "frontends/Application.h"
#include "controllers/ControlViewSource.h"
@ -90,7 +91,7 @@ void QViewSource::build_dialog()
dialog_->viewSourceTV->setReadOnly(true);
///dialog_->viewSourceTV->setAcceptRichText(false);
// this is personal. I think source code should be in fixed-size font
QFont font(toqstr(lyx_gui::typewriter_font_name()));
QFont font(toqstr(theApp->typewriterFontName()));
font.setFixedPitch(true);
font.setStyleHint(QFont::TypeWriter);
dialog_->viewSourceTV->setFont(font);

View File

@ -499,11 +499,16 @@ bool LyX::init()
}
if (lyxrc.roman_font_name.empty())
lyxrc.roman_font_name = lyx_gui::roman_font_name();
lyxrc.roman_font_name =
lyx_gui::use_gui? theApp->romanFontName(): "serif";
if (lyxrc.sans_font_name.empty())
lyxrc.sans_font_name = lyx_gui::sans_font_name();
lyxrc.sans_font_name =
lyx_gui::use_gui? theApp->sansFontName(): "sans";
if (lyxrc.typewriter_font_name.empty())
lyxrc.typewriter_font_name = lyx_gui::typewriter_font_name();
lyxrc.typewriter_font_name =
lyx_gui::use_gui? theApp->typewriterFontName(): "monospace";
//
// Read configuration files