namespace lyx {
-// special columntypes
-extern map<char, int> special_columns;
-
Preamble preamble;
namespace {
"greek", "hebrew", "hungarian", "icelandic", "indon", "indonesian", "interlingua",
"irish", "italian", "japanese", "kazakh", "kurmanji", "latin", "latvian", "lithuanian",
"lowersorbian", "lsorbian", "magyar", "malay", "meyalu", "mongolian", "naustrian",
-"newzealand", "ngerman", "ngermanb", "norsk", "nynorsk", "polutonikogreek", "polish",
-"portuges", "portuguese", "romanian", "russian", "russianb", "samin",
-"scottish", "serbian", "serbian-latin", "slovak", "slovene", "spanish",
-"swedish", "thai", "turkish", "turkmen", "ukraineb", "ukrainian",
-"uppersorbian", "UKenglish", "USenglish", "usorbian", "vietnam", "welsh",
+"newzealand", "ngerman", "ngermanb", "norsk", "nswissgerman", "nynorsk",
+"polutonikogreek", "polish", "portuges", "portuguese", "romanian", "russian",
+"russianb", "samin", "scottish", "serbian", "serbian-latin", "slovak",
+"slovene", "spanish", "swedish", "swissgerman", "thai", "turkish", "turkmen",
+"ukraineb", "ukrainian", "uppersorbian", "UKenglish", "USenglish", "usorbian",
+"vietnam", "welsh",
0};
/**
"greek", "hebrew", "magyar", "icelandic", "bahasa", "bahasa", "interlingua",
"irish", "italian", "japanese", "kazakh", "kurmanji", "latin", "latvian", "lithuanian",
"lowersorbian", "lowersorbian", "magyar", "bahasam", "bahasam", "mongolian", "naustrian",
-"newzealand", "ngerman", "ngerman", "norsk", "nynorsk", "polutonikogreek", "polish",
-"portuguese", "portuguese", "romanian", "russian", "russian", "samin",
-"scottish", "serbian", "serbian-latin", "slovak", "slovene", "spanish",
-"swedish", "thai", "turkish", "turkmen", "ukrainian", "ukrainian",
-"uppersorbian", "uppersorbian", "english", "english", "vietnamese", "welsh",
+"newzealand", "ngerman", "ngerman", "norsk", "german-ch", "nynorsk",
+"polutonikogreek", "polish", "portuguese", "portuguese", "romanian", "russian",
+"russian", "samin", "scottish", "serbian", "serbian-latin", "slovak",
+"slovene", "spanish", "swedish", "german-ch-old", "thai", "turkish", "turkmen",
+"ukrainian", "ukrainian", "uppersorbian", "english", "english", "uppersorbian",
+"vietnamese", "welsh",
0};
/// languages with danish quotes (.lyx names)
"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};
/**
* known polyglossia language names (including variants)
+ * FIXME: support spelling=old for german variants (german vs. ngerman LyX names etc)
*/
const char * const Preamble::polyglossia_languages[] = {
"albanian", "croatian", "hebrew", "norsk", "swedish", "amharic", "czech", "hindi",
"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",
+"marathi", "spanish", "austrian",
"american", "ancient", "australian", "british", "monotonic", "newzealand",
"polytonic", 0};
"brazilian", "brazilian", "finnish", "lithuanian", "scottish", "uppersorbian", "breton",
"french", "lowersorbian", "serbian", "vietnamese", "bulgarian", "galician", "magyar",
"slovak", "welsh", "catalan", "ngerman", "malayalam", "slovene", "coptic", "greek",
-"marathi", "spanish",
+"marathi", "spanish", "naustrian",
"american", "ancientgreek", "australian", "british", "greek", "newzealand",
"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
if (pos != string::npos) {
string value = scale.substr(pos + 1);
if (isStrDbl(value)) {
- percentage = convert<string>(100 * convert<double>(value));
+ percentage = convert<string>(
+ static_cast<int>(100 * convert<double>(value)));
return true;
}
}
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 << "}";
}