Add antialiasing toggle to text tool#935
Conversation
|
Thanks for having a look! I'll need to have a look at the pango / Cairo stuff and do some testing, but for the toolbar button / settings I think it would be best to reuse the standard antialiasing button from the base class ( |
This is possible, but as redraw is only called when a change is made, if you change the anti-aliasing setting before text finalization, the change does not register until another action is performed (e.g moving cursor, adding new text to text, etc.) |
|
Right, that makes sense. I think it would be reasonable to add an event in BaseTool for this so that re-editable tools can handle the antialiasing setting changing and trigger their own redraw. |
…o use BaseTool antialias
|
@cameronwhite Added this functionality to BaseTool, and readjusted the text tool to support it. |
|
|
||
| protected override void OnChangeAntialias (object? sender, EventArgs e) | ||
| { | ||
| UpdateFont(); |
There was a problem hiding this comment.
I noticed that after I finished typing some text (i.e. after pressing Esc) that the antialiasing changes didn't cause a redraw right away until I did something else to force a redraw, like pressing Ctrl.
This also happens with other font properties too, though, so it's a more general behaviour and could probably be left for another pull request
There was a problem hiding this comment.
Yes, it seems like in that state after pressing escape, the text is not considered in edit mode, and so does not call redraw.
The if (is_editing) statement on UpdateFont in TextTool prevents the redraw. It seems to be there for a reason (removing it then starting Pinta with text tool on causes crash), so i won't touch it for the time being in case it causes other issues.
|
The changes look good to me - thanks! |
I was frustrated with the lack of ability to disable antialiasing on Pinta, so I decided to just go and add it.
Please note this was cobbled together. I have zero experience with Cairo/Pango/PangoCairo but in my brief testing there didn't seem to be any obvious problems.
Thank you in advance.