Applying colour to text breaks Arabic shaping

Migrated from: https://bugs.launchpad.net/inkscape/+bug/332580

Original bug description

Applying colour to parts of word breaks Arabic shaping rendering letters separated from each others.
In Arabic, character takes different forms (shapes) according to its position in the word, which is called shaping technically. Pango can handle this very well, it can also handle colorization of Arabic text (i.e. shaping don't get broken). I think, because the colored characters are placed inside tags, inkscape sends it to pango as a separate text run so the context is lost and pango renders it as if it is a single word. I'm not sure if elements are supposed to be independent of its context, thus inkscape shouldn't colorize the text that way, or it is considered as part of its context and then inkscape should send the whole text run to pango and mark parts that needs colorization using pango's markup language. The attached sample shows the correct behavior after converting text to path.

Steps to reproduce:

Use attached file [1] and try to change color of one letter.

What happened?

Text move wrong. From the coments the problem is each color change is wraped into a and this break the render on inkscape, as Kalhed says in original report Pango itself handle well this colorization, you can test pango markup using pango-view utility (from devel package): pango-view --markup -t "ع<span color='blue'>ر</span>ب<span color='red'>ي</span>" --font="DejaVuSans 100"

What should have happened?

text dont move

Inkscape Version and Operating System:

  • Inkscape Version: 1.0alpha (2a3b224cec, 2019-04-06)
  • Operating System: Debian
  • Operating System version: Buster

[1] test.svg