mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-27 03:36:39 +00:00
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:
parent
f1d2dfadbc
commit
1b8c2a95df
@ -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
|
}; // namespace lyx_gui
|
||||||
|
@ -36,15 +36,6 @@ namespace lyx_gui {
|
|||||||
/// are we using the GUI at all
|
/// are we using the GUI at all
|
||||||
extern bool use_gui;
|
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
|
* set up GUI parameters. At this point lyxrc may
|
||||||
* be used.
|
* be used.
|
||||||
|
@ -439,13 +439,13 @@ void setComboxFont(QComboBox * cb, string const & family, string const & foundry
|
|||||||
|
|
||||||
QFont font;
|
QFont font;
|
||||||
|
|
||||||
if (family == lyx_gui::roman_font_name()) {
|
if (family == theApp->romanFontName()) {
|
||||||
font.setStyleHint(QFont::Serif);
|
font.setStyleHint(QFont::Serif);
|
||||||
font.setFamily(family.c_str());
|
font.setFamily(family.c_str());
|
||||||
} else if (family == lyx_gui::sans_font_name()) {
|
} else if (family == theApp->sansFontName()) {
|
||||||
font.setStyleHint(QFont::SansSerif);
|
font.setStyleHint(QFont::SansSerif);
|
||||||
font.setFamily(family.c_str());
|
font.setFamily(family.c_str());
|
||||||
} else if (family == lyx_gui::typewriter_font_name()) {
|
} else if (family == theApp->typewriterFontName()) {
|
||||||
font.setStyleHint(QFont::TypeWriter);
|
font.setStyleHint(QFont::TypeWriter);
|
||||||
font.setFamily(family.c_str());
|
font.setFamily(family.c_str());
|
||||||
} else {
|
} else {
|
||||||
|
@ -40,7 +40,7 @@ void QViewSource::build_dialog()
|
|||||||
dialog_->viewSourceTV->setReadOnly(true);
|
dialog_->viewSourceTV->setReadOnly(true);
|
||||||
dialog_->viewSourceTV->setTextFormat(Qt::PlainText);
|
dialog_->viewSourceTV->setTextFormat(Qt::PlainText);
|
||||||
// this is personal. I think source code should be in fixed-size font
|
// 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.setFixedPitch(true);
|
||||||
font.setStyleHint(QFont::TypeWriter);
|
font.setStyleHint(QFont::TypeWriter);
|
||||||
dialog_->viewSourceTV->setFont(font);
|
dialog_->viewSourceTV->setFont(font);
|
||||||
|
@ -130,13 +130,13 @@ void setComboxFont(QComboBox * cb, string const & family, string const & foundry
|
|||||||
|
|
||||||
QFont font;
|
QFont font;
|
||||||
|
|
||||||
if (family == lyx_gui::roman_font_name()) {
|
if (family == theApp->romanFontName()) {
|
||||||
font.setStyleHint(QFont::Serif);
|
font.setStyleHint(QFont::Serif);
|
||||||
font.setFamily(family.c_str());
|
font.setFamily(family.c_str());
|
||||||
} else if (family == lyx_gui::sans_font_name()) {
|
} else if (family == theApp->sansFontName()) {
|
||||||
font.setStyleHint(QFont::SansSerif);
|
font.setStyleHint(QFont::SansSerif);
|
||||||
font.setFamily(family.c_str());
|
font.setFamily(family.c_str());
|
||||||
} else if (family == lyx_gui::typewriter_font_name()) {
|
} else if (family == theApp->typewriterFontName()) {
|
||||||
font.setStyleHint(QFont::TypeWriter);
|
font.setStyleHint(QFont::TypeWriter);
|
||||||
font.setFamily(family.c_str());
|
font.setFamily(family.c_str());
|
||||||
} else {
|
} else {
|
||||||
|
@ -14,7 +14,8 @@
|
|||||||
#include "QViewSource.h"
|
#include "QViewSource.h"
|
||||||
#include "QViewSourceDialog.h"
|
#include "QViewSourceDialog.h"
|
||||||
#include "qt_helpers.h"
|
#include "qt_helpers.h"
|
||||||
#include "lyx_gui.h"
|
|
||||||
|
#include "frontends/Application.h"
|
||||||
|
|
||||||
#include "controllers/ControlViewSource.h"
|
#include "controllers/ControlViewSource.h"
|
||||||
|
|
||||||
@ -90,7 +91,7 @@ void QViewSource::build_dialog()
|
|||||||
dialog_->viewSourceTV->setReadOnly(true);
|
dialog_->viewSourceTV->setReadOnly(true);
|
||||||
///dialog_->viewSourceTV->setAcceptRichText(false);
|
///dialog_->viewSourceTV->setAcceptRichText(false);
|
||||||
// this is personal. I think source code should be in fixed-size font
|
// 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.setFixedPitch(true);
|
||||||
font.setStyleHint(QFont::TypeWriter);
|
font.setStyleHint(QFont::TypeWriter);
|
||||||
dialog_->viewSourceTV->setFont(font);
|
dialog_->viewSourceTV->setFont(font);
|
||||||
|
@ -499,11 +499,16 @@ bool LyX::init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (lyxrc.roman_font_name.empty())
|
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())
|
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())
|
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
|
// Read configuration files
|
||||||
|
Loading…
Reference in New Issue
Block a user