https://bugs.documentfoundation.org/show_bug.cgi?id=161303

--- Comment #14 from Hossein <[email protected]> ---
> $ pango-view --font="Noto Sans Arabic 256" --rtl --markup --text '-<span 
> color="red">ِ</span>.|'
> I suspect that the direction is calculated incorrectly.
If you try the above command without --rtl, the result is different, and the
color is applied correctly.

$ pango-view --font="Noto Sans Arabic 256" --markup --text '-<span
color="red">ِ</span>.|'

This is related to the base direction of text. From the pango-view man page:

  --rtl  Set base direction to right-to-left

Using fribidi utility, I get these outputs. Please note that the display here
is a little different, so you have to run it in terminal:
$ fribidi 
-ِ ب
                                                                             ب
-ِ
-ِ
-ِ

$ fribidi --rtl
-ِ 
                                                                            
-ِ--
ِ


Therefore, forcing base direction to RTL when user sets the RTL direction for
the paragraph should fix the issue. The reason that HarfBuzz hb-view utility
(or the library itself) ignores --rtl in this case is unclear to me. This
option works with some other cases:

For examples, the output of these two commands are different:
$ ./util/hb-view --direction=rtl
/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf "a ب"

$ ./util/hb-view --direction=ltr
/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf "a ب"

This may also help in debugging:

$ fribidi --levels
ِ 
ِ
0 
-ِ
-ِ
0 0 

$ fribidi --rtl --levels


1 
-ِ
                                                                              
-ِ
1 1 

It is worth mentioning that according to tdf#155470, in LibreOffice there are
limitations in embedding directions, for example LTR inside RTL, and things
like that.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to