static docstring const lyx_def = from_ascii(
"\\providecommand{\\LyX}{L\\kern-.1667em\\lower.25em\\hbox{Y}\\kern-.125emX\\@}");
+static docstring const lyx_rtl_def = from_ascii(
+ "\\let\\@@LyX\\LyX\n"
+ "\\def\\LyX{\\@ensure@LTR{\\@@LyX}}");
+
static docstring const lyx_hyperref_def = from_ascii(
"\\providecommand{\\LyX}{\\texorpdfstring%\n"
" {L\\kern-.1667em\\lower.25em\\hbox{Y}\\kern-.125emX\\@}\n"
}
}
+
+bool LaTeXFeatures::hasRTLLanguage() const
+{
+ if (params_.language->rightToLeft())
+ return true;
+ for (auto const & lang : UsedLanguages_)
+ if (lang->rightToLeft())
+ return true;
+ return false;
+}
+
namespace {
char const * simplefeatures[] = {
macros << lyx_hyperref_def << '\n';
else
macros << lyx_def << '\n';
+ if (runparams_.use_polyglossia && hasRTLLanguage())
+ macros << lyx_rtl_def << '\n';
}
if (mustProvide("noun"))
///
void useLayout(docstring const &, int);
///
+ bool hasRTLLanguage() const;
+ ///
std::list<docstring> usedLayouts_;
///
std::list<docstring> usedInsetLayouts_;
#include "Dimension.h"
#include "Font.h"
+#include "Language.h"
#include "LaTeXFeatures.h"
#include "Lexer.h"
#include "MetricsInfo.h"
void InsetSpecialChar::latex(otexstream & os,
OutputParams const & rp) const
{
+ bool const rtl = rp.local_font->isRightToLeft();
+ 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")
+ lswitch = "\\textLR{";
+ }
+
switch (kind_) {
case HYPHENATION:
os << "\\-";
os << "\\ldots" << termcmd;
break;
case MENU_SEPARATOR:
- if (rp.local_font->isRightToLeft())
+ if (rtl)
os << "\\lyxarrow*";
else
os << "\\lyxarrow";
case PHRASE_LYX:
if (rp.moving_arg)
os << "\\protect";
- os << "\\LyX" << termcmd;
+ os << lswitch << "\\LyX" << termcmd << lswitche;
break;
case PHRASE_TEX:
if (rp.moving_arg)
os << "\\protect";
- os << "\\TeX" << termcmd;
+ os << lswitch << "\\TeX" << termcmd << lswitche;
break;
case PHRASE_LATEX2E:
if (rp.moving_arg)
os << "\\protect";
- os << "\\LaTeXe" << termcmd;
+ os << lswitch << "\\LaTeXe" << termcmd << lswitche;
break;
case PHRASE_LATEX:
if (rp.moving_arg)
os << "\\protect";
- os << "\\LaTeX" << termcmd;
+ os << lswitch << "\\LaTeX" << termcmd << lswitche;
break;
}
}
- Support rotated table cells with linebreaks (bug 8085).
+- Add support for LyX logo in RTL output (bug 10423).
+
* MISCELLANEOUS