rename BufferParams::font_encoding() to ::main_font_encoding()

Because that's what's actually returned.
This commit is contained in:
Juergen Spitzmueller 2017-02-25 12:49:49 +01:00
parent 83cf59cf94
commit 73ccee113e
5 changed files with 14 additions and 13 deletions

View File

@ -1646,7 +1646,7 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
// if we use fontspec or newtxmath, we have to load the AMS packages here // if we use fontspec or newtxmath, we have to load the AMS packages here
string const ams = features.loadAMSPackages(); string const ams = features.loadAMSPackages();
bool const ot1 = (font_encoding() == "default" || font_encoding() == "OT1"); bool const ot1 = (main_font_encoding() == "default" || main_font_encoding() == "OT1");
bool const use_newtxmath = bool const use_newtxmath =
theLaTeXFonts().getLaTeXFont(from_ascii(fontsMath())).getUsedPackage( theLaTeXFonts().getLaTeXFont(from_ascii(fontsMath())).getUsedPackage(
ot1, false, false) == "newtxmath"; ot1, false, false) == "newtxmath";
@ -1673,7 +1673,7 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
// set font encoding // set font encoding
// XeTeX and LuaTeX (with OS fonts) do not need fontenc // XeTeX and LuaTeX (with OS fonts) do not need fontenc
if (!useNonTeXFonts && !features.isProvided("fontenc") if (!useNonTeXFonts && !features.isProvided("fontenc")
&& font_encoding() != "default") { && main_font_encoding() != "default") {
// get main font encodings // get main font encodings
vector<string> fontencs = font_encodings(); vector<string> fontencs = font_encodings();
// get font encodings of secondary languages // get font encodings of secondary languages
@ -2992,7 +2992,7 @@ string const BufferParams::dvips_options() const
} }
string const BufferParams::font_encoding() const string const BufferParams::main_font_encoding() const
{ {
return font_encodings().empty() ? "default" : font_encodings().back(); return font_encodings().empty() ? "default" : font_encodings().back();
} }
@ -3228,7 +3228,7 @@ string const BufferParams::loadFonts(LaTeXFeatures & features) const
} }
// Tex Fonts // Tex Fonts
bool const ot1 = (font_encoding() == "default" || font_encoding() == "OT1"); bool const ot1 = (main_font_encoding() == "default" || main_font_encoding() == "OT1");
bool const dryrun = features.runparams().dryrun; bool const dryrun = features.runparams().dryrun;
bool const complete = (fontsSans() == "default" && fontsTypewriter() == "default"); bool const complete = (fontsSans() == "default" && fontsTypewriter() == "default");
bool const nomath = (fontsMath() == "default"); bool const nomath = (fontsMath() == "default");

View File

@ -411,7 +411,7 @@ public:
AuthorMap author_map_; AuthorMap author_map_;
/// the buffer's active font encoding /// the buffer's active font encoding
std::string const font_encoding() const; std::string const main_font_encoding() const;
/// all font encodings requested by the prefs/document/main language. /// all font encodings requested by the prefs/document/main language.
/// This does NOT include font encodings required by secondary languages /// This does NOT include font encodings required by secondary languages
std::vector<std::string> const font_encodings() const; std::vector<std::string> const font_encodings() const;

View File

@ -591,8 +591,8 @@ bool LaTeXFeatures::isProvided(string const & name) const
if (params_.useNonTeXFonts) if (params_.useNonTeXFonts)
return params_.documentClass().provides(name); return params_.documentClass().provides(name);
bool const ot1 = (params_.font_encoding() == "default" bool const ot1 = (params_.main_font_encoding() == "default"
|| params_.font_encoding() == "OT1"); || params_.main_font_encoding() == "OT1");
bool const complete = (params_.fontsSans() == "default" bool const complete = (params_.fontsSans() == "default"
&& params_.fontsTypewriter() == "default"); && params_.fontsTypewriter() == "default");
bool const nomath = (params_.fontsMath() == "default"); bool const nomath = (params_.fontsMath() == "default");
@ -1089,7 +1089,8 @@ string const LaTeXFeatures::getPackages() const
// if fontspec or newtxmath is used, AMS packages have to be loaded // if fontspec or newtxmath is used, AMS packages have to be loaded
// before fontspec (in BufferParams) // before fontspec (in BufferParams)
string const amsPackages = loadAMSPackages(); string const amsPackages = loadAMSPackages();
bool const ot1 = (params_.font_encoding() == "default" || params_.font_encoding() == "OT1"); bool const ot1 = (params_.main_font_encoding() == "default"
|| params_.main_font_encoding() == "OT1");
bool const use_newtxmath = bool const use_newtxmath =
theLaTeXFonts().getLaTeXFont(from_ascii(params_.fontsMath())).getUsedPackage( theLaTeXFonts().getLaTeXFont(from_ascii(params_.fontsMath())).getUsedPackage(
ot1, false, false) == "newtxmath"; ot1, false, false) == "newtxmath";
@ -1318,14 +1319,14 @@ TexString LaTeXFeatures::getMacros() const
if (!usePolyglossia() && mustProvide("textgreek")) { if (!usePolyglossia() && mustProvide("textgreek")) {
// ensure LGR font encoding is defined also if fontenc is not loaded by LyX // ensure LGR font encoding is defined also if fontenc is not loaded by LyX
if (params_.font_encoding() == "default") if (params_.main_font_encoding() == "default")
macros << textgreek_LGR_def; macros << textgreek_LGR_def;
macros << textgreek_def << '\n'; macros << textgreek_def << '\n';
} }
if (!usePolyglossia() && mustProvide("textcyr")) { if (!usePolyglossia() && mustProvide("textcyr")) {
// ensure T2A font encoding is set up also if fontenc is not loaded by LyX // ensure T2A font encoding is set up also if fontenc is not loaded by LyX
if (params_.font_encoding() == "default") if (params_.main_font_encoding() == "default")
macros << textcyr_T2A_def; macros << textcyr_T2A_def;
macros << textcyr_def << '\n'; macros << textcyr_def << '\n';
} }

View File

@ -1194,7 +1194,7 @@ void Paragraph::Private::latexSpecialChar(otexstream & os,
// non-standard font encoding. If we are using such a language, // non-standard font encoding. If we are using such a language,
// we do not output special T1 chars. // we do not output special T1 chars.
if (!runparams.inIPA && !running_font.language()->internalFontEncoding() if (!runparams.inIPA && !running_font.language()->internalFontEncoding()
&& !runparams.isFullUnicode() && bparams.font_encoding() == "T1" && !runparams.isFullUnicode() && bparams.main_font_encoding() == "T1"
&& latexSpecialT1(c, os, i, column)) && latexSpecialT1(c, os, i, column))
return; return;
// NOTE: XeTeX and LuaTeX use EU1/2 (pre 2017) or TU (as of 2017) encoding // NOTE: XeTeX and LuaTeX use EU1/2 (pre 2017) or TU (as of 2017) encoding

View File

@ -628,7 +628,7 @@ InsetQuotes::InsetQuotes(Buffer * buf, char_type c, InsetQuotesParams::QuoteLeve
bool dynamic = false; bool dynamic = false;
if (buf) { if (buf) {
global_style_ = buf->masterBuffer()->params().quotes_style; global_style_ = buf->masterBuffer()->params().quotes_style;
fontenc_ = buf->masterBuffer()->params().font_encoding(); fontenc_ = buf->masterBuffer()->params().main_font_encoding();
dynamic = buf->masterBuffer()->params().dynamic_quotes; dynamic = buf->masterBuffer()->params().dynamic_quotes;
fontspec_ = buf->masterBuffer()->params().useNonTeXFonts; fontspec_ = buf->masterBuffer()->params().useNonTeXFonts;
} else { } else {
@ -979,7 +979,7 @@ void InsetQuotes::updateBuffer(ParIterator const & it, UpdateType /* utype*/)
BufferParams const & bp = buffer().masterBuffer()->params(); BufferParams const & bp = buffer().masterBuffer()->params();
pass_thru_ = it.paragraph().isPassThru(); pass_thru_ = it.paragraph().isPassThru();
context_lang_ = it.paragraph().getFontSettings(bp, it.pos()).language()->code(); context_lang_ = it.paragraph().getFontSettings(bp, it.pos()).language()->code();
fontenc_ = bp.font_encoding(); fontenc_ = bp.main_font_encoding();
global_style_ = bp.quotes_style; global_style_ = bp.quotes_style;
fontspec_ = bp.useNonTeXFonts; fontspec_ = bp.useNonTeXFonts;
} }