Font information lost on save when adjusting spacing for part of the text

Summary:

When a file with a text node containing multiple tspans is saved (default format, "Inkscape SVG"), and reloaded, some font information is lost when one of the tspans has adjusted letter spacing.

Steps to reproduce:

  • open Inkscape
  • choose Text tool, choose some font A (in the example file: sans-serif, 72pt)
  • create a text object, type some text (in the example: "hello")
  • select whole text, in text & font dialog choose different font B (in the example: sans-serif, 144pt), click apply
  • select part of the text, adjust the spacing using the text toolbar (in the example: selected "e", set letter spacing to 50px)
  • save & reload the file

Note that I'm using the default format, so I believe this is SVG 2.0, it's not a compatibility issue.

What happened?

The part of the text with adjusted spacing looks differently after reloading the file - namely, is rendered using font A, not font B.

See the attached PNG screenshot (left: inkscape instance which just saved the file; right: new inkscape instance with the same file open).

The issue seems to be that the saved SVG now contains 3 tspans, with the middle one only having the spacing information in style attribute, and thus reverting to the font from parent text node (some attributes omitted):

     <text style=(font A)>
       <tspan>                        
           <tspan style=(font B)>h</tspan>
           <tspan style="letter-spacing:50px">e</tspan>  
           <tspan style=(font B)>llo</tspan>
       </tspan>                                                                 
     </text>  

What should have happened?

The file should look just the same after reloading.

I guess the inner tspan should also have the styling properties for "font B".

Sample attachments:

tspan-save-minimal-example.svg

tspan-save-difference-screenshot

Version info

Inkscape 1.2.2 (1:1.2.2+202212051552+b0a8486541)

    GLib version:     2.72.4
    GTK version:      3.24.33
    glibmm version:   2.66.2
    gtkmm version:    3.24.5
    libxml2 version:  2.9.13
    libxslt version:  1.1.34
    Cairo version:    1.16.0
    Pango version:    1.50.6
    HarfBuzz version: 2.7.4

    OS version:       Ubuntu 22.04.2 LTS