mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-26 22:17:41 +00:00
Properly determine active font encoding
This commit is contained in:
parent
b309fa5d2b
commit
5fec78f69f
@ -1499,18 +1499,8 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
|
||||
// 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()) {
|
||||
@ -2762,7 +2752,31 @@ string const BufferParams::dvips_options() const
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -244,7 +244,7 @@ public:
|
||||
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;
|
||||
@ -383,8 +383,12 @@ public:
|
||||
/// 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
|
||||
|
@ -1154,10 +1154,11 @@ void Paragraph::Private::latexSpecialChar(otexstream & os,
|
||||
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.
|
||||
|
Loading…
Reference in New Issue
Block a user