X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FBufferParams.cpp;h=c48e1cfcca971fdcbcd4147a39666035f58b9584;hb=36a679344a2aceb07ea881b60610afee87175b31;hp=906061aa63e8fe4edcf560ac3239e3171989a06d;hpb=e37e4f537c70d75835441d84bc327c56805ecc3e;p=lyx.git diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 906061aa63..c48e1cfcca 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -71,8 +71,9 @@ static char const * const string_paragraph_separation[] = { }; -static char const * const string_quotes_language[] = { - "english", "swedish", "german", "polish", "french", "danish", "" +static char const * const string_quotes_style[] = { + "english", "swedish", "german", "polish", "swiss", "danish", "plain", + "british", "swedishg", "french", "frenchin", "russian", "" }; @@ -127,27 +128,33 @@ ParSepTranslator const & parseptranslator() } -// Quotes language -typedef Translator QuotesLangTranslator; +// Quotes style +typedef Translator QuotesStyleTranslator; -QuotesLangTranslator const init_quoteslangtranslator() +QuotesStyleTranslator const init_quotesstyletranslator() { - QuotesLangTranslator translator - (string_quotes_language[0], InsetQuotes::EnglishQuotes); - translator.addPair(string_quotes_language[1], InsetQuotes::SwedishQuotes); - translator.addPair(string_quotes_language[2], InsetQuotes::GermanQuotes); - translator.addPair(string_quotes_language[3], InsetQuotes::PolishQuotes); - translator.addPair(string_quotes_language[4], InsetQuotes::FrenchQuotes); - translator.addPair(string_quotes_language[5], InsetQuotes::DanishQuotes); + QuotesStyleTranslator translator + (string_quotes_style[0], InsetQuotesParams::EnglishQuotes); + translator.addPair(string_quotes_style[1], InsetQuotesParams::SwedishQuotes); + translator.addPair(string_quotes_style[2], InsetQuotesParams::GermanQuotes); + translator.addPair(string_quotes_style[3], InsetQuotesParams::PolishQuotes); + translator.addPair(string_quotes_style[4], InsetQuotesParams::SwissQuotes); + translator.addPair(string_quotes_style[5], InsetQuotesParams::DanishQuotes); + translator.addPair(string_quotes_style[6], InsetQuotesParams::PlainQuotes); + translator.addPair(string_quotes_style[7], InsetQuotesParams::BritishQuotes); + translator.addPair(string_quotes_style[8], InsetQuotesParams::SwedishGQuotes); + translator.addPair(string_quotes_style[9], InsetQuotesParams::FrenchQuotes); + translator.addPair(string_quotes_style[10], InsetQuotesParams::FrenchINQuotes); + translator.addPair(string_quotes_style[11], InsetQuotesParams::RussianQuotes); return translator; } -QuotesLangTranslator const & quoteslangtranslator() +QuotesStyleTranslator const & quotesstyletranslator() { - static QuotesLangTranslator const translator = - init_quoteslangtranslator(); + static QuotesStyleTranslator const translator = + init_quotesstyletranslator(); return translator; } @@ -394,7 +401,8 @@ BufferParams::BufferParams() cite_engine_type_ = ENGINE_TYPE_DEFAULT; makeDocumentClass(); paragraph_separation = ParagraphIndentSeparation; - quotes_language = InsetQuotes::EnglishQuotes; + quotes_style = InsetQuotesParams::EnglishQuotes; + dynamic_quotes = false; fontsize = "default"; /* PaperLayout */ @@ -828,10 +836,12 @@ string BufferParams::readToken(Lexer & lex, string const & token, if (pimpl_->defskip.kind() == VSpace::DEFSKIP) // that is invalid pimpl_->defskip = VSpace(VSpace::MEDSKIP); - } else if (token == "\\quotes_language") { - string quotes_lang; - lex >> quotes_lang; - quotes_language = quoteslangtranslator().find(quotes_lang); + } else if (token == "\\quotes_style") { + string qstyle; + lex >> qstyle; + quotes_style = quotesstyletranslator().find(qstyle); + } else if (token == "\\dynamic_quotes") { + lex >> dynamic_quotes; } else if (token == "\\papersize") { string ppsize; lex >> ppsize; @@ -1299,8 +1309,9 @@ void BufferParams::writeFile(ostream & os, Buffer const * buf) const os << "\n\\paragraph_indentation " << getIndentation().asLyXCommand(); else os << "\n\\defskip " << getDefSkip().asLyXCommand(); - os << "\n\\quotes_language " - << string_quotes_language[quotes_language] + os << "\n\\quotes_style " + << string_quotes_style[quotes_style] + << "\n\\dynamic_quotes " << dynamic_quotes << "\n\\papercolumns " << columns << "\n\\papersides " << sides << "\n\\paperpagestyle " << pagestyle << '\n'; @@ -1452,7 +1463,7 @@ void BufferParams::validate(LaTeXFeatures & features) const // some languages are only available via polyglossia if (features.hasPolyglossiaExclusiveLanguages()) - features.require("polyglossia"); + features.require("polyglossia"); if (useNonTeXFonts && fontsMath() != "auto") features.require("unicode-math"); @@ -1647,7 +1658,7 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features, << from_ascii(fonts_default_family) << "}\n"; // set font encoding - // XeTeX and LuaTeX with Unicode fonts do not need fontenc + // XeTeX and LuaTeX (with OS fonts) do not need fontenc if (!useNonTeXFonts && !features.isProvided("fontenc") && font_encoding() != "default") { // get main font encodings @@ -2182,14 +2193,17 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features, os << "[" << from_ascii(language->polyglossiaOpts()) << "]"; os << "{" << from_ascii(language->polyglossia()) << "}\n"; // now setup the other languages - std::map const polylangs = + set const polylangs = features.getPolyglossiaLanguages(); - for (std::map::const_iterator mit = polylangs.begin(); + for (set::const_iterator mit = polylangs.begin(); mit != polylangs.end() ; ++mit) { + // We do not output the options here; they are output in + // the language switch commands. This is safer if multiple + // varieties are used. + if (*mit == language->polyglossia()) + continue; os << "\\setotherlanguage"; - if (!mit->second.empty()) - os << "[" << from_ascii(mit->second) << "]"; - os << "{" << from_ascii(mit->first) << "}\n"; + os << "{" << from_ascii(*mit) << "}\n"; } } @@ -2544,9 +2558,9 @@ Font const BufferParams::getFont() const } -InsetQuotes::QuoteLanguage BufferParams::getQuoteStyle(string const & qs) const +InsetQuotesParams::QuoteStyle BufferParams::getQuoteStyle(string const & qs) const { - return quoteslangtranslator().find(qs); + return quotesstyletranslator().find(qs); } @@ -2942,7 +2956,7 @@ vector const BufferParams::font_encodings() const vector fontencs; - // "default" means "no explicit font encoding, don't load fontenc.sty" + // "default" means "no explicit font encoding" if (doc_fontenc != "default") { fontencs = getVectorFromString(doc_fontenc); if (!language->fontenc().empty()