Bug 428034 - "Align Left" in Krita keeps the text right-aligned for RTL languages
Summary: "Align Left" in Krita keeps the text right-aligned for RTL languages
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Tool/Text (other bugs)
Version First Reported In: 4.4.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords: rtl
Depends on:
Blocks:
 
Reported: 2020-10-20 20:33 UTC by Munzir Taha
Modified: 2025-11-22 16:39 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Munzir Taha 2020-10-20 20:33:24 UTC
SUMMARY
Left and Right has the same meaning for Arabic as other languages. However, "Align Left" in Krita keeps the text aligned right for Arabic (RTL). Krita chose to use SVG's attribute text-anchor:start instead of text-anchor:left when left is explicitly chosen. The same applies for right. text-anchor:start only makes sense when no alignment explicitly chosen.

STEPS TO REPRODUCE
1. Choose SVG Text Tool.
2. Type Arabic text. (Result: text is right-aligned which is correct).
3. Click the "Align Left" button. (Result: Nothing changed where it should left-align).

OBSERVED RESULT
Text is right-aligned

EXPECTED RESULT
Text should be left-aligned after clicking "Align Left"

SOFTWARE/OS VERSIONS
Linux: Arch Linux
KDE Plasma Version: 5.20.1
KDE Frameworks Version: 5.74
Qt Version: 5.15.1

ADDITIONAL INFORMATION
Calligra Words does the alignment correctly so it can be used as a reference.
Comment 1 Dmitry Kazakov 2024-08-22 16:38:52 UTC
Remove triaged keyword from CONFIRMED bugs
Comment 2 Yaron Shahrabani 2025-11-18 12:24:12 UTC
Still happens in Krita 5.2.13 (git 6d3651a) with Hebrew as well.

The buttons are working but in reverse order, it's irrelevant for SVG, it's only working in Rich Text anyway.
Comment 3 Halla Rempt 2025-11-20 09:39:39 UTC
Over the past four years, we've completely rewritten text handling in Krita, so we won't be fixing issues in the 5.2 releases. Could you check with Krita Next nightly build?
Comment 4 Yaron Shahrabani 2025-11-20 15:01:55 UTC
(In reply to Halla Rempt from comment #3)
> Over the past four years, we've completely rewritten text handling in Krita,
> so we won't be fixing issues in the 5.2 releases. Could you check with Krita
> Next nightly build?

I see it was completely changed but now I can't find how to align rich text at all.
Comment 5 Munzir Taha 2025-11-20 19:20:34 UTC
I checked nightly build and the alignment is still wrong. Changing the alignment now flips the text box like a mirror so it could go out of the border which is not the correct behaviour
Comment 6 wolthera 2025-11-20 20:10:51 UTC
It is correct, actually. This is because the default dragging mode is inline-size (https://svgwg.org/svg2-draft/text.html#InlineSize) and not text-in-shape, so there's no text box being moved.

I'll look into seeing if I can get the whole text shape to move if it switches anchors, but the main question whether the text is flowing into the direction you expect it to.
Comment 7 Munzir Taha 2025-11-20 22:37:32 UTC
(In reply to wolthera from comment #6)
> but the main question whether the text is flowing into the
> direction you expect it to.

In Text Properties, the three icons labeled “Text Alignment” work for left, center, and right. When expanding that section, there’s also a Text Align: dropdown with the options: Left, Start, Center, End, Right, and Justified. I tried changing these, but nothing changed in the text. This is my first time using the new Krita build from master, so I might be missing something obvious.
Comment 8 wolthera 2025-11-21 13:35:24 UTC
(In reply to Munzir Taha from comment #7)
> (In reply to wolthera from comment #6)
> > but the main question whether the text is flowing into the
> > direction you expect it to.
> 
> In Text Properties, the three icons labeled “Text Alignment” work for left,
> center, and right. When expanding that section, there’s also a Text Align:
> dropdown with the options: Left, Start, Center, End, Right, and Justified. I
> tried changing these, but nothing changed in the text. This is my first time
> using the new Krita build from master, so I might be missing something
> obvious.

Ok, then everything is working correctly and I'll just need to disable those for inline-wrap (they only work for text-in-shape as well, the SVG spec is kinda weird like that).
Comment 9 Munzir Taha 2025-11-21 21:23:48 UTC
(In reply to wolthera from comment #8)
> Ok, then everything is working correctly and I'll just need to disable those
> for inline-wrap (they only work for text-in-shape as well

I tested the text-in-shape feature by creating a circle, selecting the text tool, and typing Arabic inside it. The alignment options work correctly for English (LTR), but for RTL text the “Start” option aligns the text to the left instead of to the right.
Comment 10 wolthera 2025-11-21 22:16:15 UTC
That's because the paragraph direction isn't determined automatically, it's how SVG works. Inkscape does the same. You need to add "direction: right to left" by going into the paragraph tab in the text properties and going to add property, and selecting "direction".

You can also make this into a style preset that you can then use to create any future texts.
Comment 11 Munzir Taha 2025-11-22 16:09:30 UTC
Thanks! It makes sense now.
Comment 12 wolthera 2025-11-22 16:39:20 UTC
Super, then I'll close this bug.

I had been theorizing we should have a default style preset for particular type setting traditions, so east-asian could have vertical writing mode, and I am also considering one for right-to-left scripts, so it'll be easier to setup for new comers. I still need to consider the details here, but this report does make it clear it'd be useful.