namespace lyx {
-// special columntypes
-extern map<char, int> special_columns;
-
Preamble preamble;
namespace {
"kurierc", "kurierl", "kurierlc", "lmss", "tgadventor", "tgheros", 0};
const char * const known_typewriter_fonts[] = { "beramono", "cmtl", "cmtt",
-"courier", "lmtt", "luximono", "fourier", "lmodern", "mathpazo", "mathptmx",
-"newcent", "tgcursor", "txtt", 0};
+"courier", "lmtt", "luximono", "fourier", "libertineMono-type1", "lmodern",
+"mathpazo", "mathptmx", "newcent", "tgcursor", "txtt", 0};
const char * const known_math_fonts[] = { "eulervm", "newtxmath", 0};
"irish", "portuges", "thai", "bahasai", "english", "italian", "romanian", "turkish",
"bahasam", "esperanto", "lao", "russian", "turkmen", "basque", "estonian", "latin",
"samin", "ukrainian", "bengali", "farsi", "latvian", "sanskrit", "tibetan", "urdu",
-"brazil", "brazilian", "finnish", "lithuanian", "scottish", "usorbian", "breton",
+"brazil", "brazilian", "finnish", "lithuanian", "scottish", "usorbian", "breton",
"french", "lsorbian", "serbian", "vietnamese", "bulgarian", "galician", "magyar",
"slovak", "welsh", "catalan", "german", "malayalam", "slovenian", "coptic", "greek",
"marathi", "spanish", "austrian",
"polutonikogreek", 0};
+bool Preamble::usePolyglossia() const
+{
+ return h_use_non_tex_fonts && h_language_package == "default";
+}
+
+
bool Preamble::indentParagraphs() const
{
return h_paragraph_separation == "indent";
}
+int Preamble::getSpecialTableColumnArguments(char c) const
+{
+ map<char, int>::const_iterator it = special_columns_.find(c);
+ if (it == special_columns_.end())
+ return -1;
+ return it->second;
+}
+
+
void Preamble::add_package(string const & name, vector<string> & options)
{
// every package inherits the global options
h_font_typewriter = "default";
h_font_math = "auto";
h_font_default_family = "default";
- h_use_non_tex_fonts = "false";
+ h_use_non_tex_fonts = false;
h_font_sc = "false";
h_font_osf = "false";
h_font_sf_scale = "100";
if (is_known(name, known_xetex_packages)) {
xetex = true;
- h_use_non_tex_fonts = "true";
+ h_use_non_tex_fonts = true;
registerAutomaticallyLoadedPackage("fontspec");
if (h_inputencoding == "auto")
p.setEncoding("UTF-8");
else if (opts == "osf")
h_font_osf = "true";
}
-
+
if (name == "mathdesign") {
if (opts.find("charter") != string::npos)
h_font_roman = "md-charter";
// sansserif fonts
if (is_known(name, known_sans_fonts)) {
h_font_sans = name;
- if (options.size() == 1) {
+ if (options.size() >= 1) {
if (scale_as_percentage(opts, h_font_sf_scale))
options.clear();
}
}
- if (name == "biolinum-type1")
+ if (name == "biolinum-type1") {
h_font_sans = "biolinum";
+ // biolinum can have several options, e.g. [osf,scaled=0.97]
+ string::size_type pos = opts.find("osf");
+ if (pos != string::npos)
+ h_font_osf = "true";
+ }
// typewriter fonts
if (is_known(name, known_typewriter_fonts)) {
// fourier as typewriter is handled in handling of \ttdefault
if (name != "fourier") {
h_font_typewriter = name;
- if (options.size() == 1) {
+ if (options.size() >= 1) {
if (scale_as_percentage(opts, h_font_tt_scale))
options.clear();
}
}
}
+ if (name == "libertineMono-type1") {
+ h_font_typewriter = "libertine-mono";
+ }
+
// font uses old-style figure
if (name == "eco")
h_font_osf = "true";
h_font_math = "minion-ntxm";
}
+ if (name == "iwona")
+ if (opts == "math")
+ h_font_math = "iwona-math";
+
+ if (name == "kurier")
+ if (opts == "math")
+ h_font_math = "kurier-math";
+
// after the detection and handling of special cases, we can remove the
// fonts, otherwise they would appear in the preamble, see bug #7856
if (is_known(name, known_roman_fonts) || is_known(name, known_sans_fonts)
else if (name == "polyglossia") {
h_language_package = "default";
h_default_output_format = "pdf4";
- h_use_non_tex_fonts = "true";
+ h_use_non_tex_fonts = true;
xetex = true;
registerAutomaticallyLoadedPackage("xunicode");
if (h_inputencoding == "auto")
h_cite_engine_type = "authoryear";
}
+ else if (name == "bibtopic")
+ h_use_bibtopic = "true";
+
else if (name == "hyperref")
handle_hyperref(options);
<< "\\font_typewriter " << h_font_typewriter << "\n"
<< "\\font_math " << h_font_math << "\n"
<< "\\font_default_family " << h_font_default_family << "\n"
- << "\\use_non_tex_fonts " << h_use_non_tex_fonts << "\n"
+ << "\\use_non_tex_fonts " << (h_use_non_tex_fonts ? "true" : "false") << '\n'
<< "\\font_sc " << h_font_sc << "\n"
<< "\\font_osf " << h_font_osf << "\n"
<< "\\font_sf_scale " << h_font_sf_scale << "\n"
TeX2LyXDocClass & tc)
{
// initialize fixed types
- special_columns['D'] = 3;
+ special_columns_['D'] = 3;
bool is_full_document = false;
bool is_lyx_file = false;
bool in_lyx_preamble = false;
h_preamble << ss.str();
}
}
-
+
else if (t.cs() == "AtBeginDocument") {
string const name = p.verbatim_item();
// only non-lyxspecific stuff
istringstream is(string(opts, 1));
is >> nargs;
}
- special_columns[name[0]] = nargs;
+ special_columns_[name[0]] = nargs;
h_preamble << "\\newcolumntype{" << name << "}";
if (nargs)
h_preamble << "[" << nargs << "]";
else if (content == "\\bigskipamount")
h_defskip = "bigskip";
else
- h_defskip = content;
+ h_defskip = translate_len(content);
} else
h_preamble << "\\setlength{" << name << "}{" << content << "}";
}