Bug 426607

Summary: Cannot set superscript or subscript for the whole text in text tool
Product: [Applications] krita Reporter: Tiar <tamtamy.tymona>
Component: Tool/TextAssignee: Krita Bugs <krita-bugs-null>
Status: CONFIRMED ---    
Severity: normal CC: ahab.greybeard, griffinvalley
Priority: NOR    
Version First Reported In: 4.3.0   
Target Milestone: ---   
Platform: Mint (Ubuntu based)   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Patch that fixes the issue in a wonky way.

Description Tiar 2020-09-16 13:08:50 UTC
SUMMARY
You can set subscript or superscript for a part of text and save and it will work, but you cannot set it to the whole text.

STEPS TO REPRODUCE
1. Create a text shape, open the editor.
2. Select whole text.
3. Go to Format -> Superscript.
4. Observe text in the rich text editor changing to superscript.
5. Select all and press Save.

OBSERVED RESULT
Text on the canvas doesn't change.

EXPECTED RESULT
Text on the canvas should change to superscript.

SOFTWARE/OS VERSIONS
Krita 4.3.0
Linux Mint 19.3

ADDITIONAL INFORMATION
If you just select a part of text and set it to superscript or subscript, it will work. So it's not rendering that's wrong here.
Comment 1 Ahab Greybeard 2020-09-17 14:34:38 UTC
I can confirm this

It is possible to set the entire text to superscript or subscript by using the svg editor:
Have one normal letter followed by super/subscript characters created in the rich text editor then save and close.
Open for editing and use the svg editor to remove that one letter, then Save.
The entire text will then be in superscript.
However, if you edit again and use the rich text editor then it goes back to 'normal' text.
Comment 2 wolthera 2025-03-28 13:03:44 UTC
Created attachment 179817 [details]
Patch that fixes the issue in a wonky way.

Ok, so... there's a bit of weirdness here.

You see, I'm not sure if SVG text are supossed to be able to have baseline-shift be applied at the paragraph level. Within Krita especially this doesn't mean much, because super and sub align to the parent font, but our textshapes have no parent font (css inheritance starts at the textshape).

I've attached a patch that makes this work with the default font-size, but I'm generally very skeptical of the whole thing, and I'm unsure if I should implement it, as it can make text layout dependent on default fontsize. If you setup the text to have a single span that is super-scripted, then it already works.

I need to think longer about this...