SVG character transform handling and conversion functions.

This is the first MR for phase 3, which will cover handling conversions and SVG text transforms. This is necessary so that old Krita 5.2< texts can be converted to something a little more user-friendly.

  • Insert/Remove transforms when editing plain text. (woltherav/krita#30 (closed))
    • The primary purpose of this is to have something happen when we are inserting and removing text. When fiddling with it, you do get the sense that maybe inserting a newline should result in the text getting offset, and we could technically implement something like that, but right now I'm happy with this.
  • Converters(woltherav/krita#64 (closed))
    • Enable apply the white space collapses (so we can handle converting from white-space:normal to white-space:pre-wrap;)
    • function insert newlines for each anchored chunk.
    • Function to set transforms on text content elements.
    • Convert to SVG 1.1
    • Convert to Pre-formatted
    • Convert to Inline

In theory this could be a generic command that is called with an action/shortcut, but I don't understand how we handle those.

Test Plan

Basic usage:

  • Open a new document.
  • Create a text.
  • While the text is being edited, select one of the new buttons in the tool options.
  • You should be able to flick between the tree types, with minimal changes.

Converter usage:

  • Open an old Krita 5.1 document (or one made with the rich text editor)
  • Try type text at the end of a "line" or delete text at the start of a new "line". The transform should now be deleted properly.
  • Select the text with the text tool
  • Click "Convert to Inline Wrapped" or "Convert to Pre-formatted".

Formalities Checklist

  • I confirmed this builds.
  • I confirmed Krita ran and the relevant functions work.
    • Insert/Remove transforms
    • Apply whitespace
    • Insert newlines on anchors (there is a test, but it needs more)
    • convert to svg 1.1
  • 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.
  • Does the patch add a user-visible feature? If yes, is there a documentation MR ready for it at Krita Documentation Repository?
Edited by Wolthera van Hövell

Merge request reports

Loading