Skip to content

Implement basic rich text editing.

This adds basic rich text editing to the text tool with setting the fill and stroke, the font style and weight and underlines. It also allows for rich text copy-paste, accepting both html and svg.

text-tool-demo-feb-2024-02-07.mp4

The KoSvgTextShape can now split its own nodes, so we can set markup on ranges. In addition to that, when changing properties and inserting/removing text, Krita now tries to clean up the text nodes, removing empty entries and merging similar nodes.

The shortcuts could do with becoming actions at some point, instead of relying on the default qt::keysequences, though I'm still unsure whether I want to keep them inside the textcursor, or transfer them to where ever we put all the text property widgets.

Test Plan

  • Start editing a text
  • change the color in the color selectors
  • use ctrl+i/ctrl+b/ctrl+u
  • copy and paste rich text, tested here were firefox, libreoffice, various qt apps and Krita itself (inkscape, gimp and scribus all don't save html or svg into the clipboard).

Formalities Checklist

  • I confirmed this builds.
  • I confirmed Krita ran and the relevant functions work.
  • I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!)
  • I made sure my commits build individually and have good descriptions as per KDE guidelines.
  • I made sure my code conforms to the standards set in the HACKING file.
  • I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.

Reminder: the reviewer is responsible for merging the patch, this is to ensure at the least two people can build the patch. In case a patch breaks the build, both the author and the reviewer should be contacted to fix the build. If this is not possible, the commits shall be reverted, and a notification with the reasoning and any relevant logs shall be sent to the mailing list, kimageshop@kde.org.

Edited by Wolthera van Hövell

Merge request reports