Introducing Font::validate().

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21070 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-10-19 16:22:36 +00:00
parent 3372738c6d
commit 85cae8965e
3 changed files with 49 additions and 45 deletions

View File

@ -17,11 +17,12 @@
#include "Font.h"
#include "BufferParams.h" // stateText
#include "Color.h"
#include "debug.h"
#include "Encoding.h"
#include "gettext.h"
#include "Language.h"
#include "Color.h"
#include "LaTeXFeatures.h"
#include "Lexer.h"
#include "LyXRC.h"
#include "output_latex.h"
@ -1070,6 +1071,47 @@ bool Font::fromString(string const & data, bool & toggle)
}
void Font::validate(LaTeXFeatures & features) const
{
BufferParams const & bparams = features.bufferParams();
Language const * doc_language = bparams.language;
if (noun() == Font::ON) {
LYXERR(Debug::LATEX) << "font.noun: "
<< noun()
<< endl;
features.require("noun");
LYXERR(Debug::LATEX) << "Noun enabled. Font: "
<< to_utf8(stateText(0))
<< endl;
}
switch (color()) {
case Color::none:
case Color::inherit:
case Color::ignore:
// probably we should put here all interface colors used for
// font displaying! For now I just add this ones I know of (Jug)
case Color::latex:
case Color::note:
break;
default:
features.require("color");
LYXERR(Debug::LATEX) << "Color enabled. Font: "
<< to_utf8(stateText(0))
<< endl;
}
if (lang->babel() != doc_language->babel() &&
lang != ignore_language &&
lang != latex_language)
{
features.useLanguage(lang);
LYXERR(Debug::LATEX) << "Found language "
<< lang->lang() << endl;
}
}
ostream & operator<<(ostream & os, Font::FONT_MISC_STATE fms)
{
return os << int(fms);

View File

@ -28,6 +28,7 @@ namespace lyx {
class Lexer;
class BufferParams;
class Language;
class LaTeXFeatures;
class OutputParams;
///
@ -321,6 +322,9 @@ public:
///
Color_color realColor() const;
///
void validate(LaTeXFeatures & features) const;
///
friend
bool operator==(Font const & font1, Font const & font2);

View File

@ -20,11 +20,6 @@
#include "FontList.h"
#include "BufferParams.h"
#include "debug.h"
#include "Language.h"
#include "LaTeXFeatures.h"
#include <boost/next_prior.hpp>
#include <algorithm>
@ -235,47 +230,10 @@ bool FontList::hasChangeInRange(pos_type pos, int len) const
void FontList::validate(LaTeXFeatures & features) const
{
BufferParams const & bparams = features.bufferParams();
Language const * doc_language = bparams.language;
const_iterator fcit = list_.begin();
const_iterator fend = list_.end();
for (; fcit != fend; ++fcit) {
if (fcit->font().noun() == Font::ON) {
LYXERR(Debug::LATEX) << "font.noun: "
<< fcit->font().noun()
<< endl;
features.require("noun");
LYXERR(Debug::LATEX) << "Noun enabled. Font: "
<< to_utf8(fcit->font().stateText(0))
<< endl;
}
switch (fcit->font().color()) {
case Color::none:
case Color::inherit:
case Color::ignore:
// probably we should put here all interface colors used for
// font displaying! For now I just add this ones I know of (Jug)
case Color::latex:
case Color::note:
break;
default:
features.require("color");
LYXERR(Debug::LATEX) << "Color enabled. Font: "
<< to_utf8(fcit->font().stateText(0))
<< endl;
}
Language const * language = fcit->font().language();
if (language->babel() != doc_language->babel() &&
language != ignore_language &&
language != latex_language)
{
features.useLanguage(language);
LYXERR(Debug::LATEX) << "Found language "
<< language->lang() << endl;
}
}
for (; fcit != fend; ++fcit)
fcit->font().validate(features);
}
} // namespace lyx