2003-08-23 00:17:00 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file bufferparams.C
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-03-21 17:27:08 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* \author Alfredo Braunstein
|
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
* \author Jean-Marc Lasgouttes
|
|
|
|
|
* \author John Levon
|
|
|
|
|
* \author Andr<EFBFBD> P<EFBFBD>nitz
|
|
|
|
|
* \author Martin Vermeer
|
2002-03-21 17:27:08 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
|
*/
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
#include "bufferparams.h"
|
2003-09-06 23:36:02 +00:00
|
|
|
|
|
2003-09-09 17:00:19 +00:00
|
|
|
|
#include "author.h"
|
|
|
|
|
#include "BranchList.h"
|
2003-09-06 23:36:02 +00:00
|
|
|
|
#include "Bullet.h"
|
2003-09-04 03:54:04 +00:00
|
|
|
|
#include "debug.h"
|
2003-02-16 00:54:43 +00:00
|
|
|
|
#include "encoding.h"
|
2003-09-04 03:54:04 +00:00
|
|
|
|
#include "gettext.h"
|
2000-03-10 13:22:20 +00:00
|
|
|
|
#include "language.h"
|
2003-09-04 03:54:04 +00:00
|
|
|
|
#include "LaTeXFeatures.h"
|
2003-09-16 09:44:34 +00:00
|
|
|
|
#include "LColor.h"
|
The Grand Font Selection Redesign:
* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).
* lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).
* lib/chkconfig.ltx: Test for newly supported font packages
* lib/doc/LaTeXConfig.lyx.in: document newly supported font packages
* lib/doc/UserGuide.lyx: document new UI.
* lib/doc/Extended.lyx: update PostScript font documentation
* development/FORMAT: document file format change 246->247.
* src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans,
tex_fonts_monospaced (with GUI equivalents).
* src/buffer.C: Format up to 247.
* src/bufferparams.C:
new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,
fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
(LyXFont const BufferParams::getFont): consider switch of default family.
(string const BufferParams::loadFonts): new method to get all the LaTeX
font stuff done.
* src/paragraph.C
(LyXFont const Paragraph::getFont):
(LyXFont const Paragraph::getLabelFont):
(LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's
default font
* src/text.C
(int LyXText::leftMargin):
(int LyXText::rightMargin): user buffer's not textclass's default font
* src/text2.C
(LyXFont LyXText::getFont):
(LyXFont LyXText::getLayoutFont):
(LyXFont LyXText::getLabelFont): check if the family of the default document
font has been customized.
* src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).
* src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM).
* src/frontends/qt3/Makefile.dialogs: add new FontModuleBase
* src/frontends/qt3/ui/FontModuleBase.ui: new File
* src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets
* src/frontends/qt3/QDocument.C
* src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/Makefile.dialogs: add new FontUi
* src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/ui/FontUi.ui: new File
* src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets
* src/frontends/qt4/ui/compile_uic.sh: add new FontUi
* src/frontends/xforms/FormDocument.[Ch]: implement new font ui
* src/frontends/xforms/forms/form_document.fd: add new font tab.
* src/frontends/controllers/ControlDocument.[Ch]
(char ControlDocument::fontfamilies):
(char ControlDocument::fontfamilies_gui):
(bool ControlDocument::isFontAvailable):
(bool ControlDocument::providesSC):
(bool ControlDocument::providesOSF):
(bool ControlDocument::providesScale): new methods, providing font info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-19 08:10:17 +00:00
|
|
|
|
#include "lyxfont.h"
|
2003-09-04 03:54:04 +00:00
|
|
|
|
#include "lyxlex.h"
|
2003-09-06 23:36:02 +00:00
|
|
|
|
#include "lyxrc.h"
|
2003-09-04 03:54:04 +00:00
|
|
|
|
#include "lyxtextclasslist.h"
|
2003-11-05 12:06:20 +00:00
|
|
|
|
#include "outputparams.h"
|
2003-09-04 03:54:04 +00:00
|
|
|
|
#include "tex-strings.h"
|
2003-09-09 17:00:19 +00:00
|
|
|
|
#include "Spacing.h"
|
2003-09-04 03:54:04 +00:00
|
|
|
|
#include "texrow.h"
|
2003-09-09 17:00:19 +00:00
|
|
|
|
#include "vspace.h"
|
2001-12-28 13:26:54 +00:00
|
|
|
|
|
2003-09-04 03:54:04 +00:00
|
|
|
|
#include "frontends/Alert.h"
|
2003-08-17 11:28:23 +00:00
|
|
|
|
|
2003-02-16 00:54:43 +00:00
|
|
|
|
#include "support/lyxalgo.h" // for lyx::count
|
2005-01-06 16:39:35 +00:00
|
|
|
|
#include "support/convert.h"
|
2004-10-05 13:18:28 +00:00
|
|
|
|
#include "support/translator.h"
|
2003-05-03 19:24:36 +00:00
|
|
|
|
|
2003-09-09 17:00:19 +00:00
|
|
|
|
#include <boost/array.hpp>
|
|
|
|
|
|
2004-07-24 10:55:30 +00:00
|
|
|
|
#include <sstream>
|
2000-02-22 00:36:17 +00:00
|
|
|
|
|
2006-09-11 08:54:10 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
namespace lyx {
|
|
|
|
|
|
|
|
|
|
using support::bformat;
|
|
|
|
|
using support::rtrim;
|
|
|
|
|
using support::tokenPos;
|
2003-06-30 23:56:22 +00:00
|
|
|
|
|
2003-09-06 23:36:02 +00:00
|
|
|
|
using std::endl;
|
2003-10-06 15:43:21 +00:00
|
|
|
|
using std::string;
|
2003-09-05 18:02:24 +00:00
|
|
|
|
using std::istringstream;
|
2000-04-04 00:19:15 +00:00
|
|
|
|
using std::ostream;
|
2003-09-05 18:02:24 +00:00
|
|
|
|
using std::ostringstream;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
using std::pair;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2006-10-07 16:47:54 +00:00
|
|
|
|
namespace Alert = lyx::frontend::Alert;
|
2004-05-19 15:11:37 +00:00
|
|
|
|
|
2003-05-13 16:24:49 +00:00
|
|
|
|
|
2004-10-05 13:18:28 +00:00
|
|
|
|
// Local translators
|
2004-08-20 13:06:33 +00:00
|
|
|
|
namespace {
|
|
|
|
|
|
2004-10-05 13:18:28 +00:00
|
|
|
|
// Paragraph separation
|
2005-01-05 20:21:27 +00:00
|
|
|
|
typedef Translator<string, BufferParams::PARSEP> ParSepTranslator;
|
2004-10-05 13:18:28 +00:00
|
|
|
|
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
ParSepTranslator const init_parseptranslator()
|
|
|
|
|
{
|
2004-10-05 13:18:28 +00:00
|
|
|
|
ParSepTranslator translator(string_paragraph_separation[0], BufferParams::PARSEP_INDENT);
|
|
|
|
|
translator.addPair(string_paragraph_separation[1], BufferParams::PARSEP_SKIP);
|
|
|
|
|
return translator;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
ParSepTranslator const & parseptranslator()
|
|
|
|
|
{
|
2004-10-05 13:18:28 +00:00
|
|
|
|
static ParSepTranslator translator = init_parseptranslator();
|
|
|
|
|
return translator;
|
|
|
|
|
}
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
|
2004-10-05 13:18:28 +00:00
|
|
|
|
// Quotes language
|
2005-01-05 20:21:27 +00:00
|
|
|
|
typedef Translator<string, InsetQuotes::quote_language> QuotesLangTranslator;
|
2004-10-05 13:18:28 +00:00
|
|
|
|
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
QuotesLangTranslator const init_quoteslangtranslator()
|
|
|
|
|
{
|
2004-10-05 13:18:28 +00:00
|
|
|
|
QuotesLangTranslator translator(string_quotes_language[0], InsetQuotes::EnglishQ);
|
|
|
|
|
translator.addPair(string_quotes_language[1], InsetQuotes::SwedishQ);
|
|
|
|
|
translator.addPair(string_quotes_language[2], InsetQuotes::GermanQ);
|
|
|
|
|
translator.addPair(string_quotes_language[3], InsetQuotes::PolishQ);
|
|
|
|
|
translator.addPair(string_quotes_language[4], InsetQuotes::FrenchQ);
|
|
|
|
|
translator.addPair(string_quotes_language[5], InsetQuotes::DanishQ);
|
|
|
|
|
return translator;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
QuotesLangTranslator const & quoteslangtranslator()
|
|
|
|
|
{
|
2004-10-05 13:18:28 +00:00
|
|
|
|
static QuotesLangTranslator translator = init_quoteslangtranslator();
|
|
|
|
|
return translator;
|
|
|
|
|
}
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
|
2004-10-05 13:18:28 +00:00
|
|
|
|
// Paper size
|
2005-07-16 16:57:55 +00:00
|
|
|
|
typedef Translator<std::string, PAPER_SIZE> PaperSizeTranslator;
|
2004-10-05 13:18:28 +00:00
|
|
|
|
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
PaperSizeTranslator const init_papersizetranslator()
|
|
|
|
|
{
|
2005-07-16 16:57:55 +00:00
|
|
|
|
PaperSizeTranslator translator(string_papersize[0], PAPER_DEFAULT);
|
|
|
|
|
translator.addPair(string_papersize[1], PAPER_CUSTOM);
|
|
|
|
|
translator.addPair(string_papersize[2], PAPER_USLETTER);
|
|
|
|
|
translator.addPair(string_papersize[3], PAPER_USLEGAL);
|
|
|
|
|
translator.addPair(string_papersize[4], PAPER_USEXECUTIVE);
|
|
|
|
|
translator.addPair(string_papersize[5], PAPER_A3);
|
|
|
|
|
translator.addPair(string_papersize[6], PAPER_A4);
|
|
|
|
|
translator.addPair(string_papersize[7], PAPER_A5);
|
|
|
|
|
translator.addPair(string_papersize[8], PAPER_B3);
|
|
|
|
|
translator.addPair(string_papersize[9], PAPER_B4);
|
|
|
|
|
translator.addPair(string_papersize[10], PAPER_B5);
|
2004-10-05 13:18:28 +00:00
|
|
|
|
return translator;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
PaperSizeTranslator const & papersizetranslator()
|
|
|
|
|
{
|
2004-10-05 13:18:28 +00:00
|
|
|
|
static PaperSizeTranslator translator = init_papersizetranslator();
|
|
|
|
|
return translator;
|
|
|
|
|
}
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
|
2004-10-05 13:18:28 +00:00
|
|
|
|
// Paper orientation
|
2005-01-05 20:21:27 +00:00
|
|
|
|
typedef Translator<string, PAPER_ORIENTATION> PaperOrientationTranslator;
|
2004-10-05 13:18:28 +00:00
|
|
|
|
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
PaperOrientationTranslator const init_paperorientationtranslator()
|
|
|
|
|
{
|
2004-10-05 13:18:28 +00:00
|
|
|
|
PaperOrientationTranslator translator(string_orientation[0], ORIENTATION_PORTRAIT);
|
|
|
|
|
translator.addPair(string_orientation[1], ORIENTATION_LANDSCAPE);
|
|
|
|
|
return translator;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
PaperOrientationTranslator const & paperorientationtranslator()
|
|
|
|
|
{
|
2004-10-05 13:18:28 +00:00
|
|
|
|
static PaperOrientationTranslator translator = init_paperorientationtranslator();
|
|
|
|
|
return translator;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Page sides
|
|
|
|
|
typedef Translator<int, LyXTextClass::PageSides> SidesTranslator;
|
|
|
|
|
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
SidesTranslator const init_sidestranslator()
|
|
|
|
|
{
|
2004-10-05 13:18:28 +00:00
|
|
|
|
SidesTranslator translator(1, LyXTextClass::OneSide);
|
|
|
|
|
translator.addPair(2, LyXTextClass::TwoSides);
|
|
|
|
|
return translator;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
SidesTranslator const & sidestranslator()
|
|
|
|
|
{
|
2004-10-05 13:18:28 +00:00
|
|
|
|
static SidesTranslator translator = init_sidestranslator();
|
|
|
|
|
return translator;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-11-13 17:35:18 +00:00
|
|
|
|
// LaTeX packages
|
|
|
|
|
typedef Translator<int, BufferParams::Package> PackageTranslator;
|
2004-10-05 13:18:28 +00:00
|
|
|
|
|
|
|
|
|
|
2006-11-13 17:35:18 +00:00
|
|
|
|
PackageTranslator const init_packagetranslator()
|
2005-01-05 20:21:27 +00:00
|
|
|
|
{
|
2006-11-13 17:35:18 +00:00
|
|
|
|
PackageTranslator translator(0, BufferParams::package_off);
|
|
|
|
|
translator.addPair(1, BufferParams::package_auto);
|
|
|
|
|
translator.addPair(2, BufferParams::package_on);
|
2004-10-05 13:18:28 +00:00
|
|
|
|
return translator;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-11-13 17:35:18 +00:00
|
|
|
|
PackageTranslator const & packagetranslator()
|
2005-01-05 20:21:27 +00:00
|
|
|
|
{
|
2006-11-13 17:35:18 +00:00
|
|
|
|
static PackageTranslator translator = init_packagetranslator();
|
2004-10-05 13:18:28 +00:00
|
|
|
|
return translator;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Cite engine
|
|
|
|
|
typedef Translator<string, biblio::CiteEngine> CiteEngineTranslator;
|
|
|
|
|
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
CiteEngineTranslator const init_citeenginetranslator()
|
|
|
|
|
{
|
2004-10-05 13:18:28 +00:00
|
|
|
|
CiteEngineTranslator translator("basic", biblio::ENGINE_BASIC);
|
|
|
|
|
translator.addPair("natbib_numerical", biblio::ENGINE_NATBIB_NUMERICAL);
|
|
|
|
|
translator.addPair("natbib_authoryear", biblio::ENGINE_NATBIB_AUTHORYEAR);
|
|
|
|
|
translator.addPair("jurabib", biblio::ENGINE_JURABIB);
|
|
|
|
|
return translator;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
CiteEngineTranslator const & citeenginetranslator()
|
|
|
|
|
{
|
2004-10-05 13:18:28 +00:00
|
|
|
|
static CiteEngineTranslator translator = init_citeenginetranslator();
|
|
|
|
|
return translator;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Spacing
|
|
|
|
|
typedef Translator<string, Spacing::Space> SpaceTranslator;
|
2004-08-20 13:06:33 +00:00
|
|
|
|
|
2004-10-05 13:18:28 +00:00
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
SpaceTranslator const init_spacetranslator()
|
|
|
|
|
{
|
2004-10-05 13:18:28 +00:00
|
|
|
|
SpaceTranslator translator("default", Spacing::Default);
|
|
|
|
|
translator.addPair("single", Spacing::Single);
|
|
|
|
|
translator.addPair("onehalf", Spacing::Onehalf);
|
|
|
|
|
translator.addPair("double", Spacing::Double);
|
2005-01-06 13:48:13 +00:00
|
|
|
|
translator.addPair("other", Spacing::Other);
|
2004-10-05 13:18:28 +00:00
|
|
|
|
return translator;
|
2004-08-20 13:06:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
2004-10-05 13:18:28 +00:00
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
SpaceTranslator const & spacetranslator()
|
|
|
|
|
{
|
2004-10-05 13:18:28 +00:00
|
|
|
|
static SpaceTranslator translator = init_spacetranslator();
|
|
|
|
|
return translator;
|
|
|
|
|
}
|
|
|
|
|
|
2007-01-27 17:22:58 +00:00
|
|
|
|
|
|
|
|
|
textclass_type defaultTextclass()
|
|
|
|
|
{
|
|
|
|
|
// Initialize textclass to point to article. if `first' is
|
|
|
|
|
// true in the returned pair, then `second' is the textclass
|
|
|
|
|
// number; if it is false, second is 0. In both cases, second
|
|
|
|
|
// is what we want.
|
|
|
|
|
return textclasslist.numberOfClass("article").second;
|
2004-08-20 13:06:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-01-27 17:22:58 +00:00
|
|
|
|
} // anon namespace
|
|
|
|
|
|
2004-08-20 13:06:33 +00:00
|
|
|
|
|
2005-01-19 15:03:31 +00:00
|
|
|
|
class BufferParams::Impl
|
2003-09-09 17:00:19 +00:00
|
|
|
|
{
|
2005-01-19 15:03:31 +00:00
|
|
|
|
public:
|
2003-09-09 17:00:19 +00:00
|
|
|
|
Impl();
|
|
|
|
|
|
|
|
|
|
AuthorList authorlist;
|
|
|
|
|
BranchList branchlist;
|
|
|
|
|
boost::array<Bullet, 4> temp_bullets;
|
|
|
|
|
boost::array<Bullet, 4> user_defined_bullets;
|
|
|
|
|
Spacing spacing;
|
|
|
|
|
/** This is the amount of space used for paragraph_separation "skip",
|
|
|
|
|
* and for detached paragraphs in "indented" documents.
|
|
|
|
|
*/
|
|
|
|
|
VSpace defskip;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BufferParams::Impl::Impl()
|
|
|
|
|
: defskip(VSpace::MEDSKIP)
|
|
|
|
|
{
|
|
|
|
|
// set initial author
|
2006-12-21 13:58:28 +00:00
|
|
|
|
// FIXME UNICODE
|
|
|
|
|
authorlist.record(Author(from_utf8(lyxrc.user_name), from_utf8(lyxrc.user_email)));
|
2003-09-09 17:00:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-09-15 20:23:57 +00:00
|
|
|
|
BufferParams::Impl *
|
|
|
|
|
BufferParams::MemoryTraits::clone(BufferParams::Impl const * ptr)
|
|
|
|
|
{
|
2005-01-05 20:21:27 +00:00
|
|
|
|
BOOST_ASSERT(ptr);
|
|
|
|
|
|
2003-09-15 20:23:57 +00:00
|
|
|
|
return new BufferParams::Impl(*ptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void BufferParams::MemoryTraits::destroy(BufferParams::Impl * ptr)
|
|
|
|
|
{
|
|
|
|
|
delete ptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
BufferParams::BufferParams()
|
2007-01-27 17:22:58 +00:00
|
|
|
|
: textclass(defaultTextclass()), pimpl_(new Impl)
|
1999-09-27 18:44:28 +00:00
|
|
|
|
{
|
1999-11-15 12:01:38 +00:00
|
|
|
|
paragraph_separation = PARSEP_INDENT;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
quotes_language = InsetQuotes::EnglishQ;
|
|
|
|
|
fontsize = "default";
|
1999-11-25 17:29:19 +00:00
|
|
|
|
|
2001-11-29 17:12:21 +00:00
|
|
|
|
/* PaperLayout */
|
1999-09-27 18:44:28 +00:00
|
|
|
|
papersize = PAPER_DEFAULT;
|
|
|
|
|
orientation = ORIENTATION_PORTRAIT;
|
2001-11-29 17:12:21 +00:00
|
|
|
|
use_geometry = false;
|
2006-11-13 17:35:18 +00:00
|
|
|
|
use_amsmath = package_auto;
|
|
|
|
|
use_esint = package_auto;
|
2007-03-25 01:12:38 +00:00
|
|
|
|
cite_engine_ = biblio::ENGINE_BASIC;
|
2004-03-29 13:17:25 +00:00
|
|
|
|
use_bibtopic = false;
|
2006-10-06 18:53:35 +00:00
|
|
|
|
trackChanges = false;
|
|
|
|
|
outputChanges = false;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
secnumdepth = 3;
|
|
|
|
|
tocdepth = 3;
|
2000-10-10 12:36:36 +00:00
|
|
|
|
language = default_language;
|
The Grand Font Selection Redesign:
* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).
* lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).
* lib/chkconfig.ltx: Test for newly supported font packages
* lib/doc/LaTeXConfig.lyx.in: document newly supported font packages
* lib/doc/UserGuide.lyx: document new UI.
* lib/doc/Extended.lyx: update PostScript font documentation
* development/FORMAT: document file format change 246->247.
* src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans,
tex_fonts_monospaced (with GUI equivalents).
* src/buffer.C: Format up to 247.
* src/bufferparams.C:
new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,
fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
(LyXFont const BufferParams::getFont): consider switch of default family.
(string const BufferParams::loadFonts): new method to get all the LaTeX
font stuff done.
* src/paragraph.C
(LyXFont const Paragraph::getFont):
(LyXFont const Paragraph::getLabelFont):
(LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's
default font
* src/text.C
(int LyXText::leftMargin):
(int LyXText::rightMargin): user buffer's not textclass's default font
* src/text2.C
(LyXFont LyXText::getFont):
(LyXFont LyXText::getLayoutFont):
(LyXFont LyXText::getLabelFont): check if the family of the default document
font has been customized.
* src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).
* src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM).
* src/frontends/qt3/Makefile.dialogs: add new FontModuleBase
* src/frontends/qt3/ui/FontModuleBase.ui: new File
* src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets
* src/frontends/qt3/QDocument.C
* src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/Makefile.dialogs: add new FontUi
* src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/ui/FontUi.ui: new File
* src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets
* src/frontends/qt4/ui/compile_uic.sh: add new FontUi
* src/frontends/xforms/FormDocument.[Ch]: implement new font ui
* src/frontends/xforms/forms/form_document.fd: add new font tab.
* src/frontends/controllers/ControlDocument.[Ch]
(char ControlDocument::fontfamilies):
(char ControlDocument::fontfamilies_gui):
(bool ControlDocument::isFontAvailable):
(bool ControlDocument::providesSC):
(bool ControlDocument::providesOSF):
(bool ControlDocument::providesScale): new methods, providing font info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-19 08:10:17 +00:00
|
|
|
|
fontsRoman = "default";
|
|
|
|
|
fontsSans = "default";
|
|
|
|
|
fontsTypewriter = "default";
|
|
|
|
|
fontsDefaultFamily = "default";
|
|
|
|
|
fontsSC = false;
|
|
|
|
|
fontsOSF = false;
|
|
|
|
|
fontsSansScale = 100;
|
|
|
|
|
fontsTypewriterScale = 100;
|
2000-07-04 20:32:37 +00:00
|
|
|
|
inputenc = "auto";
|
1999-09-27 18:44:28 +00:00
|
|
|
|
graphicsDriver = "default";
|
1999-11-04 01:40:20 +00:00
|
|
|
|
sides = LyXTextClass::OneSide;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
columns = 1;
|
|
|
|
|
pagestyle = "default";
|
2003-07-28 14:40:29 +00:00
|
|
|
|
compressed = false;
|
2000-11-04 10:00:12 +00:00
|
|
|
|
for (int iter = 0; iter < 4; ++iter) {
|
2003-09-09 17:00:19 +00:00
|
|
|
|
user_defined_bullet(iter) = ITEMIZE_DEFAULTS[iter];
|
|
|
|
|
temp_bullet(iter) = ITEMIZE_DEFAULTS[iter];
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-09-09 17:00:19 +00:00
|
|
|
|
BufferParams::~BufferParams()
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AuthorList & BufferParams::authors()
|
|
|
|
|
{
|
|
|
|
|
return pimpl_->authorlist;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AuthorList const & BufferParams::authors() const
|
|
|
|
|
{
|
|
|
|
|
return pimpl_->authorlist;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BranchList & BufferParams::branchlist()
|
|
|
|
|
{
|
|
|
|
|
return pimpl_->branchlist;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BranchList const & BufferParams::branchlist() const
|
|
|
|
|
{
|
|
|
|
|
return pimpl_->branchlist;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
Bullet & BufferParams::temp_bullet(lyx::size_type const index)
|
2003-09-09 17:00:19 +00:00
|
|
|
|
{
|
2003-09-09 17:25:35 +00:00
|
|
|
|
BOOST_ASSERT(index < 4);
|
2003-09-09 17:00:19 +00:00
|
|
|
|
return pimpl_->temp_bullets[index];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
Bullet const & BufferParams::temp_bullet(lyx::size_type const index) const
|
2003-09-09 17:00:19 +00:00
|
|
|
|
{
|
2003-09-09 17:25:35 +00:00
|
|
|
|
BOOST_ASSERT(index < 4);
|
2003-09-09 17:00:19 +00:00
|
|
|
|
return pimpl_->temp_bullets[index];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
Bullet & BufferParams::user_defined_bullet(lyx::size_type const index)
|
2003-09-09 17:00:19 +00:00
|
|
|
|
{
|
2003-09-09 17:25:35 +00:00
|
|
|
|
BOOST_ASSERT(index < 4);
|
2003-09-09 17:00:19 +00:00
|
|
|
|
return pimpl_->user_defined_bullets[index];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
Bullet const & BufferParams::user_defined_bullet(lyx::size_type const index) const
|
2003-09-09 17:00:19 +00:00
|
|
|
|
{
|
2003-09-09 17:25:35 +00:00
|
|
|
|
BOOST_ASSERT(index < 4);
|
2003-09-09 17:00:19 +00:00
|
|
|
|
return pimpl_->user_defined_bullets[index];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Spacing & BufferParams::spacing()
|
|
|
|
|
{
|
|
|
|
|
return pimpl_->spacing;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Spacing const & BufferParams::spacing() const
|
|
|
|
|
{
|
|
|
|
|
return pimpl_->spacing;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VSpace const & BufferParams::getDefSkip() const
|
|
|
|
|
{
|
|
|
|
|
return pimpl_->defskip;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void BufferParams::setDefSkip(VSpace const & vs)
|
|
|
|
|
{
|
|
|
|
|
pimpl_->defskip = vs;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-03-12 02:39:12 +00:00
|
|
|
|
string const BufferParams::readToken(LyXLex & lex, string const & token)
|
|
|
|
|
{
|
|
|
|
|
if (token == "\\textclass") {
|
2004-08-14 18:41:27 +00:00
|
|
|
|
lex.next();
|
2003-03-12 02:39:12 +00:00
|
|
|
|
string const classname = lex.getString();
|
|
|
|
|
pair<bool, lyx::textclass_type> pp =
|
2006-04-09 00:26:19 +00:00
|
|
|
|
textclasslist.numberOfClass(classname);
|
2003-03-12 02:39:12 +00:00
|
|
|
|
if (pp.first) {
|
|
|
|
|
textclass = pp.second;
|
|
|
|
|
} else {
|
2006-04-09 04:35:24 +00:00
|
|
|
|
// if text class does not exist, try to load it from filepath
|
|
|
|
|
pp = textclasslist.addTextClass(classname, filepath);
|
|
|
|
|
if (pp.first) {
|
|
|
|
|
textclass = pp.second;
|
2006-09-09 15:27:44 +00:00
|
|
|
|
} else {
|
2007-01-27 17:22:58 +00:00
|
|
|
|
textclass = defaultTextclass();
|
2006-04-09 04:35:24 +00:00
|
|
|
|
return classname;
|
2006-09-09 15:27:44 +00:00
|
|
|
|
}
|
2003-03-12 02:39:12 +00:00
|
|
|
|
}
|
2006-04-09 04:35:24 +00:00
|
|
|
|
// FIXME: isTeXClassAvailable will try to load the layout file, but will
|
|
|
|
|
// fail because of the lack of path info. Warnings will be given although
|
|
|
|
|
// the layout file will be correctly loaded later.
|
2003-05-03 19:24:36 +00:00
|
|
|
|
if (!getLyXTextClass().isTeXClassAvailable()) {
|
2006-09-11 08:54:10 +00:00
|
|
|
|
docstring const msg =
|
|
|
|
|
bformat(_("The document uses a missing "
|
2006-10-21 00:16:43 +00:00
|
|
|
|
"TeX class \"%1$s\".\n"), from_utf8(classname));
|
2006-09-11 08:54:10 +00:00
|
|
|
|
Alert::warning(_("Document class not available"),
|
|
|
|
|
msg + _("LyX will not be able to produce output."));
|
2003-05-03 19:24:36 +00:00
|
|
|
|
}
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\begin_preamble") {
|
|
|
|
|
readPreamble(lex);
|
|
|
|
|
} else if (token == "\\options") {
|
|
|
|
|
lex.eatLine();
|
|
|
|
|
options = lex.getString();
|
|
|
|
|
} else if (token == "\\language") {
|
|
|
|
|
readLanguage(lex);
|
|
|
|
|
} else if (token == "\\inputencoding") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> inputenc;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\graphics") {
|
|
|
|
|
readGraphicsDriver(lex);
|
The Grand Font Selection Redesign:
* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).
* lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).
* lib/chkconfig.ltx: Test for newly supported font packages
* lib/doc/LaTeXConfig.lyx.in: document newly supported font packages
* lib/doc/UserGuide.lyx: document new UI.
* lib/doc/Extended.lyx: update PostScript font documentation
* development/FORMAT: document file format change 246->247.
* src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans,
tex_fonts_monospaced (with GUI equivalents).
* src/buffer.C: Format up to 247.
* src/bufferparams.C:
new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,
fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
(LyXFont const BufferParams::getFont): consider switch of default family.
(string const BufferParams::loadFonts): new method to get all the LaTeX
font stuff done.
* src/paragraph.C
(LyXFont const Paragraph::getFont):
(LyXFont const Paragraph::getLabelFont):
(LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's
default font
* src/text.C
(int LyXText::leftMargin):
(int LyXText::rightMargin): user buffer's not textclass's default font
* src/text2.C
(LyXFont LyXText::getFont):
(LyXFont LyXText::getLayoutFont):
(LyXFont LyXText::getLabelFont): check if the family of the default document
font has been customized.
* src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).
* src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM).
* src/frontends/qt3/Makefile.dialogs: add new FontModuleBase
* src/frontends/qt3/ui/FontModuleBase.ui: new File
* src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets
* src/frontends/qt3/QDocument.C
* src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/Makefile.dialogs: add new FontUi
* src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/ui/FontUi.ui: new File
* src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets
* src/frontends/qt4/ui/compile_uic.sh: add new FontUi
* src/frontends/xforms/FormDocument.[Ch]: implement new font ui
* src/frontends/xforms/forms/form_document.fd: add new font tab.
* src/frontends/controllers/ControlDocument.[Ch]
(char ControlDocument::fontfamilies):
(char ControlDocument::fontfamilies_gui):
(bool ControlDocument::isFontAvailable):
(bool ControlDocument::providesSC):
(bool ControlDocument::providesOSF):
(bool ControlDocument::providesScale): new methods, providing font info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-19 08:10:17 +00:00
|
|
|
|
} else if (token == "\\font_roman") {
|
|
|
|
|
lex >> fontsRoman;
|
|
|
|
|
} else if (token == "\\font_sans") {
|
|
|
|
|
lex >> fontsSans;
|
|
|
|
|
} else if (token == "\\font_typewriter") {
|
|
|
|
|
lex >> fontsTypewriter;
|
|
|
|
|
} else if (token == "\\font_default_family") {
|
|
|
|
|
lex >> fontsDefaultFamily;
|
|
|
|
|
} else if (token == "\\font_sc") {
|
|
|
|
|
lex >> fontsSC;
|
|
|
|
|
} else if (token == "\\font_osf") {
|
|
|
|
|
lex >> fontsOSF;
|
|
|
|
|
} else if (token == "\\font_sf_scale") {
|
|
|
|
|
lex >> fontsSansScale;
|
|
|
|
|
} else if (token == "\\font_tt_scale") {
|
|
|
|
|
lex >> fontsTypewriterScale;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\paragraph_separation") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
string parsep;
|
|
|
|
|
lex >> parsep;
|
|
|
|
|
paragraph_separation = parseptranslator().find(parsep);
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\defskip") {
|
2004-08-14 18:41:27 +00:00
|
|
|
|
lex.next();
|
2003-09-09 17:00:19 +00:00
|
|
|
|
pimpl_->defskip = VSpace(lex.getString());
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\quotes_language") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
string quotes_lang;
|
|
|
|
|
lex >> quotes_lang;
|
|
|
|
|
quotes_language = quoteslangtranslator().find(quotes_lang);
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\papersize") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
string ppsize;
|
|
|
|
|
lex >> ppsize;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
papersize = papersizetranslator().find(ppsize);
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\use_geometry") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> use_geometry;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\use_amsmath") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
int use_ams;
|
|
|
|
|
lex >> use_ams;
|
2006-11-13 17:35:18 +00:00
|
|
|
|
use_amsmath = packagetranslator().find(use_ams);
|
|
|
|
|
} else if (token == "\\use_esint") {
|
|
|
|
|
int useesint;
|
|
|
|
|
lex >> useesint;
|
|
|
|
|
use_esint = packagetranslator().find(useesint);
|
2004-05-13 20:44:35 +00:00
|
|
|
|
} else if (token == "\\cite_engine") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
string engine;
|
|
|
|
|
lex >> engine;
|
2007-03-25 01:12:38 +00:00
|
|
|
|
cite_engine_ = citeenginetranslator().find(engine);
|
2004-03-29 13:17:25 +00:00
|
|
|
|
} else if (token == "\\use_bibtopic") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> use_bibtopic;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\tracking_changes") {
|
2006-10-06 18:53:35 +00:00
|
|
|
|
lex >> trackChanges;
|
2005-01-24 17:12:19 +00:00
|
|
|
|
} else if (token == "\\output_changes") {
|
2006-10-06 18:53:35 +00:00
|
|
|
|
lex >> outputChanges;
|
2003-08-17 11:28:23 +00:00
|
|
|
|
} else if (token == "\\branch") {
|
2004-08-14 18:41:27 +00:00
|
|
|
|
lex.next();
|
2006-11-03 15:16:45 +00:00
|
|
|
|
docstring branch = lex.getDocString();
|
2003-09-09 17:00:19 +00:00
|
|
|
|
branchlist().add(branch);
|
2003-08-17 11:28:23 +00:00
|
|
|
|
while (true) {
|
2004-08-14 18:41:27 +00:00
|
|
|
|
lex.next();
|
2003-08-17 11:28:23 +00:00
|
|
|
|
string const tok = lex.getString();
|
|
|
|
|
if (tok == "\\end_branch")
|
|
|
|
|
break;
|
2003-12-14 16:33:56 +00:00
|
|
|
|
Branch * branch_ptr = branchlist().find(branch);
|
2003-08-17 11:28:23 +00:00
|
|
|
|
if (tok == "\\selected") {
|
2004-08-14 18:41:27 +00:00
|
|
|
|
lex.next();
|
2003-12-14 16:33:56 +00:00
|
|
|
|
if (branch_ptr)
|
|
|
|
|
branch_ptr->setSelected(lex.getInteger());
|
2003-08-17 11:28:23 +00:00
|
|
|
|
}
|
|
|
|
|
// not yet operational
|
|
|
|
|
if (tok == "\\color") {
|
2004-08-14 18:41:27 +00:00
|
|
|
|
lex.eatLine();
|
2003-08-17 11:28:23 +00:00
|
|
|
|
string color = lex.getString();
|
2003-12-14 16:33:56 +00:00
|
|
|
|
if (branch_ptr)
|
|
|
|
|
branch_ptr->setColor(color);
|
2003-08-17 11:28:23 +00:00
|
|
|
|
// Update also the LColor table:
|
2003-09-09 17:25:35 +00:00
|
|
|
|
if (color == "none")
|
2003-08-17 11:28:23 +00:00
|
|
|
|
color = lcolor.getX11Name(LColor::background);
|
2006-11-03 15:16:45 +00:00
|
|
|
|
// FIXME UNICODE
|
|
|
|
|
lcolor.setColor(to_utf8(branch), color);
|
2004-03-25 15:51:21 +00:00
|
|
|
|
|
2003-08-17 11:28:23 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\author") {
|
2004-08-23 11:02:20 +00:00
|
|
|
|
lex.eatLine();
|
2003-09-15 11:00:00 +00:00
|
|
|
|
istringstream ss(lex.getString());
|
2003-03-12 02:39:12 +00:00
|
|
|
|
Author a;
|
|
|
|
|
ss >> a;
|
2003-09-09 17:00:19 +00:00
|
|
|
|
author_map.push_back(pimpl_->authorlist.record(a));
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\paperorientation") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
string orient;
|
|
|
|
|
lex >> orient;
|
|
|
|
|
orientation = paperorientationtranslator().find(orient);
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\paperwidth") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> paperwidth;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\paperheight") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> paperheight;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\leftmargin") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> leftmargin;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\topmargin") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> topmargin;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\rightmargin") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> rightmargin;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\bottommargin") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> bottommargin;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\headheight") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> headheight;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\headsep") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> headsep;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\footskip") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> footskip;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\paperfontsize") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> fontsize;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\papercolumns") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> columns;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\papersides") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
int psides;
|
|
|
|
|
lex >> psides;
|
|
|
|
|
sides = sidestranslator().find(psides);
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\paperpagestyle") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> pagestyle;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\bullet") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
readBullets(lex);
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\bulletLaTeX") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
readBulletsLaTeX(lex);
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\secnumdepth") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> secnumdepth;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\tocdepth") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> tocdepth;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\spacing") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
string nspacing;
|
|
|
|
|
lex >> nspacing;
|
2005-01-06 13:48:13 +00:00
|
|
|
|
string tmp_val;
|
2004-10-05 13:18:28 +00:00
|
|
|
|
if (nspacing == "other") {
|
|
|
|
|
lex >> tmp_val;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
}
|
2004-10-05 13:18:28 +00:00
|
|
|
|
spacing().set(spacetranslator().find(nspacing), tmp_val);
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else if (token == "\\float_placement") {
|
2004-10-05 13:18:28 +00:00
|
|
|
|
lex >> float_placement;
|
2003-03-12 02:39:12 +00:00
|
|
|
|
} else {
|
|
|
|
|
return token;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return string();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2000-02-22 00:36:17 +00:00
|
|
|
|
void BufferParams::writeFile(ostream & os) const
|
1999-09-27 18:44:28 +00:00
|
|
|
|
{
|
|
|
|
|
// The top of the file is written by the buffer.
|
|
|
|
|
// Prints out the buffer info into the .lyx file given by file
|
|
|
|
|
|
2002-03-21 17:27:08 +00:00
|
|
|
|
// the textclass
|
|
|
|
|
os << "\\textclass " << textclasslist[textclass].name() << '\n';
|
|
|
|
|
|
2007-03-12 15:15:21 +00:00
|
|
|
|
// then the preamble
|
1999-09-27 18:44:28 +00:00
|
|
|
|
if (!preamble.empty()) {
|
1999-12-07 00:44:53 +00:00
|
|
|
|
// remove '\n' from the end of preamble
|
2002-07-28 22:50:13 +00:00
|
|
|
|
string const tmppreamble = rtrim(preamble, "\n");
|
1999-12-07 00:44:53 +00:00
|
|
|
|
os << "\\begin_preamble\n"
|
2000-02-22 00:36:17 +00:00
|
|
|
|
<< tmppreamble
|
1999-12-07 00:44:53 +00:00
|
|
|
|
<< "\n\\end_preamble\n";
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
// the options
|
1999-09-27 18:44:28 +00:00
|
|
|
|
if (!options.empty()) {
|
1999-12-07 00:44:53 +00:00
|
|
|
|
os << "\\options " << options << '\n';
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
// then the text parameters
|
2001-07-27 12:03:36 +00:00
|
|
|
|
if (language != ignore_language)
|
|
|
|
|
os << "\\language " << language->lang() << '\n';
|
|
|
|
|
os << "\\inputencoding " << inputenc
|
The Grand Font Selection Redesign:
* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).
* lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).
* lib/chkconfig.ltx: Test for newly supported font packages
* lib/doc/LaTeXConfig.lyx.in: document newly supported font packages
* lib/doc/UserGuide.lyx: document new UI.
* lib/doc/Extended.lyx: update PostScript font documentation
* development/FORMAT: document file format change 246->247.
* src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans,
tex_fonts_monospaced (with GUI equivalents).
* src/buffer.C: Format up to 247.
* src/bufferparams.C:
new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,
fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
(LyXFont const BufferParams::getFont): consider switch of default family.
(string const BufferParams::loadFonts): new method to get all the LaTeX
font stuff done.
* src/paragraph.C
(LyXFont const Paragraph::getFont):
(LyXFont const Paragraph::getLabelFont):
(LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's
default font
* src/text.C
(int LyXText::leftMargin):
(int LyXText::rightMargin): user buffer's not textclass's default font
* src/text2.C
(LyXFont LyXText::getFont):
(LyXFont LyXText::getLayoutFont):
(LyXFont LyXText::getLabelFont): check if the family of the default document
font has been customized.
* src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).
* src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM).
* src/frontends/qt3/Makefile.dialogs: add new FontModuleBase
* src/frontends/qt3/ui/FontModuleBase.ui: new File
* src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets
* src/frontends/qt3/QDocument.C
* src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/Makefile.dialogs: add new FontUi
* src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/ui/FontUi.ui: new File
* src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets
* src/frontends/qt4/ui/compile_uic.sh: add new FontUi
* src/frontends/xforms/FormDocument.[Ch]: implement new font ui
* src/frontends/xforms/forms/form_document.fd: add new font tab.
* src/frontends/controllers/ControlDocument.[Ch]
(char ControlDocument::fontfamilies):
(char ControlDocument::fontfamilies_gui):
(bool ControlDocument::isFontAvailable):
(bool ControlDocument::providesSC):
(bool ControlDocument::providesOSF):
(bool ControlDocument::providesScale): new methods, providing font info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-19 08:10:17 +00:00
|
|
|
|
<< "\n\\font_roman " << fontsRoman
|
|
|
|
|
<< "\n\\font_sans " << fontsSans
|
|
|
|
|
<< "\n\\font_typewriter " << fontsTypewriter
|
|
|
|
|
<< "\n\\font_default_family " << fontsDefaultFamily
|
|
|
|
|
<< "\n\\font_sc " << convert<string>(fontsSC)
|
|
|
|
|
<< "\n\\font_osf " << convert<string>(fontsOSF)
|
|
|
|
|
<< "\n\\font_sf_scale " << fontsSansScale
|
|
|
|
|
<< "\n\\font_tt_scale " << fontsTypewriterScale
|
1999-12-07 00:44:53 +00:00
|
|
|
|
<< "\n\\graphics " << graphicsDriver << '\n';
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
if (!float_placement.empty()) {
|
1999-12-07 00:44:53 +00:00
|
|
|
|
os << "\\float_placement " << float_placement << '\n';
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
1999-12-07 00:44:53 +00:00
|
|
|
|
os << "\\paperfontsize " << fontsize << '\n';
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2003-09-09 17:00:19 +00:00
|
|
|
|
spacing().writeFile(os);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2005-07-16 16:57:55 +00:00
|
|
|
|
os << "\\papersize " << string_papersize[papersize]
|
2005-01-06 15:40:49 +00:00
|
|
|
|
<< "\n\\use_geometry " << convert<string>(use_geometry)
|
1999-12-07 00:44:53 +00:00
|
|
|
|
<< "\n\\use_amsmath " << use_amsmath
|
2006-11-13 17:35:18 +00:00
|
|
|
|
<< "\n\\use_esint " << use_esint
|
2007-03-25 01:12:38 +00:00
|
|
|
|
<< "\n\\cite_engine " << citeenginetranslator().find(cite_engine_)
|
2005-01-06 15:40:49 +00:00
|
|
|
|
<< "\n\\use_bibtopic " << convert<string>(use_bibtopic)
|
1999-12-07 00:44:53 +00:00
|
|
|
|
<< "\n\\paperorientation " << string_orientation[orientation]
|
|
|
|
|
<< '\n';
|
2003-08-17 11:28:23 +00:00
|
|
|
|
|
2005-10-25 15:21:49 +00:00
|
|
|
|
BranchList::const_iterator it = branchlist().begin();
|
|
|
|
|
BranchList::const_iterator end = branchlist().end();
|
2003-08-17 11:28:23 +00:00
|
|
|
|
for (; it != end; ++it) {
|
2006-11-03 15:16:45 +00:00
|
|
|
|
os << "\\branch " << to_utf8(it->getBranch())
|
2003-09-09 17:25:35 +00:00
|
|
|
|
<< "\n\\selected " << it->getSelected()
|
2006-03-23 20:04:05 +00:00
|
|
|
|
<< "\n\\color " << lyx::X11hexname(it->getColor())
|
2003-09-09 17:25:35 +00:00
|
|
|
|
<< "\n\\end_branch"
|
2003-08-17 11:28:23 +00:00
|
|
|
|
<< "\n";
|
|
|
|
|
}
|
|
|
|
|
|
2002-03-21 17:27:08 +00:00
|
|
|
|
if (!paperwidth.empty())
|
1999-12-07 00:44:53 +00:00
|
|
|
|
os << "\\paperwidth "
|
|
|
|
|
<< VSpace(paperwidth).asLyXCommand() << '\n';
|
2002-03-21 17:27:08 +00:00
|
|
|
|
if (!paperheight.empty())
|
1999-12-07 00:44:53 +00:00
|
|
|
|
os << "\\paperheight "
|
|
|
|
|
<< VSpace(paperheight).asLyXCommand() << '\n';
|
2002-03-21 17:27:08 +00:00
|
|
|
|
if (!leftmargin.empty())
|
1999-12-07 00:44:53 +00:00
|
|
|
|
os << "\\leftmargin "
|
|
|
|
|
<< VSpace(leftmargin).asLyXCommand() << '\n';
|
2002-03-21 17:27:08 +00:00
|
|
|
|
if (!topmargin.empty())
|
1999-12-07 00:44:53 +00:00
|
|
|
|
os << "\\topmargin "
|
|
|
|
|
<< VSpace(topmargin).asLyXCommand() << '\n';
|
2002-03-21 17:27:08 +00:00
|
|
|
|
if (!rightmargin.empty())
|
1999-12-07 00:44:53 +00:00
|
|
|
|
os << "\\rightmargin "
|
|
|
|
|
<< VSpace(rightmargin).asLyXCommand() << '\n';
|
2002-03-21 17:27:08 +00:00
|
|
|
|
if (!bottommargin.empty())
|
1999-12-07 00:44:53 +00:00
|
|
|
|
os << "\\bottommargin "
|
|
|
|
|
<< VSpace(bottommargin).asLyXCommand() << '\n';
|
2002-03-21 17:27:08 +00:00
|
|
|
|
if (!headheight.empty())
|
1999-12-07 00:44:53 +00:00
|
|
|
|
os << "\\headheight "
|
|
|
|
|
<< VSpace(headheight).asLyXCommand() << '\n';
|
2002-03-21 17:27:08 +00:00
|
|
|
|
if (!headsep.empty())
|
1999-12-07 00:44:53 +00:00
|
|
|
|
os << "\\headsep "
|
|
|
|
|
<< VSpace(headsep).asLyXCommand() << '\n';
|
2002-03-21 17:27:08 +00:00
|
|
|
|
if (!footskip.empty())
|
1999-12-07 00:44:53 +00:00
|
|
|
|
os << "\\footskip "
|
|
|
|
|
<< VSpace(footskip).asLyXCommand() << '\n';
|
|
|
|
|
os << "\\secnumdepth " << secnumdepth
|
|
|
|
|
<< "\n\\tocdepth " << tocdepth
|
|
|
|
|
<< "\n\\paragraph_separation "
|
|
|
|
|
<< string_paragraph_separation[paragraph_separation]
|
2003-09-09 17:00:19 +00:00
|
|
|
|
<< "\n\\defskip " << getDefSkip().asLyXCommand()
|
1999-12-07 00:44:53 +00:00
|
|
|
|
<< "\n\\quotes_language "
|
2005-10-13 10:59:39 +00:00
|
|
|
|
<< string_quotes_language[quotes_language]
|
2004-10-05 13:18:28 +00:00
|
|
|
|
<< "\n\\papercolumns " << columns
|
1999-12-07 00:44:53 +00:00
|
|
|
|
<< "\n\\papersides " << sides
|
|
|
|
|
<< "\n\\paperpagestyle " << pagestyle << '\n';
|
1999-09-27 18:44:28 +00:00
|
|
|
|
for (int i = 0; i < 4; ++i) {
|
2003-09-09 17:00:19 +00:00
|
|
|
|
if (user_defined_bullet(i) != ITEMIZE_DEFAULTS[i]) {
|
|
|
|
|
if (user_defined_bullet(i).getFont() != -1) {
|
2004-08-14 18:41:27 +00:00
|
|
|
|
os << "\\bullet " << i << " "
|
|
|
|
|
<< user_defined_bullet(i).getFont() << " "
|
|
|
|
|
<< user_defined_bullet(i).getCharacter() << " "
|
|
|
|
|
<< user_defined_bullet(i).getSize() << "\n";
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
else {
|
2006-10-20 19:26:23 +00:00
|
|
|
|
// FIXME UNICODE
|
2004-08-14 18:41:27 +00:00
|
|
|
|
os << "\\bulletLaTeX " << i << " \""
|
2006-10-20 19:26:23 +00:00
|
|
|
|
<< lyx::to_ascii(user_defined_bullet(i).getText())
|
2004-08-14 18:41:27 +00:00
|
|
|
|
<< "\"\n";
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2003-02-08 19:18:01 +00:00
|
|
|
|
|
2006-10-06 18:53:35 +00:00
|
|
|
|
os << "\\tracking_changes " << convert<string>(trackChanges) << "\n";
|
|
|
|
|
os << "\\output_changes " << convert<string>(outputChanges) << "\n";
|
2003-03-12 02:39:12 +00:00
|
|
|
|
|
2006-10-20 12:44:37 +00:00
|
|
|
|
AuthorList::Authors::const_iterator a_it = pimpl_->authorlist.begin();
|
|
|
|
|
AuthorList::Authors::const_iterator a_end = pimpl_->authorlist.end();
|
|
|
|
|
for (; a_it != a_end; ++a_it) {
|
|
|
|
|
os << "\\author " << a_it->second << "\n";
|
2003-03-12 02:39:12 +00:00
|
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-10-19 16:51:30 +00:00
|
|
|
|
bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
|
2003-02-16 00:54:43 +00:00
|
|
|
|
TexRow & texrow) const
|
|
|
|
|
{
|
|
|
|
|
os << "\\documentclass";
|
|
|
|
|
|
|
|
|
|
LyXTextClass const & tclass = getLyXTextClass();
|
|
|
|
|
|
|
|
|
|
ostringstream clsoptions; // the document class options.
|
|
|
|
|
|
|
|
|
|
if (tokenPos(tclass.opt_fontsize(),
|
|
|
|
|
'|', fontsize) >= 0) {
|
|
|
|
|
// only write if existing in list (and not default)
|
|
|
|
|
clsoptions << fontsize << "pt,";
|
|
|
|
|
}
|
|
|
|
|
|
2005-07-16 16:57:55 +00:00
|
|
|
|
// custom, A3, B3 and B4 paper sizes need geometry
|
2006-10-22 10:15:23 +00:00
|
|
|
|
bool nonstandard_papersize = papersize == PAPER_B3
|
|
|
|
|
|| papersize == PAPER_B4
|
|
|
|
|
|| papersize == PAPER_A3
|
|
|
|
|
|| papersize == PAPER_CUSTOM;
|
2003-02-16 00:54:43 +00:00
|
|
|
|
|
2005-07-17 11:17:13 +00:00
|
|
|
|
if (!use_geometry) {
|
2003-02-16 00:54:43 +00:00
|
|
|
|
switch (papersize) {
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_A4:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
clsoptions << "a4paper,";
|
|
|
|
|
break;
|
|
|
|
|
case PAPER_USLETTER:
|
|
|
|
|
clsoptions << "letterpaper,";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_A5:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
clsoptions << "a5paper,";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_B5:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
clsoptions << "b5paper,";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_USEXECUTIVE:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
clsoptions << "executivepaper,";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_USLEGAL:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
clsoptions << "legalpaper,";
|
|
|
|
|
break;
|
2003-06-10 14:39:45 +00:00
|
|
|
|
case PAPER_DEFAULT:
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_A3:
|
|
|
|
|
case PAPER_B3:
|
|
|
|
|
case PAPER_B4:
|
|
|
|
|
case PAPER_CUSTOM:
|
2003-06-10 14:39:45 +00:00
|
|
|
|
break;
|
2003-02-16 00:54:43 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if needed
|
|
|
|
|
if (sides != tclass.sides()) {
|
|
|
|
|
switch (sides) {
|
|
|
|
|
case LyXTextClass::OneSide:
|
|
|
|
|
clsoptions << "oneside,";
|
|
|
|
|
break;
|
|
|
|
|
case LyXTextClass::TwoSides:
|
|
|
|
|
clsoptions << "twoside,";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if needed
|
|
|
|
|
if (columns != tclass.columns()) {
|
|
|
|
|
if (columns == 2)
|
|
|
|
|
clsoptions << "twocolumn,";
|
|
|
|
|
else
|
|
|
|
|
clsoptions << "onecolumn,";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!use_geometry
|
|
|
|
|
&& orientation == ORIENTATION_LANDSCAPE)
|
|
|
|
|
clsoptions << "landscape,";
|
|
|
|
|
|
|
|
|
|
// language should be a parameter to \documentclass
|
|
|
|
|
if (language->babel() == "hebrew"
|
|
|
|
|
&& default_language->babel() != "hebrew")
|
|
|
|
|
// This seems necessary
|
|
|
|
|
features.useLanguage(default_language);
|
|
|
|
|
|
2003-05-23 11:18:43 +00:00
|
|
|
|
ostringstream language_options;
|
|
|
|
|
bool const use_babel = features.useBabel();
|
|
|
|
|
if (use_babel) {
|
2003-02-16 00:54:43 +00:00
|
|
|
|
language_options << features.getLanguages();
|
|
|
|
|
language_options << language->babel();
|
|
|
|
|
if (lyxrc.language_global_options)
|
|
|
|
|
clsoptions << language_options.str() << ',';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// the user-defined options
|
|
|
|
|
if (!options.empty()) {
|
|
|
|
|
clsoptions << options << ',';
|
|
|
|
|
}
|
|
|
|
|
|
2003-09-15 11:00:00 +00:00
|
|
|
|
string strOptions(clsoptions.str());
|
2003-02-16 00:54:43 +00:00
|
|
|
|
if (!strOptions.empty()) {
|
|
|
|
|
strOptions = rtrim(strOptions, ",");
|
2006-10-19 16:51:30 +00:00
|
|
|
|
// FIXME UNICODE
|
2006-10-21 00:16:43 +00:00
|
|
|
|
os << '[' << from_utf8(strOptions) << ']';
|
2003-02-16 00:54:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
os << '{' << from_ascii(tclass.latexname()) << "}\n";
|
2003-02-16 00:54:43 +00:00
|
|
|
|
texrow.newline();
|
|
|
|
|
// end of \documentclass defs
|
|
|
|
|
|
|
|
|
|
// font selection must be done before loading fontenc.sty
|
2006-09-09 15:27:44 +00:00
|
|
|
|
string const fonts =
|
2007-02-08 15:18:36 +00:00
|
|
|
|
loadFonts(fontsRoman, fontsSans,
|
The Grand Font Selection Redesign:
* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).
* lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).
* lib/chkconfig.ltx: Test for newly supported font packages
* lib/doc/LaTeXConfig.lyx.in: document newly supported font packages
* lib/doc/UserGuide.lyx: document new UI.
* lib/doc/Extended.lyx: update PostScript font documentation
* development/FORMAT: document file format change 246->247.
* src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans,
tex_fonts_monospaced (with GUI equivalents).
* src/buffer.C: Format up to 247.
* src/bufferparams.C:
new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,
fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
(LyXFont const BufferParams::getFont): consider switch of default family.
(string const BufferParams::loadFonts): new method to get all the LaTeX
font stuff done.
* src/paragraph.C
(LyXFont const Paragraph::getFont):
(LyXFont const Paragraph::getLabelFont):
(LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's
default font
* src/text.C
(int LyXText::leftMargin):
(int LyXText::rightMargin): user buffer's not textclass's default font
* src/text2.C
(LyXFont LyXText::getFont):
(LyXFont LyXText::getLayoutFont):
(LyXFont LyXText::getLabelFont): check if the family of the default document
font has been customized.
* src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).
* src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM).
* src/frontends/qt3/Makefile.dialogs: add new FontModuleBase
* src/frontends/qt3/ui/FontModuleBase.ui: new File
* src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets
* src/frontends/qt3/QDocument.C
* src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/Makefile.dialogs: add new FontUi
* src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/ui/FontUi.ui: new File
* src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets
* src/frontends/qt4/ui/compile_uic.sh: add new FontUi
* src/frontends/xforms/FormDocument.[Ch]: implement new font ui
* src/frontends/xforms/forms/form_document.fd: add new font tab.
* src/frontends/controllers/ControlDocument.[Ch]
(char ControlDocument::fontfamilies):
(char ControlDocument::fontfamilies_gui):
(bool ControlDocument::isFontAvailable):
(bool ControlDocument::providesSC):
(bool ControlDocument::providesOSF):
(bool ControlDocument::providesScale): new methods, providing font info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-19 08:10:17 +00:00
|
|
|
|
fontsTypewriter, fontsSC, fontsOSF,
|
|
|
|
|
fontsSansScale, fontsTypewriterScale);
|
|
|
|
|
if (!fonts.empty()) {
|
2006-10-21 00:16:43 +00:00
|
|
|
|
os << from_ascii(fonts);
|
2003-02-16 00:54:43 +00:00
|
|
|
|
texrow.newline();
|
|
|
|
|
}
|
The Grand Font Selection Redesign:
* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).
* lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).
* lib/chkconfig.ltx: Test for newly supported font packages
* lib/doc/LaTeXConfig.lyx.in: document newly supported font packages
* lib/doc/UserGuide.lyx: document new UI.
* lib/doc/Extended.lyx: update PostScript font documentation
* development/FORMAT: document file format change 246->247.
* src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans,
tex_fonts_monospaced (with GUI equivalents).
* src/buffer.C: Format up to 247.
* src/bufferparams.C:
new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,
fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
(LyXFont const BufferParams::getFont): consider switch of default family.
(string const BufferParams::loadFonts): new method to get all the LaTeX
font stuff done.
* src/paragraph.C
(LyXFont const Paragraph::getFont):
(LyXFont const Paragraph::getLabelFont):
(LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's
default font
* src/text.C
(int LyXText::leftMargin):
(int LyXText::rightMargin): user buffer's not textclass's default font
* src/text2.C
(LyXFont LyXText::getFont):
(LyXFont LyXText::getLayoutFont):
(LyXFont LyXText::getLabelFont): check if the family of the default document
font has been customized.
* src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).
* src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM).
* src/frontends/qt3/Makefile.dialogs: add new FontModuleBase
* src/frontends/qt3/ui/FontModuleBase.ui: new File
* src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets
* src/frontends/qt3/QDocument.C
* src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/Makefile.dialogs: add new FontUi
* src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/ui/FontUi.ui: new File
* src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets
* src/frontends/qt4/ui/compile_uic.sh: add new FontUi
* src/frontends/xforms/FormDocument.[Ch]: implement new font ui
* src/frontends/xforms/forms/form_document.fd: add new font tab.
* src/frontends/controllers/ControlDocument.[Ch]
(char ControlDocument::fontfamilies):
(char ControlDocument::fontfamilies_gui):
(bool ControlDocument::isFontAvailable):
(bool ControlDocument::providesSC):
(bool ControlDocument::providesOSF):
(bool ControlDocument::providesScale): new methods, providing font info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-19 08:10:17 +00:00
|
|
|
|
if (fontsDefaultFamily != "default")
|
2006-09-09 15:27:44 +00:00
|
|
|
|
os << "\\renewcommand{\\familydefault}{\\"
|
2006-10-21 00:16:43 +00:00
|
|
|
|
<< from_ascii(fontsDefaultFamily) << "}\n";
|
2003-02-16 00:54:43 +00:00
|
|
|
|
// this one is not per buffer
|
|
|
|
|
if (lyxrc.fontenc != "default") {
|
2006-10-21 00:16:43 +00:00
|
|
|
|
os << "\\usepackage[" << from_ascii(lyxrc.fontenc)
|
2003-02-16 00:54:43 +00:00
|
|
|
|
<< "]{fontenc}\n";
|
|
|
|
|
texrow.newline();
|
|
|
|
|
}
|
|
|
|
|
|
2006-10-26 15:01:45 +00:00
|
|
|
|
if (inputenc == "auto") {
|
|
|
|
|
string const doc_encoding =
|
|
|
|
|
language->encoding()->latexName();
|
|
|
|
|
|
|
|
|
|
// Create a list with all the input encodings used
|
|
|
|
|
// in the document
|
|
|
|
|
std::set<string> encodings =
|
|
|
|
|
features.getEncodingSet(doc_encoding);
|
|
|
|
|
|
2006-12-28 18:15:25 +00:00
|
|
|
|
// thailatex does not use the inputenc package, but sets up
|
|
|
|
|
// babel directly for tis620-0 encoding, therefore we must
|
|
|
|
|
// not request inputenc for tis620-0 encoding
|
|
|
|
|
if (!encodings.empty() || doc_encoding != "tis620-0") {
|
|
|
|
|
os << "\\usepackage[";
|
|
|
|
|
std::set<string>::const_iterator it = encodings.begin();
|
|
|
|
|
std::set<string>::const_iterator const end = encodings.end();
|
|
|
|
|
if (it != end) {
|
|
|
|
|
os << from_ascii(*it);
|
|
|
|
|
++it;
|
|
|
|
|
}
|
|
|
|
|
for (; it != end; ++it)
|
|
|
|
|
os << ',' << from_ascii(*it);
|
|
|
|
|
if (doc_encoding != "tis620-0") {
|
|
|
|
|
if (!encodings.empty())
|
|
|
|
|
os << ',';
|
|
|
|
|
os << from_ascii(doc_encoding);
|
|
|
|
|
}
|
|
|
|
|
os << "]{inputenc}\n";
|
|
|
|
|
texrow.newline();
|
|
|
|
|
}
|
2007-02-16 18:29:48 +00:00
|
|
|
|
} else if (inputenc != "default" && inputenc != "tis620-0" &&
|
|
|
|
|
inputenc != "ascii") {
|
2006-10-26 15:01:45 +00:00
|
|
|
|
os << "\\usepackage[" << from_ascii(inputenc)
|
|
|
|
|
<< "]{inputenc}\n";
|
2003-02-16 00:54:43 +00:00
|
|
|
|
texrow.newline();
|
|
|
|
|
}
|
|
|
|
|
|
2005-07-16 16:57:55 +00:00
|
|
|
|
if (use_geometry || nonstandard_papersize) {
|
2003-02-16 00:54:43 +00:00
|
|
|
|
os << "\\usepackage{geometry}\n";
|
|
|
|
|
texrow.newline();
|
|
|
|
|
os << "\\geometry{verbose";
|
|
|
|
|
if (orientation == ORIENTATION_LANDSCAPE)
|
|
|
|
|
os << ",landscape";
|
2005-07-16 16:57:55 +00:00
|
|
|
|
switch (papersize) {
|
|
|
|
|
case PAPER_CUSTOM:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
if (!paperwidth.empty())
|
|
|
|
|
os << ",paperwidth="
|
2006-10-21 00:16:43 +00:00
|
|
|
|
<< from_ascii(paperwidth);
|
2003-02-16 00:54:43 +00:00
|
|
|
|
if (!paperheight.empty())
|
|
|
|
|
os << ",paperheight="
|
2006-10-21 00:16:43 +00:00
|
|
|
|
<< from_ascii(paperheight);
|
2003-02-16 00:54:43 +00:00
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_USLETTER:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
os << ",letterpaper";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_USLEGAL:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
os << ",legalpaper";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_USEXECUTIVE:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
os << ",executivepaper";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_A3:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
os << ",a3paper";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_A4:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
os << ",a4paper";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_A5:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
os << ",a5paper";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_B3:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
os << ",b3paper";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_B4:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
os << ",b4paper";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_B5:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
os << ",b5paper";
|
|
|
|
|
break;
|
|
|
|
|
default:
|
2005-07-16 16:57:55 +00:00
|
|
|
|
// default papersize ie PAPER_DEFAULT
|
2003-02-16 00:54:43 +00:00
|
|
|
|
switch (lyxrc.default_papersize) {
|
|
|
|
|
case PAPER_DEFAULT: // keep compiler happy
|
|
|
|
|
case PAPER_USLETTER:
|
|
|
|
|
os << ",letterpaper";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_USLEGAL:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
os << ",legalpaper";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_USEXECUTIVE:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
os << ",executivepaper";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_A3:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
os << ",a3paper";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_A4:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
os << ",a4paper";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_A5:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
os << ",a5paper";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_B5:
|
2003-02-16 00:54:43 +00:00
|
|
|
|
os << ",b5paper";
|
|
|
|
|
break;
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_B3:
|
|
|
|
|
case PAPER_B4:
|
|
|
|
|
case PAPER_CUSTOM:
|
|
|
|
|
break;
|
2003-02-16 00:54:43 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!topmargin.empty())
|
2007-04-05 13:51:42 +00:00
|
|
|
|
os << ",tmargin=" << from_ascii(LyXLength(topmargin).asLatexString());
|
2003-02-16 00:54:43 +00:00
|
|
|
|
if (!bottommargin.empty())
|
2007-04-05 13:51:42 +00:00
|
|
|
|
os << ",bmargin=" << from_ascii(LyXLength(bottommargin).asLatexString());
|
2003-02-16 00:54:43 +00:00
|
|
|
|
if (!leftmargin.empty())
|
2007-04-05 13:51:42 +00:00
|
|
|
|
os << ",lmargin=" << from_ascii(LyXLength(leftmargin).asLatexString());
|
2003-02-16 00:54:43 +00:00
|
|
|
|
if (!rightmargin.empty())
|
2007-04-05 13:51:42 +00:00
|
|
|
|
os << ",rmargin=" << from_ascii(LyXLength(rightmargin).asLatexString());
|
2003-02-16 00:54:43 +00:00
|
|
|
|
if (!headheight.empty())
|
2007-04-05 13:51:42 +00:00
|
|
|
|
os << ",headheight=" << from_ascii(LyXLength(headheight).asLatexString());
|
2003-02-16 00:54:43 +00:00
|
|
|
|
if (!headsep.empty())
|
2007-04-05 13:51:42 +00:00
|
|
|
|
os << ",headsep=" << from_ascii(LyXLength(headsep).asLatexString());
|
2003-02-16 00:54:43 +00:00
|
|
|
|
if (!footskip.empty())
|
2007-04-05 13:51:42 +00:00
|
|
|
|
os << ",footskip=" << from_ascii(LyXLength(footskip).asLatexString());
|
2003-02-16 00:54:43 +00:00
|
|
|
|
os << "}\n";
|
|
|
|
|
texrow.newline();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (tokenPos(tclass.opt_pagestyle(),
|
|
|
|
|
'|', pagestyle) >= 0) {
|
|
|
|
|
if (pagestyle == "fancy") {
|
|
|
|
|
os << "\\usepackage{fancyhdr}\n";
|
|
|
|
|
texrow.newline();
|
|
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
os << "\\pagestyle{" << from_ascii(pagestyle) << "}\n";
|
2003-02-16 00:54:43 +00:00
|
|
|
|
texrow.newline();
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-24 11:57:19 +00:00
|
|
|
|
// Only if class has a ToC hierarchy
|
|
|
|
|
if (tclass.hasTocLevels()) {
|
|
|
|
|
if (secnumdepth != tclass.secnumdepth()) {
|
|
|
|
|
os << "\\setcounter{secnumdepth}{"
|
|
|
|
|
<< secnumdepth
|
|
|
|
|
<< "}\n";
|
|
|
|
|
texrow.newline();
|
|
|
|
|
}
|
|
|
|
|
if (tocdepth != tclass.tocdepth()) {
|
|
|
|
|
os << "\\setcounter{tocdepth}{"
|
|
|
|
|
<< tocdepth
|
|
|
|
|
<< "}\n";
|
|
|
|
|
texrow.newline();
|
|
|
|
|
}
|
2003-02-16 00:54:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (paragraph_separation) {
|
2003-09-09 17:00:19 +00:00
|
|
|
|
switch (getDefSkip().kind()) {
|
2003-02-16 00:54:43 +00:00
|
|
|
|
case VSpace::SMALLSKIP:
|
2007-01-03 10:40:12 +00:00
|
|
|
|
os << "\\setlength{\\parskip}{\\smallskipamount}\n";
|
2003-02-16 00:54:43 +00:00
|
|
|
|
break;
|
|
|
|
|
case VSpace::MEDSKIP:
|
2007-01-03 10:40:12 +00:00
|
|
|
|
os << "\\setlength{\\parskip}{\\medskipamount}\n";
|
2003-02-16 00:54:43 +00:00
|
|
|
|
break;
|
|
|
|
|
case VSpace::BIGSKIP:
|
2007-01-03 10:40:12 +00:00
|
|
|
|
os << "\\setlength{\\parskip}{\\bigskipamount}\n";
|
2003-02-16 00:54:43 +00:00
|
|
|
|
break;
|
|
|
|
|
case VSpace::LENGTH:
|
2007-01-03 10:40:12 +00:00
|
|
|
|
os << "\\setlength{\\parskip}{"
|
2006-10-22 10:15:23 +00:00
|
|
|
|
<< from_utf8(getDefSkip().length().asLatexString())
|
2003-02-16 00:54:43 +00:00
|
|
|
|
<< "}\n";
|
|
|
|
|
break;
|
|
|
|
|
default: // should never happen // Then delete it.
|
2007-01-03 10:40:12 +00:00
|
|
|
|
os << "\\setlength{\\parskip}{\\medskipamount}\n";
|
2003-02-16 00:54:43 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
texrow.newline();
|
|
|
|
|
|
2007-01-03 10:40:12 +00:00
|
|
|
|
os << "\\setlength{\\parindent}{0pt}\n";
|
2003-02-16 00:54:43 +00:00
|
|
|
|
texrow.newline();
|
|
|
|
|
}
|
|
|
|
|
|
2004-03-07 14:33:17 +00:00
|
|
|
|
// If we use jurabib, we have to call babel here.
|
|
|
|
|
if (use_babel && features.isRequired("jurabib")) {
|
2006-10-21 00:16:43 +00:00
|
|
|
|
os << from_ascii(babelCall(language_options.str()))
|
2004-03-07 14:33:17 +00:00
|
|
|
|
<< '\n'
|
2006-10-21 00:16:43 +00:00
|
|
|
|
<< from_ascii(features.getBabelOptions());
|
2004-03-07 14:33:17 +00:00
|
|
|
|
texrow.newline();
|
|
|
|
|
}
|
2004-04-03 08:37:12 +00:00
|
|
|
|
|
2003-02-16 00:54:43 +00:00
|
|
|
|
// Now insert the LyX specific LaTeX commands...
|
|
|
|
|
|
|
|
|
|
// The optional packages;
|
2006-11-08 17:22:44 +00:00
|
|
|
|
docstring lyxpreamble(from_ascii(features.getPackages()));
|
2003-02-16 00:54:43 +00:00
|
|
|
|
|
|
|
|
|
// this might be useful...
|
|
|
|
|
lyxpreamble += "\n\\makeatletter\n";
|
|
|
|
|
|
|
|
|
|
// Some macros LyX will need
|
2006-11-08 17:22:44 +00:00
|
|
|
|
docstring tmppreamble(from_ascii(features.getMacros()));
|
2003-02-16 00:54:43 +00:00
|
|
|
|
|
|
|
|
|
if (!tmppreamble.empty()) {
|
|
|
|
|
lyxpreamble += "\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% "
|
|
|
|
|
"LyX specific LaTeX commands.\n"
|
|
|
|
|
+ tmppreamble + '\n';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// the text class specific preamble
|
|
|
|
|
tmppreamble = features.getTClassPreamble();
|
|
|
|
|
if (!tmppreamble.empty()) {
|
|
|
|
|
lyxpreamble += "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% "
|
|
|
|
|
"Textclass specific LaTeX commands.\n"
|
|
|
|
|
+ tmppreamble + '\n';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* the user-defined preamble */
|
|
|
|
|
if (!preamble.empty()) {
|
2006-11-08 17:22:44 +00:00
|
|
|
|
// FIXME UNICODE
|
2003-02-16 00:54:43 +00:00
|
|
|
|
lyxpreamble += "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% "
|
|
|
|
|
"User specified LaTeX commands.\n"
|
2006-11-08 17:22:44 +00:00
|
|
|
|
+ from_utf8(preamble) + '\n';
|
2003-02-16 00:54:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Itemize bullet settings need to be last in case the user
|
|
|
|
|
// defines their own bullets that use a package included
|
|
|
|
|
// in the user-defined preamble -- ARRae
|
|
|
|
|
// Actually it has to be done much later than that
|
|
|
|
|
// since some packages like frenchb make modifications
|
|
|
|
|
// at \begin{document} time -- JMarc
|
2006-11-08 17:22:44 +00:00
|
|
|
|
docstring bullets_def;
|
2003-02-16 00:54:43 +00:00
|
|
|
|
for (int i = 0; i < 4; ++i) {
|
2003-09-09 17:00:19 +00:00
|
|
|
|
if (user_defined_bullet(i) != ITEMIZE_DEFAULTS[i]) {
|
2003-02-16 00:54:43 +00:00
|
|
|
|
if (bullets_def.empty())
|
2006-11-08 17:22:44 +00:00
|
|
|
|
bullets_def += "\\AtBeginDocument{\n";
|
2006-03-10 16:25:20 +00:00
|
|
|
|
bullets_def += " \\def\\labelitemi";
|
2003-02-16 00:54:43 +00:00
|
|
|
|
switch (i) {
|
|
|
|
|
// `i' is one less than the item to modify
|
|
|
|
|
case 0:
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
bullets_def += 'i';
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
bullets_def += "ii";
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
bullets_def += 'v';
|
|
|
|
|
break;
|
|
|
|
|
}
|
2006-03-10 16:25:20 +00:00
|
|
|
|
bullets_def += '{' +
|
2006-11-08 17:22:44 +00:00
|
|
|
|
user_defined_bullet(i).getText()
|
2003-02-16 00:54:43 +00:00
|
|
|
|
+ "}\n";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!bullets_def.empty())
|
|
|
|
|
lyxpreamble += bullets_def + "}\n\n";
|
|
|
|
|
|
|
|
|
|
// We try to load babel late, in case it interferes
|
2004-04-03 08:37:12 +00:00
|
|
|
|
// with other packages.
|
2004-03-07 14:33:17 +00:00
|
|
|
|
// Jurabib has to be called after babel, though.
|
|
|
|
|
if (use_babel && !features.isRequired("jurabib")) {
|
2006-11-08 17:22:44 +00:00
|
|
|
|
// FIXME UNICODE
|
|
|
|
|
lyxpreamble += from_utf8(babelCall(language_options.str())) + '\n';
|
|
|
|
|
lyxpreamble += from_utf8(features.getBabelOptions());
|
2003-02-16 00:54:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lyxpreamble += "\\makeatother\n";
|
|
|
|
|
|
|
|
|
|
// dvipost settings come after everything else
|
2006-10-06 18:53:35 +00:00
|
|
|
|
if (features.isAvailable("dvipost") && outputChanges) {
|
2003-02-16 00:54:43 +00:00
|
|
|
|
lyxpreamble +=
|
|
|
|
|
"\\dvipostlayout\n"
|
|
|
|
|
"\\dvipost{osstart color push Red}\n"
|
|
|
|
|
"\\dvipost{osend color pop}\n"
|
|
|
|
|
"\\dvipost{cbstart color push Blue}\n"
|
2004-08-16 11:27:51 +00:00
|
|
|
|
"\\dvipost{cbend color pop}\n";
|
2003-02-16 00:54:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int const nlines =
|
|
|
|
|
int(lyx::count(lyxpreamble.begin(), lyxpreamble.end(), '\n'));
|
|
|
|
|
for (int j = 0; j != nlines; ++j) {
|
|
|
|
|
texrow.newline();
|
|
|
|
|
}
|
|
|
|
|
|
2006-11-08 17:22:44 +00:00
|
|
|
|
os << lyxpreamble;
|
2003-05-22 22:44:30 +00:00
|
|
|
|
return use_babel;
|
2003-02-16 00:54:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-01-05 20:21:27 +00:00
|
|
|
|
|
2001-09-17 15:39:58 +00:00
|
|
|
|
void BufferParams::useClassDefaults()
|
|
|
|
|
{
|
2002-03-02 16:39:54 +00:00
|
|
|
|
LyXTextClass const & tclass = textclasslist[textclass];
|
1999-11-04 01:40:20 +00:00
|
|
|
|
|
|
|
|
|
sides = tclass.sides();
|
|
|
|
|
columns = tclass.columns();
|
|
|
|
|
pagestyle = tclass.pagestyle();
|
|
|
|
|
options = tclass.options();
|
2006-03-24 11:57:19 +00:00
|
|
|
|
// Only if class has a ToC hierarchy
|
|
|
|
|
if (tclass.hasTocLevels()) {
|
|
|
|
|
secnumdepth = tclass.secnumdepth();
|
|
|
|
|
tocdepth = tclass.tocdepth();
|
|
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2001-09-17 15:39:58 +00:00
|
|
|
|
bool BufferParams::hasClassDefaults() const
|
|
|
|
|
{
|
2002-03-02 16:39:54 +00:00
|
|
|
|
LyXTextClass const & tclass = textclasslist[textclass];
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2001-09-17 15:39:58 +00:00
|
|
|
|
return (sides == tclass.sides()
|
|
|
|
|
&& columns == tclass.columns()
|
|
|
|
|
&& pagestyle == tclass.pagestyle()
|
|
|
|
|
&& options == tclass.options()
|
|
|
|
|
&& secnumdepth == tclass.secnumdepth()
|
|
|
|
|
&& tocdepth == tclass.tocdepth());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2002-07-21 21:21:06 +00:00
|
|
|
|
LyXTextClass const & BufferParams::getLyXTextClass() const
|
|
|
|
|
{
|
|
|
|
|
return textclasslist[textclass];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-02-05 13:20:16 +00:00
|
|
|
|
LyXFont const BufferParams::getFont() const
|
|
|
|
|
{
|
|
|
|
|
LyXFont f = getLyXTextClass().defaultfont();
|
|
|
|
|
f.setLanguage(language);
|
The Grand Font Selection Redesign:
* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).
* lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).
* lib/chkconfig.ltx: Test for newly supported font packages
* lib/doc/LaTeXConfig.lyx.in: document newly supported font packages
* lib/doc/UserGuide.lyx: document new UI.
* lib/doc/Extended.lyx: update PostScript font documentation
* development/FORMAT: document file format change 246->247.
* src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans,
tex_fonts_monospaced (with GUI equivalents).
* src/buffer.C: Format up to 247.
* src/bufferparams.C:
new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,
fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
(LyXFont const BufferParams::getFont): consider switch of default family.
(string const BufferParams::loadFonts): new method to get all the LaTeX
font stuff done.
* src/paragraph.C
(LyXFont const Paragraph::getFont):
(LyXFont const Paragraph::getLabelFont):
(LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's
default font
* src/text.C
(int LyXText::leftMargin):
(int LyXText::rightMargin): user buffer's not textclass's default font
* src/text2.C
(LyXFont LyXText::getFont):
(LyXFont LyXText::getLayoutFont):
(LyXFont LyXText::getLabelFont): check if the family of the default document
font has been customized.
* src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).
* src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM).
* src/frontends/qt3/Makefile.dialogs: add new FontModuleBase
* src/frontends/qt3/ui/FontModuleBase.ui: new File
* src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets
* src/frontends/qt3/QDocument.C
* src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/Makefile.dialogs: add new FontUi
* src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/ui/FontUi.ui: new File
* src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets
* src/frontends/qt4/ui/compile_uic.sh: add new FontUi
* src/frontends/xforms/FormDocument.[Ch]: implement new font ui
* src/frontends/xforms/forms/form_document.fd: add new font tab.
* src/frontends/controllers/ControlDocument.[Ch]
(char ControlDocument::fontfamilies):
(char ControlDocument::fontfamilies_gui):
(bool ControlDocument::isFontAvailable):
(bool ControlDocument::providesSC):
(bool ControlDocument::providesOSF):
(bool ControlDocument::providesScale): new methods, providing font info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-19 08:10:17 +00:00
|
|
|
|
if (fontsDefaultFamily == "rmdefault")
|
|
|
|
|
f.setFamily(LyXFont::ROMAN_FAMILY);
|
|
|
|
|
else if (fontsDefaultFamily == "sfdefault")
|
|
|
|
|
f.setFamily(LyXFont::SANS_FAMILY);
|
|
|
|
|
else if (fontsDefaultFamily == "ttdefault")
|
|
|
|
|
f.setFamily(LyXFont::TYPEWRITER_FAMILY);
|
2006-02-05 13:20:16 +00:00
|
|
|
|
return f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
1999-11-15 12:01:38 +00:00
|
|
|
|
void BufferParams::readPreamble(LyXLex & lex)
|
1999-09-27 18:44:28 +00:00
|
|
|
|
{
|
2001-08-06 19:12:46 +00:00
|
|
|
|
if (lex.getString() != "\\begin_preamble")
|
1999-10-07 18:44:17 +00:00
|
|
|
|
lyxerr << "Error (BufferParams::readPreamble):"
|
|
|
|
|
"consistency check failed." << endl;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
preamble = lex.getLongString("\\end_preamble");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
1999-11-15 12:01:38 +00:00
|
|
|
|
void BufferParams::readLanguage(LyXLex & lex)
|
1999-09-27 18:44:28 +00:00
|
|
|
|
{
|
|
|
|
|
if (!lex.next()) return;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2001-08-06 19:12:46 +00:00
|
|
|
|
string const tmptok = lex.getString();
|
2000-03-12 10:35:05 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
// check if tmptok is part of tex_babel in tex-defs.h
|
2000-10-10 12:36:36 +00:00
|
|
|
|
language = languages.getLanguage(tmptok);
|
|
|
|
|
if (!language) {
|
|
|
|
|
// Language tmptok was not found
|
|
|
|
|
language = default_language;
|
2000-11-28 06:46:06 +00:00
|
|
|
|
lyxerr << "Warning: Setting language `"
|
|
|
|
|
<< tmptok << "' to `" << language->lang()
|
2000-10-10 12:36:36 +00:00
|
|
|
|
<< "'." << endl;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
1999-11-15 12:01:38 +00:00
|
|
|
|
void BufferParams::readGraphicsDriver(LyXLex & lex)
|
1999-09-27 18:44:28 +00:00
|
|
|
|
{
|
|
|
|
|
if (!lex.next()) return;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
2001-08-06 19:12:46 +00:00
|
|
|
|
string const tmptok = lex.getString();
|
1999-09-27 18:44:28 +00:00
|
|
|
|
// check if tmptok is part of tex_graphics in tex_defs.h
|
2000-11-21 15:46:13 +00:00
|
|
|
|
int n = 0;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
while (true) {
|
2000-11-21 15:46:13 +00:00
|
|
|
|
string const test = tex_graphics[n++];
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
|
|
|
|
if (test == tmptok) {
|
1999-09-27 18:44:28 +00:00
|
|
|
|
graphicsDriver = tmptok;
|
|
|
|
|
break;
|
2005-02-12 16:21:32 +00:00
|
|
|
|
} else if (test == "") {
|
1999-09-27 18:44:28 +00:00
|
|
|
|
lex.printError(
|
|
|
|
|
"Warning: graphics driver `$$Token' not recognized!\n"
|
|
|
|
|
" Setting graphics driver to `default'.\n");
|
|
|
|
|
graphicsDriver = "default";
|
|
|
|
|
break;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2003-07-17 08:23:33 +00:00
|
|
|
|
|
|
|
|
|
|
2004-10-05 13:18:28 +00:00
|
|
|
|
void BufferParams::readBullets(LyXLex & lex)
|
|
|
|
|
{
|
|
|
|
|
if (!lex.next()) return;
|
|
|
|
|
|
|
|
|
|
int const index = lex.getInteger();
|
|
|
|
|
lex.next();
|
|
|
|
|
int temp_int = lex.getInteger();
|
|
|
|
|
user_defined_bullet(index).setFont(temp_int);
|
|
|
|
|
temp_bullet(index).setFont(temp_int);
|
|
|
|
|
lex >> temp_int;
|
|
|
|
|
user_defined_bullet(index).setCharacter(temp_int);
|
|
|
|
|
temp_bullet(index).setCharacter(temp_int);
|
|
|
|
|
lex >> temp_int;
|
|
|
|
|
user_defined_bullet(index).setSize(temp_int);
|
2004-10-26 21:16:44 +00:00
|
|
|
|
temp_bullet(index).setSize(temp_int);
|
2004-10-05 13:18:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void BufferParams::readBulletsLaTeX(LyXLex & lex)
|
|
|
|
|
{
|
|
|
|
|
// The bullet class should be able to read this.
|
|
|
|
|
if (!lex.next()) return;
|
|
|
|
|
int const index = lex.getInteger();
|
|
|
|
|
lex.next(true);
|
2006-10-20 19:26:23 +00:00
|
|
|
|
docstring const temp_str = lex.getDocString();
|
2004-10-05 13:18:28 +00:00
|
|
|
|
|
|
|
|
|
user_defined_bullet(index).setText(temp_str);
|
|
|
|
|
temp_bullet(index).setText(temp_str);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-07-17 08:23:33 +00:00
|
|
|
|
string const BufferParams::paperSizeName() const
|
|
|
|
|
{
|
|
|
|
|
char real_papersize = papersize;
|
|
|
|
|
if (real_papersize == PAPER_DEFAULT)
|
|
|
|
|
real_papersize = lyxrc.default_papersize;
|
|
|
|
|
|
|
|
|
|
switch (real_papersize) {
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_A3:
|
2003-07-17 08:23:33 +00:00
|
|
|
|
return "a3";
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_A4:
|
2003-07-17 08:23:33 +00:00
|
|
|
|
return "a4";
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_A5:
|
2003-07-17 08:23:33 +00:00
|
|
|
|
return "a5";
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_B5:
|
2003-07-17 08:23:33 +00:00
|
|
|
|
return "b5";
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_USEXECUTIVE:
|
2003-07-17 08:23:33 +00:00
|
|
|
|
return "foolscap";
|
2005-07-16 16:57:55 +00:00
|
|
|
|
case PAPER_USLEGAL:
|
2003-07-17 08:23:33 +00:00
|
|
|
|
return "legal";
|
|
|
|
|
case PAPER_USLETTER:
|
|
|
|
|
default:
|
|
|
|
|
return "letter";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string const BufferParams::dvips_options() const
|
|
|
|
|
{
|
|
|
|
|
string result;
|
|
|
|
|
|
|
|
|
|
if (use_geometry
|
2005-07-16 16:57:55 +00:00
|
|
|
|
&& papersize == PAPER_CUSTOM
|
2003-07-17 08:23:33 +00:00
|
|
|
|
&& !lyxrc.print_paper_dimension_flag.empty()
|
|
|
|
|
&& !paperwidth.empty()
|
|
|
|
|
&& !paperheight.empty()) {
|
|
|
|
|
// using a custom papersize
|
|
|
|
|
result = lyxrc.print_paper_dimension_flag;
|
|
|
|
|
result += ' ' + paperwidth;
|
|
|
|
|
result += ',' + paperheight;
|
|
|
|
|
} else {
|
|
|
|
|
string const paper_option = paperSizeName();
|
|
|
|
|
if (paper_option != "letter" ||
|
|
|
|
|
orientation != ORIENTATION_LANDSCAPE) {
|
2003-07-28 14:40:29 +00:00
|
|
|
|
// dvips won't accept -t letter -t landscape.
|
2003-07-17 08:23:33 +00:00
|
|
|
|
// In all other cases, include the paper size
|
|
|
|
|
// explicitly.
|
|
|
|
|
result = lyxrc.print_paper_flag;
|
|
|
|
|
result += ' ' + paper_option;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (orientation == ORIENTATION_LANDSCAPE &&
|
2005-07-16 16:57:55 +00:00
|
|
|
|
papersize != PAPER_CUSTOM)
|
2003-07-17 08:23:33 +00:00
|
|
|
|
result += ' ' + lyxrc.print_landscape_flag;
|
|
|
|
|
return result;
|
|
|
|
|
}
|
2004-03-07 14:33:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string const BufferParams::babelCall(string const & lang_opts) const
|
|
|
|
|
{
|
|
|
|
|
string tmp = lyxrc.language_package;
|
|
|
|
|
if (!lyxrc.language_global_options && tmp == "\\usepackage{babel}")
|
|
|
|
|
tmp = string("\\usepackage[") + lang_opts + "]{babel}";
|
|
|
|
|
return tmp;
|
|
|
|
|
}
|
The Grand Font Selection Redesign:
* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).
* lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).
* lib/chkconfig.ltx: Test for newly supported font packages
* lib/doc/LaTeXConfig.lyx.in: document newly supported font packages
* lib/doc/UserGuide.lyx: document new UI.
* lib/doc/Extended.lyx: update PostScript font documentation
* development/FORMAT: document file format change 246->247.
* src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans,
tex_fonts_monospaced (with GUI equivalents).
* src/buffer.C: Format up to 247.
* src/bufferparams.C:
new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,
fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
(LyXFont const BufferParams::getFont): consider switch of default family.
(string const BufferParams::loadFonts): new method to get all the LaTeX
font stuff done.
* src/paragraph.C
(LyXFont const Paragraph::getFont):
(LyXFont const Paragraph::getLabelFont):
(LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's
default font
* src/text.C
(int LyXText::leftMargin):
(int LyXText::rightMargin): user buffer's not textclass's default font
* src/text2.C
(LyXFont LyXText::getFont):
(LyXFont LyXText::getLayoutFont):
(LyXFont LyXText::getLabelFont): check if the family of the default document
font has been customized.
* src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).
* src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM).
* src/frontends/qt3/Makefile.dialogs: add new FontModuleBase
* src/frontends/qt3/ui/FontModuleBase.ui: new File
* src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets
* src/frontends/qt3/QDocument.C
* src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/Makefile.dialogs: add new FontUi
* src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/ui/FontUi.ui: new File
* src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets
* src/frontends/qt4/ui/compile_uic.sh: add new FontUi
* src/frontends/xforms/FormDocument.[Ch]: implement new font ui
* src/frontends/xforms/forms/form_document.fd: add new font tab.
* src/frontends/controllers/ControlDocument.[Ch]
(char ControlDocument::fontfamilies):
(char ControlDocument::fontfamilies_gui):
(bool ControlDocument::isFontAvailable):
(bool ControlDocument::providesSC):
(bool ControlDocument::providesOSF):
(bool ControlDocument::providesScale): new methods, providing font info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-19 08:10:17 +00:00
|
|
|
|
|
|
|
|
|
|
2007-02-08 15:18:36 +00:00
|
|
|
|
string const BufferParams::loadFonts(string const & rm,
|
The Grand Font Selection Redesign:
* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).
* lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).
* lib/chkconfig.ltx: Test for newly supported font packages
* lib/doc/LaTeXConfig.lyx.in: document newly supported font packages
* lib/doc/UserGuide.lyx: document new UI.
* lib/doc/Extended.lyx: update PostScript font documentation
* development/FORMAT: document file format change 246->247.
* src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans,
tex_fonts_monospaced (with GUI equivalents).
* src/buffer.C: Format up to 247.
* src/bufferparams.C:
new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,
fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
(LyXFont const BufferParams::getFont): consider switch of default family.
(string const BufferParams::loadFonts): new method to get all the LaTeX
font stuff done.
* src/paragraph.C
(LyXFont const Paragraph::getFont):
(LyXFont const Paragraph::getLabelFont):
(LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's
default font
* src/text.C
(int LyXText::leftMargin):
(int LyXText::rightMargin): user buffer's not textclass's default font
* src/text2.C
(LyXFont LyXText::getFont):
(LyXFont LyXText::getLayoutFont):
(LyXFont LyXText::getLabelFont): check if the family of the default document
font has been customized.
* src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).
* src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM).
* src/frontends/qt3/Makefile.dialogs: add new FontModuleBase
* src/frontends/qt3/ui/FontModuleBase.ui: new File
* src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets
* src/frontends/qt3/QDocument.C
* src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/Makefile.dialogs: add new FontUi
* src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/ui/FontUi.ui: new File
* src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets
* src/frontends/qt4/ui/compile_uic.sh: add new FontUi
* src/frontends/xforms/FormDocument.[Ch]: implement new font ui
* src/frontends/xforms/forms/form_document.fd: add new font tab.
* src/frontends/controllers/ControlDocument.[Ch]
(char ControlDocument::fontfamilies):
(char ControlDocument::fontfamilies_gui):
(bool ControlDocument::isFontAvailable):
(bool ControlDocument::providesSC):
(bool ControlDocument::providesOSF):
(bool ControlDocument::providesScale): new methods, providing font info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-19 08:10:17 +00:00
|
|
|
|
string const & sf, string const & tt,
|
|
|
|
|
bool const & sc, bool const & osf,
|
|
|
|
|
int const & sfscale, int const & ttscale) const
|
|
|
|
|
{
|
|
|
|
|
/* The LaTeX font world is in a flux. In the PSNFSS font interface,
|
|
|
|
|
several packages have been replaced by others, that might not
|
|
|
|
|
be installed on every system. We have to take care for that
|
|
|
|
|
(see psnfss.pdf). We try to support all psnfss fonts as well
|
|
|
|
|
as the fonts that have become de facto standard in the LaTeX
|
|
|
|
|
world (e.g. Latin Modern). We do not support obsolete fonts
|
|
|
|
|
(like PSLatex). In general, it should be possible to mix any
|
|
|
|
|
rm font with any sf or tt font, respectively. (JSpitzm)
|
|
|
|
|
TODO:
|
|
|
|
|
-- separate math fonts.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
if (rm == "default" && sf == "default" && tt == "default")
|
|
|
|
|
//nothing to do
|
|
|
|
|
return string();
|
|
|
|
|
|
|
|
|
|
ostringstream os;
|
|
|
|
|
|
|
|
|
|
// ROMAN FONTS
|
|
|
|
|
// Computer Modern (must be explicitely selectable -- there might be classes
|
|
|
|
|
// that define a different default font!
|
|
|
|
|
if (rm == "cmr") {
|
|
|
|
|
os << "\\renewcommand{\\rmdefault}{cmr}\n";
|
|
|
|
|
// osf for Computer Modern needs eco.sty
|
|
|
|
|
if (osf)
|
|
|
|
|
os << "\\usepackage{eco}\n";
|
|
|
|
|
}
|
|
|
|
|
// Latin Modern Roman
|
|
|
|
|
else if (rm == "lmodern")
|
|
|
|
|
os << "\\usepackage{lmodern}\n";
|
|
|
|
|
// AE
|
|
|
|
|
else if (rm == "ae") {
|
|
|
|
|
// not needed when using OT1 font encoding.
|
|
|
|
|
if (lyxrc.fontenc != "default")
|
|
|
|
|
os << "\\usepackage{ae,aecompl}\n";
|
|
|
|
|
}
|
|
|
|
|
// Times
|
|
|
|
|
else if (rm == "times") {
|
|
|
|
|
// try to load the best available package
|
2007-02-08 15:18:36 +00:00
|
|
|
|
if (LaTeXFeatures::isAvailable("mathptmx"))
|
The Grand Font Selection Redesign:
* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).
* lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).
* lib/chkconfig.ltx: Test for newly supported font packages
* lib/doc/LaTeXConfig.lyx.in: document newly supported font packages
* lib/doc/UserGuide.lyx: document new UI.
* lib/doc/Extended.lyx: update PostScript font documentation
* development/FORMAT: document file format change 246->247.
* src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans,
tex_fonts_monospaced (with GUI equivalents).
* src/buffer.C: Format up to 247.
* src/bufferparams.C:
new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,
fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
(LyXFont const BufferParams::getFont): consider switch of default family.
(string const BufferParams::loadFonts): new method to get all the LaTeX
font stuff done.
* src/paragraph.C
(LyXFont const Paragraph::getFont):
(LyXFont const Paragraph::getLabelFont):
(LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's
default font
* src/text.C
(int LyXText::leftMargin):
(int LyXText::rightMargin): user buffer's not textclass's default font
* src/text2.C
(LyXFont LyXText::getFont):
(LyXFont LyXText::getLayoutFont):
(LyXFont LyXText::getLabelFont): check if the family of the default document
font has been customized.
* src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).
* src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM).
* src/frontends/qt3/Makefile.dialogs: add new FontModuleBase
* src/frontends/qt3/ui/FontModuleBase.ui: new File
* src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets
* src/frontends/qt3/QDocument.C
* src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/Makefile.dialogs: add new FontUi
* src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/ui/FontUi.ui: new File
* src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets
* src/frontends/qt4/ui/compile_uic.sh: add new FontUi
* src/frontends/xforms/FormDocument.[Ch]: implement new font ui
* src/frontends/xforms/forms/form_document.fd: add new font tab.
* src/frontends/controllers/ControlDocument.[Ch]
(char ControlDocument::fontfamilies):
(char ControlDocument::fontfamilies_gui):
(bool ControlDocument::isFontAvailable):
(bool ControlDocument::providesSC):
(bool ControlDocument::providesOSF):
(bool ControlDocument::providesScale): new methods, providing font info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-19 08:10:17 +00:00
|
|
|
|
os << "\\usepackage{mathptmx}\n";
|
2007-02-08 15:18:36 +00:00
|
|
|
|
else if (LaTeXFeatures::isAvailable("mathptm"))
|
The Grand Font Selection Redesign:
* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).
* lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).
* lib/chkconfig.ltx: Test for newly supported font packages
* lib/doc/LaTeXConfig.lyx.in: document newly supported font packages
* lib/doc/UserGuide.lyx: document new UI.
* lib/doc/Extended.lyx: update PostScript font documentation
* development/FORMAT: document file format change 246->247.
* src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans,
tex_fonts_monospaced (with GUI equivalents).
* src/buffer.C: Format up to 247.
* src/bufferparams.C:
new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,
fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
(LyXFont const BufferParams::getFont): consider switch of default family.
(string const BufferParams::loadFonts): new method to get all the LaTeX
font stuff done.
* src/paragraph.C
(LyXFont const Paragraph::getFont):
(LyXFont const Paragraph::getLabelFont):
(LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's
default font
* src/text.C
(int LyXText::leftMargin):
(int LyXText::rightMargin): user buffer's not textclass's default font
* src/text2.C
(LyXFont LyXText::getFont):
(LyXFont LyXText::getLayoutFont):
(LyXFont LyXText::getLabelFont): check if the family of the default document
font has been customized.
* src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).
* src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM).
* src/frontends/qt3/Makefile.dialogs: add new FontModuleBase
* src/frontends/qt3/ui/FontModuleBase.ui: new File
* src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets
* src/frontends/qt3/QDocument.C
* src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/Makefile.dialogs: add new FontUi
* src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/ui/FontUi.ui: new File
* src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets
* src/frontends/qt4/ui/compile_uic.sh: add new FontUi
* src/frontends/xforms/FormDocument.[Ch]: implement new font ui
* src/frontends/xforms/forms/form_document.fd: add new font tab.
* src/frontends/controllers/ControlDocument.[Ch]
(char ControlDocument::fontfamilies):
(char ControlDocument::fontfamilies_gui):
(bool ControlDocument::isFontAvailable):
(bool ControlDocument::providesSC):
(bool ControlDocument::providesOSF):
(bool ControlDocument::providesScale): new methods, providing font info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-19 08:10:17 +00:00
|
|
|
|
os << "\\usepackage{mathptm}\n";
|
|
|
|
|
else
|
|
|
|
|
os << "\\usepackage{times}\n";
|
|
|
|
|
}
|
|
|
|
|
// Palatino
|
|
|
|
|
else if (rm == "palatino") {
|
|
|
|
|
// try to load the best available package
|
2007-02-08 15:18:36 +00:00
|
|
|
|
if (LaTeXFeatures::isAvailable("mathpazo")) {
|
The Grand Font Selection Redesign:
* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).
* lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).
* lib/chkconfig.ltx: Test for newly supported font packages
* lib/doc/LaTeXConfig.lyx.in: document newly supported font packages
* lib/doc/UserGuide.lyx: document new UI.
* lib/doc/Extended.lyx: update PostScript font documentation
* development/FORMAT: document file format change 246->247.
* src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans,
tex_fonts_monospaced (with GUI equivalents).
* src/buffer.C: Format up to 247.
* src/bufferparams.C:
new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,
fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
(LyXFont const BufferParams::getFont): consider switch of default family.
(string const BufferParams::loadFonts): new method to get all the LaTeX
font stuff done.
* src/paragraph.C
(LyXFont const Paragraph::getFont):
(LyXFont const Paragraph::getLabelFont):
(LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's
default font
* src/text.C
(int LyXText::leftMargin):
(int LyXText::rightMargin): user buffer's not textclass's default font
* src/text2.C
(LyXFont LyXText::getFont):
(LyXFont LyXText::getLayoutFont):
(LyXFont LyXText::getLabelFont): check if the family of the default document
font has been customized.
* src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).
* src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM).
* src/frontends/qt3/Makefile.dialogs: add new FontModuleBase
* src/frontends/qt3/ui/FontModuleBase.ui: new File
* src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets
* src/frontends/qt3/QDocument.C
* src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/Makefile.dialogs: add new FontUi
* src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/ui/FontUi.ui: new File
* src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets
* src/frontends/qt4/ui/compile_uic.sh: add new FontUi
* src/frontends/xforms/FormDocument.[Ch]: implement new font ui
* src/frontends/xforms/forms/form_document.fd: add new font tab.
* src/frontends/controllers/ControlDocument.[Ch]
(char ControlDocument::fontfamilies):
(char ControlDocument::fontfamilies_gui):
(bool ControlDocument::isFontAvailable):
(bool ControlDocument::providesSC):
(bool ControlDocument::providesOSF):
(bool ControlDocument::providesScale): new methods, providing font info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-19 08:10:17 +00:00
|
|
|
|
os << "\\usepackage";
|
|
|
|
|
if (osf || sc) {
|
|
|
|
|
os << '[';
|
|
|
|
|
if (!osf)
|
|
|
|
|
os << "sc";
|
|
|
|
|
else
|
|
|
|
|
// "osf" includes "sc"!
|
|
|
|
|
os << "osf";
|
|
|
|
|
os << ']';
|
|
|
|
|
}
|
|
|
|
|
os << "{mathpazo}\n";
|
|
|
|
|
}
|
2007-02-08 15:18:36 +00:00
|
|
|
|
else if (LaTeXFeatures::isAvailable("mathpple"))
|
The Grand Font Selection Redesign:
* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).
* lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).
* lib/chkconfig.ltx: Test for newly supported font packages
* lib/doc/LaTeXConfig.lyx.in: document newly supported font packages
* lib/doc/UserGuide.lyx: document new UI.
* lib/doc/Extended.lyx: update PostScript font documentation
* development/FORMAT: document file format change 246->247.
* src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans,
tex_fonts_monospaced (with GUI equivalents).
* src/buffer.C: Format up to 247.
* src/bufferparams.C:
new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,
fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
(LyXFont const BufferParams::getFont): consider switch of default family.
(string const BufferParams::loadFonts): new method to get all the LaTeX
font stuff done.
* src/paragraph.C
(LyXFont const Paragraph::getFont):
(LyXFont const Paragraph::getLabelFont):
(LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's
default font
* src/text.C
(int LyXText::leftMargin):
(int LyXText::rightMargin): user buffer's not textclass's default font
* src/text2.C
(LyXFont LyXText::getFont):
(LyXFont LyXText::getLayoutFont):
(LyXFont LyXText::getLabelFont): check if the family of the default document
font has been customized.
* src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).
* src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM).
* src/frontends/qt3/Makefile.dialogs: add new FontModuleBase
* src/frontends/qt3/ui/FontModuleBase.ui: new File
* src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets
* src/frontends/qt3/QDocument.C
* src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/Makefile.dialogs: add new FontUi
* src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/ui/FontUi.ui: new File
* src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets
* src/frontends/qt4/ui/compile_uic.sh: add new FontUi
* src/frontends/xforms/FormDocument.[Ch]: implement new font ui
* src/frontends/xforms/forms/form_document.fd: add new font tab.
* src/frontends/controllers/ControlDocument.[Ch]
(char ControlDocument::fontfamilies):
(char ControlDocument::fontfamilies_gui):
(bool ControlDocument::isFontAvailable):
(bool ControlDocument::providesSC):
(bool ControlDocument::providesOSF):
(bool ControlDocument::providesScale): new methods, providing font info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-19 08:10:17 +00:00
|
|
|
|
os << "\\usepackage{mathpple}\n";
|
|
|
|
|
else
|
|
|
|
|
os << "\\usepackage{palatino}\n";
|
|
|
|
|
}
|
|
|
|
|
// Utopia
|
|
|
|
|
else if (rm == "utopia") {
|
|
|
|
|
// fourier supersedes utopia.sty, but does
|
|
|
|
|
// not work with OT1 encoding.
|
2007-02-08 15:18:36 +00:00
|
|
|
|
if (LaTeXFeatures::isAvailable("fourier")
|
The Grand Font Selection Redesign:
* lib/lyx2lyx/LyX.py (format_relation): add file format 247 (from Georg BAUM).
* lib/lyx2lyx/lyx_1_5.py: add convert_font_settings, revert_font_settings (from Georg BAUM).
* lib/chkconfig.ltx: Test for newly supported font packages
* lib/doc/LaTeXConfig.lyx.in: document newly supported font packages
* lib/doc/UserGuide.lyx: document new UI.
* lib/doc/Extended.lyx: update PostScript font documentation
* development/FORMAT: document file format change 246->247.
* src/tex-strings.[Ch]: new strings tex_fonts_roman, tex_fonts_sans,
tex_fonts_monospaced (with GUI equivalents).
* src/buffer.C: Format up to 247.
* src/bufferparams.C:
new params fontsRoman, fontsSans, fontsTypewriter, fontsDefaultFamily,
fontsSC, fontsOSF, fontsSansScale and fontsTypewriterScale
(LyXFont const BufferParams::getFont): consider switch of default family.
(string const BufferParams::loadFonts): new method to get all the LaTeX
font stuff done.
* src/paragraph.C
(LyXFont const Paragraph::getFont):
(LyXFont const Paragraph::getLabelFont):
(LyXFont const Paragraph::getLayoutFont): user buffer's not textclass's
default font
* src/text.C
(int LyXText::leftMargin):
(int LyXText::rightMargin): user buffer's not textclass's default font
* src/text2.C
(LyXFont LyXText::getFont):
(LyXFont LyXText::getLayoutFont):
(LyXFont LyXText::getLabelFont): check if the family of the default document
font has been customized.
* src/frontends/gtk/GDocument.[Ch]: implement new font ui (from Georg BAUM).
* src/frontends/gtk/glade/document.glade: implement new font ui (from Georg BAUM).
* src/frontends/qt3/Makefile.dialogs: add new FontModuleBase
* src/frontends/qt3/ui/FontModuleBase.ui: new File
* src/frontends/qt3/ui/TextLayoutModuleBase.ui: remove font widgets
* src/frontends/qt3/QDocument.C
* src/frontends/qt3/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/Makefile.dialogs: add new FontUi
* src/frontends/qt4/QDocumentDialog.[Ch]: implement new font ui
* src/frontends/qt4/ui/FontUi.ui: new File
* src/frontends/qt4/ui/TextLayoutUi.ui: remove font widgets
* src/frontends/qt4/ui/compile_uic.sh: add new FontUi
* src/frontends/xforms/FormDocument.[Ch]: implement new font ui
* src/frontends/xforms/forms/form_document.fd: add new font tab.
* src/frontends/controllers/ControlDocument.[Ch]
(char ControlDocument::fontfamilies):
(char ControlDocument::fontfamilies_gui):
(bool ControlDocument::isFontAvailable):
(bool ControlDocument::providesSC):
(bool ControlDocument::providesOSF):
(bool ControlDocument::providesScale): new methods, providing font info.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14143 a592a061-630c-0410-9148-cb99ea01b6c8
2006-06-19 08:10:17 +00:00
|
|
|
|
&& lyxrc.fontenc != "default") {
|
|
|
|
|
os << "\\usepackage";
|
|
|
|
|
if (osf || sc) {
|
|
|
|
|
os << '[';
|
|
|
|
|
if (sc)
|
|
|
|
|
os << "expert";
|
|
|
|
|
if (osf && sc)
|
|
|
|
|
os << ',';
|
|
|
|
|
if (osf)
|
|
|
|
|
os << "oldstyle";
|
|
|
|
|
os << ']';
|
|
|
|
|
}
|
|
|
|
|
os << "{fourier}\n";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
os << "\\usepackage{utopia}\n";
|
|
|
|
|
}
|
|
|
|
|
// Bera (complete fontset)
|
|
|
|
|
else if (rm == "bera" && sf == "default" && tt == "default")
|
|
|
|
|
os << "\\usepackage{bera}\n";
|
|
|
|
|
// everything else
|
|
|
|
|
else if (rm != "default")
|
|
|
|
|
os << "\\usepackage" << "{" << rm << "}\n";
|
|
|
|
|
|
|
|
|
|
// SANS SERIF
|
|
|
|
|
// Helvetica, Bera Sans
|
|
|
|
|
if (sf == "helvet" || sf == "berasans") {
|
|
|
|
|
if (sfscale != 100)
|
|
|
|
|
os << "\\usepackage[scaled=" << float(sfscale) / 100
|
|
|
|
|
<< "]{" << sf << "}\n";
|
|
|
|
|
else
|
|
|
|
|
os << "\\usepackage{" << sf << "}\n";
|
|
|
|
|
}
|
|
|
|
|
// Avant Garde
|
|
|
|
|
else if (sf == "avant")
|
|
|
|
|
os << "\\usepackage{" << sf << "}\n";
|
|
|
|
|
// Computer Modern, Latin Modern, CM Bright
|
|
|
|
|
else if (sf != "default")
|
|
|
|
|
os << "\\renewcommand{\\sfdefault}{" << sf << "}\n";
|
|
|
|
|
|
|
|
|
|
// monospaced/typewriter
|
|
|
|
|
// Courier, LuxiMono
|
|
|
|
|
if (tt == "luximono" || tt == "beramono") {
|
|
|
|
|
if (ttscale != 100)
|
|
|
|
|
os << "\\usepackage[scaled=" << float(ttscale) / 100
|
|
|
|
|
<< "]{" << tt << "}\n";
|
|
|
|
|
else
|
|
|
|
|
os << "\\usepackage{" << tt << "}\n";
|
|
|
|
|
}
|
|
|
|
|
// Courier
|
|
|
|
|
else if (tt == "courier" )
|
|
|
|
|
os << "\\usepackage{" << tt << "}\n";
|
|
|
|
|
// Computer Modern, Latin Modern, CM Bright
|
|
|
|
|
else if (tt != "default")
|
|
|
|
|
os << "\\renewcommand{\\ttdefault}{" << tt << "}\n";
|
|
|
|
|
|
|
|
|
|
return os.str();
|
|
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
2006-12-10 16:08:52 +00:00
|
|
|
|
Encoding const & BufferParams::encoding() const
|
|
|
|
|
{
|
2007-01-13 14:36:54 +00:00
|
|
|
|
if (inputenc == "auto" || inputenc == "default")
|
2006-12-10 16:08:52 +00:00
|
|
|
|
return *(language->encoding());
|
2007-01-13 14:36:54 +00:00
|
|
|
|
Encoding const * const enc =
|
2006-12-29 09:24:18 +00:00
|
|
|
|
encodings.getFromLaTeXName(inputenc);
|
2006-12-10 16:08:52 +00:00
|
|
|
|
if (enc)
|
|
|
|
|
return *enc;
|
2007-01-13 14:36:54 +00:00
|
|
|
|
lyxerr << "Unknown inputenc value `" << inputenc
|
|
|
|
|
<< "'. Using `auto' instead." << endl;
|
2006-12-10 16:08:52 +00:00
|
|
|
|
return *(language->encoding());
|
|
|
|
|
}
|
|
|
|
|
|
2007-03-22 07:22:16 +00:00
|
|
|
|
|
2007-03-25 01:12:38 +00:00
|
|
|
|
biblio::CiteEngine BufferParams::getEngine() const
|
2007-03-22 07:22:16 +00:00
|
|
|
|
{
|
|
|
|
|
// FIXME the class should provide the numerical/
|
|
|
|
|
// authoryear choice
|
2007-04-06 09:02:23 +00:00
|
|
|
|
if (getLyXTextClass().provides("natbib")
|
2007-03-25 01:12:38 +00:00
|
|
|
|
&& cite_engine_ != biblio::ENGINE_NATBIB_NUMERICAL)
|
2007-03-22 07:22:16 +00:00
|
|
|
|
return biblio::ENGINE_NATBIB_AUTHORYEAR;
|
2007-03-25 01:12:38 +00:00
|
|
|
|
return cite_engine_;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void BufferParams::setCiteEngine(biblio::CiteEngine const cite_engine)
|
|
|
|
|
{
|
|
|
|
|
cite_engine_ = cite_engine;
|
2007-03-22 07:22:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
} // namespace lyx
|