QGIS icon indicating copy to clipboard operation
QGIS copied to clipboard

Right-to-Left languages characters in each label words are reversed

Open hareldunn opened this issue 1 year ago • 31 comments

What is the bug or the crash?

This is a recurrence of a bug similar fixed long ago for all rtl languages like Hebrew, Persian and Arabic. It was solved, at times, with using the curved label option, but not any more.

Each word, although in correct word order, has it's letters reversed, akin to: Hello World -> olleH dlroW

Here's the bad labelling in 3.32, note for example the word for chapel קפלה is displayed in reverse הלפק image

Here's the correct text handling in 3.28.9 LTR image

Steps to reproduce the issue

Add any layer with RTL language in attribute table Display label based on field

Or open QGZ from GPGK here qgisbug.zip

I've added English, Arabic and Hebrew labels from the OSM amenity data

Versions

3.32.1

QGIS version 3.32.1-Lima QGIS code revision 4a078ecf
Qt version 5.15.3
Python version 3.9.5
GDAL/OGR version 3.7.1
PROJ version 9.2.1
EPSG Registry database version v10.088 (2023-05-13)
GEOS version 3.12.0-CAPI-1.18.0
SQLite version 3.41.1
PDAL version 2.5.5
PostgreSQL client version unknown
SpatiaLite version 5.1.0
QWT version 6.1.6
QScintilla2 version 2.13.1
OS version Windows 10 Version 2009
QGIS version 3.32.1-Lima QGIS code revision [4a078ecf](https://github.com/qgis/QGIS/commit/4a078ecf) Qt version 5.15.3 Python version 3.9.5 GDAL/OGR version 3.7.1 PROJ version 9.2.1 EPSG Registry database version v10.088 (2023-05-13) GEOS version 3.12.0-CAPI-1.18.0 SQLite version 3.41.1 PDAL version 2.5.5 PostgreSQL client version unknown SpatiaLite version 5.1.0 QWT version 6.1.6 QScintilla2 version 2.13.1 OS version Windows 10 Version 2009

Supported QGIS version

  • [X] I'm running a supported QGIS version according to the roadmap.

New profile

Additional context

It appears the change happened between 3.30 and 3.32, a colleague had his computer replaced and installed a new QGIS version 3.32 standalone that showed this issue. I guided him with installing the network installer for 3.32 and had the same issue. I tested his project and layers on my computer, and it too showed the bug in 3.32, but not in 3.28 LTR. He claims his project worked fine in his old computer running 3.30, so this pinpoints the bug to 3.30 -> 3.32

hareldunn avatar Aug 06 '23 11:08 hareldunn

Hi @hareldunn, thanks for reporting. Could you please specify the difference between the issue you reported and the one reported at https://github.com/qgis/QGIS/issues/21940? In the https://github.com/qgis/QGIS/issues/21940 issue report, users claim that the issue occurs also in QGIS 3.28 and QGIS 3.30 and previous version. Could you please clarify what do you mean with "Each word, although in correct word order, has it's letters reversed" as it seems to me in the provided images the entire label is reversed, not only the letters of the single words.

agiudiceandrea avatar Aug 06 '23 23:08 agiudiceandrea

Hi @agiudiceandrea, you are correct, I somehow managed to confuse myself. Yes, the flip is indeed for the entire label string, "Hello World" -> "dlroW olleH"

As for recent QGIS version, I didn't have that issue, nor did my colleague, only in 3.32.

I also found another mention of this on GIS.SE, seems to be the same issue

hareldunn avatar Aug 15 '23 07:08 hareldunn

Hi @hareldunn, thanks for checking. I cannot replicate the issue neither using QGIS 3.28, QGIS 3.30 nor QGIS 3.33-master: it seems to me the labels are correctly displayed.

See the exported images of point from "amenity Hebrew" layer with "full_id" field value of n2954804553:

QGIS 3.28 3_28

QGIS 3.30 3_30

QGIS 3.33-master master

Maybe the issue has been already fixed in development branch: you can install a development version using a standalone installer available at https://download.osgeo.org/qgis/windows/weekly/?C=M&O=D.

agiudiceandrea avatar Aug 15 '23 16:08 agiudiceandrea

I can confirm this issue on Windows, QGIS 3.32.3. We reverted to 3.28.11 and the backwards RTL text problem does not appear (Also, the problem does not appear on Linux, with the same QGIS version)

micha-silver avatar Oct 18 '23 07:10 micha-silver

@micha-silver , thanks for reporting. Could you please provide a simple project and a simple layer with only one feature in order to replicate the issue?

agiudiceandrea avatar Oct 18 '23 11:10 agiudiceandrea

Hi I have the same issue, working on windows 10. and it's been persistent since above gis 3.30.0, including the recent 3.34. It's not only that the letter order is reversed it's also outside the label box

Here's a screenshot using 3.34: image

But when I revert to 3.30.0, it displays correct: image

As you can see numbers are displayed correctly

drarbib avatar Nov 09 '23 07:11 drarbib

@drarbib, thanks for reporting. Could you please provide a simple project and a simple layer with only one or few features in order to replicate the issue? Could you please specify the OS locale / language and the locale / language set in QGIS?

agiudiceandrea avatar Nov 09 '23 09:11 agiudiceandrea

RTL problem.zip

Hi, here's a simple file, created in 3.30.0, opened in 3.34 the problem is consistent. in fact even if i edit ans save it in 3.34 and open it in 3.30.0 it displays correct, but not in 3.34. THANK YOU

display in 3.30.0: image

display in 3.34 (and 3.32.1 & 3.32.2) image

windows: Edition Windows 10 Pro Version 20H2 Installed on ‎27/‎04/‎2021 OS build 19042.985 Serial number PF21WWN7 Experience Windows Feature Experience Pack 120.2212.2020.0

Locale: QGIS settings: image windows settings: image image

drarbib avatar Nov 09 '23 11:11 drarbib

It looks like the issue doesn't occur on my Windows 10 Italian it_IT using QGIS 3.34.0

image

agiudiceandrea avatar Nov 10 '23 08:11 agiudiceandrea

The QGIS project highly values your report and would love to see it addressed. However, this issue has been left in feedback mode for the last 14 days and is being automatically marked as "stale". If you would like to continue with this issue, please provide any missing information or answer any open questions. If you could resolve the issue yourself meanwhile, please leave a note for future readers with the same problem and close the issue. In case you should have any uncertainty, please leave a comment and we will be happy to help you proceed with this issue. If there is no further activity on this issue, it will be closed in a week.

github-actions[bot] avatar Nov 25 '23 02:11 github-actions[bot]

grazie mille Andrea, First off thank you for your time and effort. I just DLed and installed 3.34.1 and the issue persists (yet in 3.30 it works fine). image

I do not know how I can help to resolve it. I am completely incompetent in programming. My common sense teIls me that somehow RTL support is created by an extra command that reverses the letter order, and maybe in my version of windows with Hebrew support it somehow does it double, whereas with your Italian one it does not. again what's weird to me is until 3.30 it never was a problem, so I wonder what was changed in the code. If there is anything I can do (like provide more system info) to help, please let me know

image

drarbib avatar Nov 30 '23 06:11 drarbib

@drarbib, have you tried if the issue occurs also using a new QGIS user profile?

agiudiceandrea avatar Nov 30 '23 06:11 agiudiceandrea

I did just now on 3.34.0, problem persists + I know of another user on another computer who has this problem

drarbib avatar Nov 30 '23 08:11 drarbib

Hi @agiudiceandrea My (unchecked) idea is that the prob is a combination of Windows 11 and QGIS >= 3.30. I could not see the problem in a Win 10 machine. And the issue does not appear on either version of Windows when QGIS <= 3.28. I have to ask some colleagues who have Win 11 to retest. I'll report back...

micha-silver avatar Nov 30 '23 18:11 micha-silver

I'd like to add any info that could be relevant, as I am also experiencing this bug. It did not exist sometime before 3.30. I am using 3.34 on Windows 11 and the problem still exists. On the photo below, look at Ramat HaSharon. The Hebrew and Arabic translations say "NorshHa Tamar", and plus the ه uses the initial form هـ, like it would if the word were displayed properly, even though it's at the end of the word, where the letter should look like ـه. The alignment here is set to "Center" but I can't get it to align the lines over one another like it worked in previous versions. I can add any other necessary info Screenshot 2024-01-02 154001

ryangentry avatar Jan 02 '24 21:01 ryangentry

@micha-silver , from the previous comments and from https://gis.stackexchange.com/questions/465205/left-to-right-flipped-names-in-arabic, it looks like the issue occurs on some systems both when using Windows 10 and Windows 11 with QGIS >= 3.32, and it didn't occur with QGIS 3.30.0 and previous versions.

agiudiceandrea avatar Feb 19 '24 20:02 agiudiceandrea

Is anyone able to supply a super simple, easy to understand demo project and data showing this issue? Simple enough so that the issue is clearly evident for someone with absolutely zero experience in right to left languages. Ideally with a mock-up of what the label should look like too.

I've tried to investigate this, but just lack understanding of exactly what's required here.

nyalldawson avatar Feb 19 '24 21:02 nyalldawson

Hi @nyalldawson, a simple project provided by @drarbib is in comment https://github.com/qgis/QGIS/issues/54098#issuecomment-1803655676 with screenshots of the map correctly displayed in QGIS 3.30.0 and incorrectly displayed in QGIS 3.34. Anyway I cannot replicate the issue on my system.

agiudiceandrea avatar Feb 19 '24 23:02 agiudiceandrea

How does QGIS even know when to use RTL text layout though? Is that dependent on the QGIS language setting? Or the system locale? Or the font used? Or the unicode characters in use?

I'm utterly clueless here, I need absolute "for dummies" / 5-year-old-kid-level instructions on how this should be handled so that I can update the QGIS internal text placement logic accordingly.

nyalldawson avatar Feb 20 '24 00:02 nyalldawson

I have the same issue in print layouts too (including labels, attribute tables and legend items):

QGIS LTR 3.28 (displays correctly): image

QGIS 3.36: image

I'm on Windows 11, V23H2. Locale EN_GB. The source data files are UTF-8.

ShieldsUpRedAlert avatar Feb 25 '24 07:02 ShieldsUpRedAlert

@ShieldsUpRedAlert see https://github.com/qgis/QGIS/issues/54098#issuecomment-1953305511

nyalldawson avatar Feb 25 '24 07:02 nyalldawson

@nyalldawson I don't know how QGIS handles RTL text internally, but as a user, Unicode RTL text (used to) appear RTL. You just align it to the right in the horizontal alignment (left/centre/right/justify) settings.

As far as I know, it is not dependent on system locale, and language settings. I did try adding the Dari (Persian) language and localisations on windows but did not fix the issue.

ShieldsUpRedAlert avatar Feb 25 '24 08:02 ShieldsUpRedAlert

  1. Open Automated placement engine
  2. Text rendering: select label as text

https://gis.stackexchange.com/a/477655/239933

ilyessmap avatar Feb 28 '24 09:02 ilyessmap

@ilyessmap, thanks for sharing a workaround. It will likely also help to fix the issue. @hareldunn @micha-silver @drarbib @ryangentry @ShieldsUpRedAlert may you please confirm the workaround works for you too?

agiudiceandrea avatar Feb 28 '24 12:02 agiudiceandrea

@agiudiceandrea, working for me in the main map window. In print layouts, the text is still mirrored on screen, but when I export as PDF everything looks fine.

ShieldsUpRedAlert avatar Feb 28 '24 14:02 ShieldsUpRedAlert

First off thank you @ilyessmap and thank you @agiudiceandrea,

like @ShieldsUpRedAlert the workaround works for me in the main window but not in the layouts

image image

drarbib avatar Feb 29 '24 06:02 drarbib

@nyalldawson, here https://github.com/qgis/QGIS/issues/56645 another issue report with a sample layer attached. According to various reporters, the issue occurs if the "Text rendering" parameter (in the "Automated Placement Engine" dialog window) is set to "Always Render Labels as Paths (Recommended)" (which is the default). If such parameter is set to "Always Render Labels as Text", then the label text is:

  • correctly displayed on the map canvas
  • not correctly displayed in the print layout
  • correctly displayed in the PDF file exported from the print layout

agiudiceandrea avatar Mar 03 '24 11:03 agiudiceandrea

@agiudiceandrea I still can't do anything with these reports yet, they all assume too much existing knowledge of how RTL languages work

nyalldawson avatar Mar 03 '24 20:03 nyalldawson

The QGIS project highly values your report and would love to see it addressed. However, this issue has been left in feedback mode for the last 14 days and is being automatically marked as "stale". If you would like to continue with this issue, please provide any missing information or answer any open questions. If you could resolve the issue yourself meanwhile, please leave a note for future readers with the same problem and close the issue. In case you should have any uncertainty, please leave a comment and we will be happy to help you proceed with this issue. If there is no further activity on this issue, it will be closed in a week.

github-actions[bot] avatar Mar 18 '24 02:03 github-actions[bot]

@nyalldawson, here #56645 another issue report with a sample layer attached. According to various reporters, the issue occurs if the "Text rendering" parameter (in the "Automated Placement Engine" dialog window) is set to "Always Render Labels as Paths (Recommended)" (which is the default). If such parameter is set to "Always Render Labels as Text", then the label text is:

  • correctly displayed on the map canvas
  • not correctly displayed in the print layout
  • correctly displayed in the PDF file exported from the print layout

This workaround works fine for the text, but text buffers are still displayed incorrectly. See:

image

ryangentry avatar Apr 07 '24 00:04 ryangentry