mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 19:07:45 +00:00
Fix direction of brackets in Hebrew when using Polyglossia (bug #8251)
This commit is contained in:
parent
7d08836de6
commit
2d9c9ae77d
@ -331,6 +331,7 @@ public:
|
|||||||
///
|
///
|
||||||
void latexSpecialChar(
|
void latexSpecialChar(
|
||||||
otexstream & os,
|
otexstream & os,
|
||||||
|
BufferParams const & bparams,
|
||||||
OutputParams const & runparams,
|
OutputParams const & runparams,
|
||||||
Font const & running_font,
|
Font const & running_font,
|
||||||
Change const & running_change,
|
Change const & running_change,
|
||||||
@ -1148,6 +1149,7 @@ void Paragraph::Private::latexInset(BufferParams const & bparams,
|
|||||||
|
|
||||||
|
|
||||||
void Paragraph::Private::latexSpecialChar(otexstream & os,
|
void Paragraph::Private::latexSpecialChar(otexstream & os,
|
||||||
|
BufferParams const & bparams,
|
||||||
OutputParams const & runparams,
|
OutputParams const & runparams,
|
||||||
Font const & running_font,
|
Font const & running_font,
|
||||||
Change const & running_change,
|
Change const & running_change,
|
||||||
@ -1156,7 +1158,10 @@ void Paragraph::Private::latexSpecialChar(otexstream & os,
|
|||||||
pos_type end_pos,
|
pos_type end_pos,
|
||||||
unsigned int & column)
|
unsigned int & column)
|
||||||
{
|
{
|
||||||
char_type const c = text_[i];
|
// With polyglossia, brackets and stuff need not be reversed
|
||||||
|
// in RTL scripts (see bug #8251)
|
||||||
|
char_type const c = (runparams.use_polyglossia) ?
|
||||||
|
owner_->getUChar(bparams, i) : text_[i];
|
||||||
|
|
||||||
if (style.pass_thru || runparams.pass_thru) {
|
if (style.pass_thru || runparams.pass_thru) {
|
||||||
if (c != '\0') {
|
if (c != '\0') {
|
||||||
@ -1835,16 +1840,23 @@ FontSize Paragraph::highestFontInRange
|
|||||||
char_type Paragraph::getUChar(BufferParams const & bparams, pos_type pos) const
|
char_type Paragraph::getUChar(BufferParams const & bparams, pos_type pos) const
|
||||||
{
|
{
|
||||||
char_type c = d->text_[pos];
|
char_type c = d->text_[pos];
|
||||||
if (!lyxrc.rtl_support)
|
if (!lyxrc.rtl_support || !getFontSettings(bparams, pos).isRightToLeft())
|
||||||
return c;
|
return c;
|
||||||
|
|
||||||
|
// FIXME: The arabic special casing is due to the difference of arabic
|
||||||
|
// round brackets input introduced in r18599. Check if this should be
|
||||||
|
// unified with Hebrew or at least if all bracket types should be
|
||||||
|
// handled the same (file format change in either case).
|
||||||
|
string const & lang = getFontSettings(bparams, pos).language()->lang();
|
||||||
|
bool const arabic = lang == "arabic_arabtex" || lang == "arabic_arabi" ||
|
||||||
|
lang == "farsi";
|
||||||
char_type uc = c;
|
char_type uc = c;
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case '(':
|
case '(':
|
||||||
uc = ')';
|
uc = arabic ? c : ')';
|
||||||
break;
|
break;
|
||||||
case ')':
|
case ')':
|
||||||
uc = '(';
|
uc = arabic ? c : '(';
|
||||||
break;
|
break;
|
||||||
case '[':
|
case '[':
|
||||||
uc = ']';
|
uc = ']';
|
||||||
@ -1865,9 +1877,8 @@ char_type Paragraph::getUChar(BufferParams const & bparams, pos_type pos) const
|
|||||||
uc = '<';
|
uc = '<';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (uc != c && getFontSettings(bparams, pos).isRightToLeft())
|
|
||||||
return uc;
|
return uc;
|
||||||
return c;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2505,7 +2516,7 @@ void Paragraph::latex(BufferParams const & bparams,
|
|||||||
} else {
|
} else {
|
||||||
if (i >= start_pos && (end_pos == -1 || i < end_pos)) {
|
if (i >= start_pos && (end_pos == -1 || i < end_pos)) {
|
||||||
try {
|
try {
|
||||||
d->latexSpecialChar(os, rp, running_font, runningChange,
|
d->latexSpecialChar(os, bparams, rp, running_font, runningChange,
|
||||||
style, i, end_pos, column);
|
style, i, end_pos, column);
|
||||||
} catch (EncodingException & e) {
|
} catch (EncodingException & e) {
|
||||||
if (runparams.dryrun) {
|
if (runparams.dryrun) {
|
||||||
|
@ -237,6 +237,8 @@ void RowPainter::paintChars(pos_type & vpos, FontInfo const & font,
|
|||||||
str.reserve(100);
|
str.reserve(100);
|
||||||
str.push_back(prev_char);
|
str.push_back(prev_char);
|
||||||
|
|
||||||
|
// FIXME: Why only round brackets and why the difference to
|
||||||
|
// Hebrew? See also Paragraph::getUChar
|
||||||
if (arabic) {
|
if (arabic) {
|
||||||
char_type c = str[0];
|
char_type c = str[0];
|
||||||
if (c == '(')
|
if (c == '(')
|
||||||
@ -326,6 +328,8 @@ void RowPainter::paintChars(pos_type & vpos, FontInfo const & font,
|
|||||||
break;
|
break;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// FIXME: Why only round brackets and why the difference to
|
||||||
|
// Hebrew? See also Paragraph::getUChar
|
||||||
if (arabic) {
|
if (arabic) {
|
||||||
if (c == '(')
|
if (c == '(')
|
||||||
c = ')';
|
c = ')';
|
||||||
|
@ -96,6 +96,9 @@ What's new
|
|||||||
- Fix LaTeX errors with right-to-left text when using XeTeX/Polyglossia
|
- Fix LaTeX errors with right-to-left text when using XeTeX/Polyglossia
|
||||||
(part of bug 8251).
|
(part of bug 8251).
|
||||||
|
|
||||||
|
- Fix brackets direction in Hebrew documents when using XeTeX/Polyglossia
|
||||||
|
and in Arabic documents on plain text output (part of bug 8251).
|
||||||
|
|
||||||
- Fix babel call with Arabic (arabi).
|
- Fix babel call with Arabic (arabi).
|
||||||
|
|
||||||
- Fix suppression of language package.
|
- Fix suppression of language package.
|
||||||
|
Loading…
Reference in New Issue
Block a user