// XeTeX and LuaTeX (with OS fonts) do not need fontenc
if (!useNonTeXFonts && !features.isProvided("fontenc")
&& font_encoding() != "default") {
- vector<string> fontencs;
- // primary language font encoding and default encoding
- if (ascii_lowercase(language->fontenc()) != "none") {
- vector<string> fencs = getVectorFromString(font_encoding());
- fontencs.insert(fontencs.end(), fencs.begin(), fencs.end());
- fencs = getVectorFromString(language->fontenc());
- vector<string>::const_iterator fit = fencs.begin();
- for (; fit != fencs.end(); ++fit) {
- if (find(fontencs.begin(), fontencs.end(), *fit) == fontencs.end())
- fontencs.push_back(*fit);
- }
- }
+ // get main font encodings
+ vector<string> fontencs = font_encodings();
// get font encodings of secondary languages
features.getFontEncodings(fontencs);
if (!fontencs.empty()) {
string const BufferParams::font_encoding() const
{
- return (fontenc == "global") ? lyxrc.fontenc : fontenc;
+ return font_encodings().empty() ? "default" : font_encodings().back();
+}
+
+
+vector<string> const BufferParams::font_encodings() const
+{
+ string doc_fontenc = (fontenc == "global") ? lyxrc.fontenc : fontenc;
+
+ vector<string> fontencs;
+
+ // "default" means "no explicit font encoding"
+ if (doc_fontenc != "default") {
+ fontencs = getVectorFromString(doc_fontenc);
+ if (!language->fontenc().empty()
+ && ascii_lowercase(language->fontenc()) != "none") {
+ vector<string> fencs = getVectorFromString(language->fontenc());
+ vector<string>::const_iterator fit = fencs.begin();
+ for (; fit != fencs.end(); ++fit) {
+ if (find(fontencs.begin(), fontencs.end(), *fit) == fontencs.end())
+ fontencs.push_back(*fit);
+ }
+ }
+ }
+
+ return fontencs;
}
std::string bibtex_command;
/// customized index processor
std::string index_command;
- /// font encoding
+ /// font encoding(s) requested for this document
std::string fontenc;
/// the rm font
std::string fonts_roman;
/// map of the file's author IDs to AuthorList indexes
typedef std::map<int, int> AuthorMap;
AuthorMap author_map;
- /// the buffer's font encoding
+ /// the buffer's active font encoding
std::string const font_encoding() const;
+ /// all font encodings requested by the prefs/document/main language.
+ /// This does NOT include font encodings required by secondary languages
+ std::vector<std::string> const font_encodings() const;
+
///
std::string const dvips_options() const;
/** The return value of paperSizeName() depends on the
return;
// If T1 font encoding is used, use the special
// characters it provides.
- // NOTE: some languages reset the font encoding
- // internally
+ // NOTE: Some languages reset the font encoding internally.
+ // If we are using such a language, we do not output
+ // special T1 chars.
if (!runparams.inIPA && !running_font.language()->internalFontEncoding()
- && lyxrc.fontenc == "T1" && latexSpecialT1(c, os, i, column))
+ && bparams.font_encoding() == "T1" && latexSpecialT1(c, os, i, column))
return;
// Otherwise, we use what LaTeX provides us.