Lazy Text Tool(Prototype) – A plugin that helps you type

Let me say this so everyone is clear, I have never written python before(other than a minor change to an existing plugin). Add to the fact that a lot of this code has been rushed with little to no testing, please keep your expectations in check! TRY AT YOUR OWN RISK.

Here is what kinda works


Typing Text – yes Colors – yes Fonts – yes Font styling – yes

Line and alignment:

Letter spacing – yes Alignment – yes


Stroke – yes (same svg 1.1 though) Canvas scrolling - yes Moving – yes Custom fixed width boundary - yes

What partly works:

Canvas zoom – It works, but it is zoom to center, not zoom to mouse Line spacing – mostly

What doesn’t work:

Gradients – For both color and stroke, it isn’t hard to implement, just needs an interface and be hooked up

Canvas rotation

Word spacing – no

Transforms (rotation/scale) – No, currently, there is no easy way to get transformation/matrix data from svg Text in Krita and storing it is a pain too. That doesn’t mean there is no way. A few options are: A) Create the text item as a group, then get the data from the group item instead. (but then you won’t be able to edit the text files without ungrouping)

B) Get the data from the KRA file which is effectively a ZIP and stuff it into the id attribute (but this means the file would need to be saved)

C) Get the data via the Copy and retrieve it from there, then store it into the id attribute. (This is probably the most sure fire way to go about it but I think option D is better)

D) Add the things necessary to Krita 5.0 (This is what I am gonna try to do in my free time)

Important Restrictions/Features:

The current setting limits you to only edit layers that have no text object or 1 text object. (so no other shapes, no other text).

When you click the canvas, it will create text typing in Typewriter mode. This is pretty much free typing and is similar to the current text tool. If you draw a box, it will enter into Text Wrap mode. Which pretty much means fixed boundary. You can manually switch modes at any point.

Fixed boundaries are a great thing to play alongside alignment, but the text wrapping is a bit of a hit or miss. It works but it may not render as you think it will based on the platform.

On that note, unlike the normal text tool, this one distinguished between lines and paragraphs.(kinda) When you text wrap or shift+enter, that will make a line. If you just hit enter, that will make a paragraph.(The normal text tool treats everything as a paragraph)

The top left box lets you move the text around while editing, the bottom right box lets you resize the boundary. Do note if you resize the boundary, your lines will be lost(not your paragraphs)

Now this is EXTREMELY important:

This module uses the paste workaround to achieve writing the SVG. Your clipboard will be backed up, then the SVG will be written. Then your clipboard will be restored. That means avoid having something too large in your clipboard if possible when used. And it also means if it crashes before it restores the clipboard, the clipboard will be lost!

When you double click a text item for editing, the vector layer it is on will become invisible. When you commit the change, a new layer is created and the previous layer is deleted.

To commit the changes, left click. To cancel, right click.(outside the text area). If you empty out the text item, it will be deleted with the layer.

Unlike the regular text tool, you can click on text that is outside the current layer. The limit to this is the current group. If your text is not in any group, that means all layers.

Since the layer is deleted when edited, if you plan to use filters or layer styles, do it on the group, not the layer.

I am probably forgetting a lot of things so I’ll update it later once I remember. But I will say this again cause it needs to be said. The code is a TOTAL mess.

I made this module mostly for my own niche use. I don’t actually even need most of the functions but the curiosity got to me so I rushed most of it to get it out the door. The main goal is to see what the API is missing so it can be expanded hopefully in time for Krita 5.0 (which is a short deadline)

You can expect crashes, memory leaks, poorly written code, hacked in stuff, inconsistent code, rushed code. It is such a big mess, even the debug code is a total mess. This is more of pastebin quality then github quality.

If that sounds good to you, then feel free to try it. To enable, install the plugin via Tools. Then restart Krita. Once restarted, enable it in the configuration and restart again. Then finally, you can toggle it on and off via Tools. It will replace the native text tool.

GitHub Download (At Your own risk)

Lastly, there are unlikely to be bug fixes for this because it is a PROTOTYPE. The whole code needs to be redone properly. But the priority is trying to make that easier with less workarounds by hopefully getting stuff in the API.


Pretty cool tbh but if you have time, do take a look at those, I had some plans regarding the text tool, but never got the time and energy after I got a dayjob.

Here is the plan for flowing text as well as text on path functions, I planned to do it as my gsoc project last but got a job and had to drop.

Here is something I was playing with to figure out how to do vertical text in Krita.

Feel free to ask questions.



It sounds interesting.
When I’ll have time, I’ll test it and take a look on code to understand how you’ve build this interface over canvas :slight_smile:

Many many things can be added to API :slight_smile:


1 Like

looks really cool I am gonna try it out.

Interesting. The route I went with was a lot easier since I am only reusing QGraphicsTextItem and trying to sync it up to the canvas. From a quick look, you are trying to do a lot of the stuff more manually to support SVG2 and writing along a Path. Personally I can’t wait for that, but in the meantime I had to deal with inputting lots of small text. And as we know, nothing better then spending hours to save seconds.(Though a lot of that was cause I got carried away)

And yes, I know. Kind how much of a burden it is to dayjob + do development. It pretty much eats up all my time :confused:

Is there any plans so far for the native tool do you think? Reason I ask is not to put pressure on you to finish but simply to know how much to commit to the LazyTextTool. If you think that it’ll be ready in a year or so, then I might just stick to a simple fixed up version. (I still have native animation stuff to work on that I want to add). If not, then depending I might look into making it more feature driven and give up backwards compatibility for example. Or if it would help speed up the native tool, you want me to do some R&D on some bottlenecks?

I did manage to get vertical text working to some extent, albeit it isn’t an option but has some manual work to it. And it isn’t perfect due to some letters being larger than other or smaller than others.(It was mostly a byproduct of the line support)

1 Like

But there is only a few days till 5.0 string freeze. So there is only so much that can be added in time. Currently, working with SVGs is pretty limited. So I want to at least get that in.

1 Like

Any improvements made on API are welcome and that sure SVG is not really supported from API

Being able to work on shapes from a vector layer without having to use copy/paste operation would be great :slight_smile:

Don’t know what you’ve in mind but on my side I can see:

  • Create shapes to vector layer
  • Group/Ungroup shapes
  • Delete shapes from vector layer
  • Update shape
  • Being able to move/scale shape within vector layer without having to work directly on SVG properties

Not sure that everything can be done before string freeze, it sounds to be a lot of work…


1 Like

Probably the bare minimum so it is at least possible without doing workarounds. But if I have time on the weekend, maybe a little bit extra.

Yeah, it’s best @KnowZero if you prioritize things and make MR(s) asap, since it must be merged before string freeze, so it must also have some time to be reviewed… The deadline is really close. Though, I’m not sure, maybe API could be added after string/feature freeze - but for that you’d need to ask @halla if it’s considered a feature (in which case it cannot go into Krita 5 after the deadline).

That is the plan, I know the developers are fairly busy at this time so I’ll keep it minimum and will send it over this weekend.

1 Like

Ehh it was all planning and aslo the SVG subsystem of Krita scares me in the first place with so many broken unit tests, :stuck_out_tongue:

Someone will pick this up from the core team after Krita 5 for sure, if not I will be bugging them every now and then.

I don’t blame you. There is definitely quite a lot :sweat_smile:

I hope so… but everyone is busy with a lot on their plate. So I’ll probably have to make a more serious effort on this plugin at one point… after the animation export stuff as that takes priority. Which means I have to add learning python to my list… on top of learning Rust and Go for work… sigh…

1 Like

Okay, 2 pieces of news.

  1. I did a few fixes to the LazyTextTool prototype.(Yes, I know I said there won’t be bug fixes, but since I am using it for my own purposes, I will still fix the things that annoy me. For other stuff, it would make more sense to fix them once I make it properly rather then patching things up quickly randomly)

  2. The python API changes have been merged for 5.0 :slight_smile:

The patch includes everything except grouping/ungrouping. Though depends on what your definition of “updating” is. It wasn’t that adding grouping/ungrouping was difficult, simply I wanted to go with the bare minimum so that it is at least “possible” to do all the vector stuff. Not to risk anything being a blocker. You should technically be able to emulate grouping and ungrouping through getting the svg shapes, then importing them as a group and then deleting the old ones. It is more work but it is “possible”



I took a quick look.

Just the possibility to add shapes with addShapesFromSvg() method is a big improvement.
No need to use clipboard to paste shapes :slight_smile:

Concerning shapes, by update I mean, if I have a path, I want to be able to modify path points coordinates, using something like shape.setFromSVG(str)

Looking the API, it seems we have to delete current path, and add a new one.
Like for group/ungroup.

That’s not perfect but what you’ve made is already great, we now have the possibility to manipulates shapes :star_struck:

Many thanks for this :blush:


The thing about that is if something like setFromSVG is created, it would mostly be a convenience method that would delete the shape, and add a new one(with some preset defaults of the last shape like zindex). The only benefit of that is that it would be under a single undo, but same can be accomplished once transactions are added to the python api. (Which is probably the most immediate thing the API needs. Because currently, either every step the API does requires multiple undos for the user, or in some cases can cause a crash. The patch fixes remove node crash, but I am sure there are others like it)

By the sound of things what you really want is access to KoPathShape so you can move or delete individual points. Though that would require a new class.

So you would be able to do things like:
for point in shape.points():
print( point.pos() )

1 Like

im testing right now, it looks so great!

it have bugs, but, the design it’s better than the original text tool.
Would you like some bugs report or observations? i don’t know nothing about programing.

If people report bugs, I will take them into consideration. But I can’t guarantee they will be fixed until the proper rewrite is done.

That said, if I am aware of the bug. I will make sure the bug doesn’t creep into the proper version for sure. (Because I will reuse some a lot of the logic)

The proper version though will be for 5.0+ as there have been API changes that result in less nasty workarounds.

1 Like

Did a pretty big update recently, anyone notice any regressions or issues?

1 Like

ok im going update it, i will answer later