Bug 144911 - Digits misplaced when entering LTR text (starting with a number) in an RTL paragraph
Summary: Digits misplaced when entering LTR text (starting with a number) in an RTL pa...
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.2.0.4 release
Hardware: All Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: RTL-CTL
  Show dependency treegraph
 
Reported: 2021-10-04 10:35 UTC by h.rosemarin
Modified: 2022-12-15 00:40 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description h.rosemarin 2021-10-04 10:35:30 UTC
Description:
When the paragraph is right-to-left, and trying to enter english (left-to-right) text that includes a combination of digits-space-letters-space-digits the digits are not placed correctly.

See "Steps to reproduce" for an example

Steps to Reproduce:
1. start with a blank line, with a r-t-l paragraph aligned to the right
2. switch to english
3. try entering the text "15 U.S.C. 80b1"
4. the "15" is treated as r-t-l and not placed in the proper place

Actual Results:
"U.S.C 80b1 15"
with the font of "15" being the r-t-l font

Expected Results:
"15 U.S.C. 80b1"


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 7.2.1.2 / LibreOffice Community
Build ID: 20(Build:2)
CPU threads: 4; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: he-IL (en_IL); UI: en-US
Ubuntu package version: 1:7.2.1-0ubuntu0.20.04.1~lo1
Calc: threaded
Comment 1 raal 2022-02-17 17:50:08 UTC
Confirm with Version 4.1.0.0.alpha0+ (Build ID: efca6f15609322f62a35619619a6d5fe5c9bd5a)
and Version: 7.4.0.0.alpha0+ / LibreOffice Community
Build ID: 8942956e05f2208ffb666a2118f5db092c30ce6a
CPU threads: 4; OS: Linux 5.11; UI render: default; VCL: gtk3
Locale: cs-CZ (cs_CZ.UTF-8); UI: en-US
Calc: threaded

I know nothing about RTL, leaving Unconfirmed status.
Comment 2 Buovjaga 2022-12-13 12:53:08 UTC
Something similar is this bug 89010
Comment 3 ⁨خالد حسني⁩ 2022-12-13 20:28:01 UTC
The digits have “weak” LTR direction property, so if the paragraph direction is RTL they get a RTL word order if not preceded by LTR text, this is all expected. 

It follows that if the paragraph direction is RTL then the digits belong to RTL text and thus take so-called complex font.

If one want to override this, “Insert → Formatting Mark → Left-to-right mark” before the digits should do the trick.
Comment 4 h.rosemarin 2022-12-14 22:12:49 UTC
the previous comment is correct, but....
it is correct that using the "intuitive" menu sequence: "Insert->Formatting Mark->Left-To-Right Mark" renders the text as expected
however, I believe that this should not be the default behavior, and users should not have to resort to using invisible formatting marks whenever they want to cite an international (latin text and digits) reference while writing in a r-t-l language
1. because it is not intuitive, and not what users expect
2. as an expert "witness" to back my intuition on default behavior - MS Word renders the text in my example correctly without any "formatting marks". The fact that the users enters a sequence of digits and latin letters means that the sequence should be formatted as a left-to-right sequence within the right-to-left paragraph
Comment 5 ⁨خالد حسني⁩ 2022-12-14 23:04:30 UTC
(In reply to h.rosemarin from comment #4)
> the previous comment is correct, but....
> it is correct that using the "intuitive" menu sequence: "Insert->Formatting
> Mark->Left-To-Right Mark" renders the text as expected
> however, I believe that this should not be the default behavior, and users
> should not have to resort to using invisible formatting marks whenever they
> want to cite an international (latin text and digits) reference while
> writing in a r-t-l language
> 1. because it is not intuitive, and not what users expect
> 2. as an expert "witness" to back my intuition on default behavior - MS Word
> renders the text in my example correctly without any "formatting marks". The
> fact that the users enters a sequence of digits and latin letters means that
> the sequence should be formatted as a left-to-right sequence within the
> right-to-left paragraph

I don't know what MS Word is doing nor I can test it to confirm, but either it is inserting the formatting marks automatically based on some heuristic (and I think we already have open issues requisting such behavior) or implements q non-standard bidi algorithm which I don't think some thing we want to support.

FWIW, you will get the same digit order thing in essentially any application (other than MS Office, based on your observation).

The font switch is unique to office suits and we probably can improve it, but I feel that the digit order is the bigger issue here.