summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorKhaled Hosny <khaled@libreoffice.org>2023-09-28 10:41:41 +0300
committerخالد حسني <khaled@libreoffice.org>2023-09-28 14:34:28 +0200
commitff28544c5310870cd98402d89ba53cfa7b7f598d (patch)
tree8038c3b82e3fca13f2206be5cbb60a6e9b3d5613 /starmath
parentc7f20a1dad66a7d3241c103546cd268152bc778f (diff)
starmath: Arabic text should always be upright
Change-Id: Ibe9f3092432ae4ffd81903df8672daf90947000c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157349 Tested-by: Jenkins Reviewed-by: خالد حسني <khaled@libreoffice.org>
Diffstat (limited to 'starmath')
-rw-r--r--starmath/source/node.cxx18
1 files changed, 17 insertions, 1 deletions
diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx
index 695e1b4e3a8c..1a89b52c4110 100644
--- a/starmath/source/node.cxx
+++ b/starmath/source/node.cxx
@@ -1868,8 +1868,24 @@ void SmTextNode::Prepare(const SmFormat &rFormat, const SmDocShell &rDocShell, i
// special handling for ':' where it is a token on its own and is likely
// to be used for mathematical notations. (E.g. a:b = 2:3)
// In that case it should not be displayed in italic.
- if (GetToken().aText.getLength() == 1 && GetToken().aText[0] == ':')
+ if (maText.getLength() == 1 && GetToken().aText[0] == ':')
Attributes() &= ~FontAttribute::Italic;
+
+ // Arabic text should not be italic, so we check for any charcter in Arabic script and
+ // remove italic attribute.
+ if (!maText.isEmpty())
+ {
+ sal_Int32 nIndex = 0;
+ while (nIndex < maText.getLength())
+ {
+ sal_uInt32 cChar = maText.iterateCodePoints(&nIndex);
+ if (u_getIntPropertyValue(cChar, UCHAR_SCRIPT) == USCRIPT_ARABIC)
+ {
+ Attributes() &= ~FontAttribute::Italic;
+ break;
+ }
+ }
+ }
};