2003-07-26 00:17:21 +00:00
|
|
|
/**
|
2007-04-29 18:17:15 +00:00
|
|
|
* \file tex2lyx/Font.cpp
|
2003-08-19 10:04:35 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2003-07-26 00:17:21 +00:00
|
|
|
*
|
2003-08-19 10:04:35 +00:00
|
|
|
* \author Angus Leeming
|
2003-07-26 00:17:21 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2003-07-26 00:17:21 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2007-04-29 18:17:15 +00:00
|
|
|
#include "Font.h"
|
2007-04-26 11:30:54 +00:00
|
|
|
#include "Lexer.h"
|
2003-07-26 00:17:21 +00:00
|
|
|
#include "support/lstrings.h"
|
|
|
|
|
2007-10-28 18:51:54 +00:00
|
|
|
using std::string;
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
2003-09-09 22:13:45 +00:00
|
|
|
using lyx::support::ascii_lowercase;
|
2003-07-26 00:17:21 +00:00
|
|
|
|
2007-10-28 18:51:54 +00:00
|
|
|
/// Sane font.
|
|
|
|
FontInfo const sane_font;
|
|
|
|
/// All inherit font.
|
|
|
|
FontInfo const inherit_font;
|
|
|
|
/// All ignore font.
|
|
|
|
FontInfo const ignore_font;
|
2003-07-26 00:17:21 +00:00
|
|
|
|
2007-11-01 09:47:02 +00:00
|
|
|
FontInfo lyxRead(Lexer & lex, FontInfo const &)
|
2003-07-26 00:17:21 +00:00
|
|
|
{
|
|
|
|
bool error = false;
|
|
|
|
bool finished = false;
|
|
|
|
while (!finished && lex.isOK() && !error) {
|
|
|
|
lex.next();
|
|
|
|
string const tok = ascii_lowercase(lex.getString());
|
|
|
|
|
|
|
|
if (tok.empty()) {
|
|
|
|
continue;
|
|
|
|
} else if (tok == "endfont") {
|
|
|
|
finished = true;
|
|
|
|
} else if (tok == "family") {
|
|
|
|
lex.next();
|
|
|
|
} else if (tok == "series") {
|
|
|
|
lex.next();
|
|
|
|
} else if (tok == "shape") {
|
|
|
|
lex.next();
|
|
|
|
} else if (tok == "size") {
|
|
|
|
lex.next();
|
|
|
|
} else if (tok == "misc") {
|
|
|
|
lex.next();
|
|
|
|
} else if (tok == "color") {
|
|
|
|
lex.next();
|
|
|
|
} else {
|
|
|
|
lex.printError("Unknown tag `$$Token'");
|
|
|
|
error = true;
|
|
|
|
}
|
|
|
|
}
|
2007-10-28 18:51:54 +00:00
|
|
|
return FontInfo();
|
2003-07-26 00:17:21 +00:00
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|