return docstring();
}
+
+Language const * Inset::getLocalOrDefaultLang(const OutputParams & rp) const
+{
+ return (rp.local_font != nullptr)
+ ? rp.local_font->language()
+ : buffer().params().language;
+}
+
} // namespace lyx
class InsetMath;
class InsetTabular;
class InsetText;
+class Language;
class LaTeXFeatures;
class Lexer;
class MathAtom;
/// Determine the action of backspace and delete: do we select instead of
/// deleting if not already selected?
virtual bool confirmDeletion() const { return false; }
+ /// Return the local_font's language or the buffer's default language
+ /// if local_font is null
+ Language const * getLocalOrDefaultLang(const OutputParams &) const;
protected:
/// Constructors
string maybeBeginL;
string maybeEndL;
bool needEndL = false;
- if (!runparams.isFullUnicode() && runparams.local_font->isRightToLeft()) {
+ if (!runparams.isFullUnicode()
+ && runparams.local_font && runparams.local_font->isRightToLeft()) {
maybeBeginL = "\\beginL";
maybeEndL = "\\endL";
}
if (type == "table") {
toctype = "table";
toclabel = translateIfPossible(from_ascii("List of Tables"),
- op.local_font->language()->lang());
+ getLocalOrDefaultLang(op)->lang());
} else if (type == "figure") {
toctype = "figure";
toclabel = translateIfPossible(from_ascii("List of Figures"),
- op.local_font->language()->lang());
+ getLocalOrDefaultLang(op)->lang());
} else {
LYXERR0("Unknown Builtin Float!");
return docstring();
} else {
toctype = to_utf8(getParam("type"));
toclabel = translateIfPossible(from_utf8(cit->second.listName()),
- op.local_font->language()->lang());
+ getLocalOrDefaultLang(op)->lang());
}
shared_ptr<Toc const> toc = buffer().tocBackend().toc(toctype);
xs << xml::StartTag("div", tocattr);
xs << xml::CR();
xs << xml::StartTag(lay.htmltag(), lay.htmlGetAttrString());
- xs << translateIfPossible(indexName, op.local_font->language()->lang());
+ xs << translateIfPossible(indexName, getLocalOrDefaultLang(op)->lang());
xs << xml::EndTag(lay.htmltag());
xs << xml::CR();
xs << xml::StartTag("ul", "class='main'");
if (!basicstyle.empty())
param_string = rtrim(param_string, ",") + ",basicstyle={" + basicstyle + "}";
}
- if (runparams.use_polyglossia && runparams.local_font->isRightToLeft()) {
+ if (runparams.use_polyglossia && runparams.local_font
+ && runparams.local_font->isRightToLeft()) {
// We need to use the *latin switches (#11554)
smatch sub;
if (regex_match(param_string, sub, reg1))
Encoding const * const save_enc = runparams.encoding;
Encoding const * const outer_encoding =
- (runparams.local_font != 0) ?
- runparams.local_font->language()->encoding()
- : buffer().params().language->encoding();
+ getLocalOrDefaultLang(runparams)->encoding();
Encoding const * fixedlstenc = forcedEncoding(runparams.encoding, outer_encoding);
if (fixedlstenc) {
// We need to switch to a singlebyte encoding, due to
InsetLayout const & il = getLayout();
string const & tag = il.htmltag();
docstring toclabel = translateIfPossible(from_ascii("Nomenclature"),
- op.local_font->language()->lang());
+ getLocalOrDefaultLang(op)->lang());
xs << xml::StartTag("div", "class='nomencl'")
<< xml::StartTag(tag, "class='nomencl'")
// TODO: At least, that's what was done before...
docstring toclabel = translateIfPossible(from_ascii("Nomenclature"),
- runparams.local_font->language()->lang());
+ getLocalOrDefaultLang(runparams)->lang());
xs << xml::StartTag("glossary");
xs << xml::CR();
|| style == QuoteStyle::French
|| style == QuoteStyle::FrenchIN)
&& level_ == QuoteLevel::Primary
- && prefixIs(runparams.local_font->language()->code(), "fr")) {
+ && prefixIs(getLocalOrDefaultLang(runparams)->code(), "fr")) {
// Specific guillemets of French babel
// including correct French spacing
if (side_ == QuoteSide::Opening)
// (ligatures not featured in PDF strings)
qstr = quoteparams.getLaTeXQuote(quotechar, "int", rtl_);
} else if (runparams.main_fontenc == "T1"
- && !runparams.local_font->language()->internalFontEncoding()) {
+ && !getLocalOrDefaultLang(runparams)->internalFontEncoding()) {
// Quotation marks for T1 font encoding
// (using ligatures)
qstr = quoteparams.getLaTeXQuote(quotechar, "t1");
- } else if (runparams.local_font->language()->internalFontEncoding()) {
+ } else if (getLocalOrDefaultLang(runparams)->internalFontEncoding()) {
// Quotation marks for internal font encodings
// (ligatures not featured)
qstr = quoteparams.getLaTeXQuote(quotechar, "int", rtl_);
// some sort of counter with the label, and we don't have that yet.
docstring const attr = "href=\"#" + xml::cleanAttr(ref) + '"';
xs << xml::StartTag("a", to_utf8(attr));
- xs << displayString(ref, cmd, op.local_font->language()->lang());;
+ xs << displayString(ref, cmd, getLocalOrDefaultLang(op)->lang());
xs << xml::EndTag("a");
return docstring();
}
case InsetSpaceParams::PROTECTED:
if (runparams.find_effective())
os.put(0xa0);
- else if (runparams.local_font
- && runparams.local_font->language()->lang() == "polutonikogreek")
+ else if (getLocalOrDefaultLang(runparams)->lang() == "polutonikogreek")
// in babel's polutonikogreek, ~ is active
os << (runparams.free_spacing ? " " : "\\nobreakspace{}");
else
void InsetSpecialChar::latex(otexstream & os,
OutputParams const & rp) const
{
- bool const rtl = rp.local_font->isRightToLeft();
+ bool const rtl = rp.local_font && rp.local_font->isRightToLeft();
bool const utf8 = rp.encoding->iconvName() == "UTF-8";
string lswitch = "";
string lswitche = "";
if (rtl && !rp.use_polyglossia) {
lswitch = "\\L{";
lswitche = "}";
- if (rp.local_font->language()->lang() == "arabic_arabi"
- || rp.local_font->language()->lang() == "farsi")
+ if (getLocalOrDefaultLang(rp)->lang() == "arabic_arabi"
+ || getLocalOrDefaultLang(rp)->lang() == "farsi")
lswitch = "\\textLR{";
}
// The bidi package (loaded by polyglossia with XeTeX) reverses RTL table columns
// Luabibdi (used by LuaTeX) behaves like classic
bool const bidi_rtl =
- runparams.local_font->isRightToLeft()
+ runparams.local_font
+ && runparams.local_font->isRightToLeft()
&& buffer().params().useBidiPackage(runparams);
bool const ct = !buffer().params().output_changes;
idx_type lastcell =
// The bidi package (loaded by polyglossia with XeTeX) swaps the column
// order for RTL (#9686). Thus we use this list.
bool const bidi_rtl =
- runparams.local_font->isRightToLeft()
+ runparams.local_font
+ && runparams.local_font->isRightToLeft()
&& buffer().params().useBidiPackage(runparams);
list<col_type> columns;
list<col_type> logical_columns;