[LyX/master] Improve readability of code and comments
Juergen Spitzmueller
spitz at lyx.org
Fri Aug 18 06:47:26 UTC 2023
commit 15f9129a26e0e3159c96118aff4b42e11cd94cf3
Author: Juergen Spitzmueller <spitz at lyx.org>
Date: Fri Aug 18 10:02:48 2023 +0200
Improve readability of code and comments
---
src/Paragraph.cpp | 31 ++++++++++++++++++-------------
1 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index 0ff0e15..d69d09a 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -2052,15 +2052,16 @@ char_type Paragraph::getUChar(BufferParams const & bparams,
{
char_type c = d->text_[pos];
- // Return unchanged character in LTR languages
- // or if we use XeTeX
- // or with babel and LuaTeX.
+ // Return unchanged character
+ // 1. in all LTR languages
+ // 2. if we use XeTeX (both with babel and polyglossia)
+ // 3. if we use LuaTeX with babel
if (!getFontSettings(bparams, pos).isRightToLeft()
|| rp.flavor == Flavor::XeTeX
|| (rp.use_babel && rp.flavor == Flavor::LuaTeX))
return c;
- // Without polyglossia/bidi, we need to account for some special cases.
+ // For the remaining cases, we need to account for some special cases.
// FIXME This needs to be audited!
// Check if:
// * The input is as expected for all delimiters
@@ -2079,15 +2080,19 @@ char_type Paragraph::getUChar(BufferParams const & bparams,
string const & lang = getFontSettings(bparams, pos).language()->lang();
char_type uc = c;
- // 1. With polyglossia/luabidi all delimiters need to be mirrored,
- // regardless of the languge, or script.
- // 2. In the following languages, parentheses need to be mirrored.
- bool const reverseparens = (lang == "hebrew" || rp.use_polyglossia);
-
- // 3. In the following languages, brackets don't need to be mirrored.
- bool const reversebrackets = (lang != "arabic_arabtex"
- && lang != "arabic_arabi"
- && lang != "farsi") || rp.use_polyglossia;
+ // These are the cases where we need to mirror delimiters in RTL context
+ // in the remaining cases (polyglossia + LuaTeX or classic [pdf]latex):
+ // 1. With polyglossia and LuaTeX (luabidi) parentheses and brackets
+ // need to be mirrored in RTL, regardless of the language, or script.
+ // 2. In the languages that follow, parentheses need to be mirrored
+ // in classic (pdf)latex
+ bool const reverseparens = (rp.use_polyglossia || lang == "hebrew");
+ // 3. In all RTL languages except for those that follow, brackets
+ // need to be mirrored in classic (pdf)latex
+ bool const reversebrackets = rp.use_polyglossia
+ || (lang != "arabic_arabtex"
+ && lang != "arabic_arabi"
+ && lang != "farsi");
// Now swap delimiters if needed.
switch (c) {
More information about the lyx-cvs
mailing list