Skip to content

Fix "Use tablet angle" feature for Calligraphy Tool

The calligraphy tool ignores "tablet angle" (i.e. pen orientation / angle) when "Use tablet angle" is enabled. The cause of this bug appears to be a small logic error in the implementation of KarbonCalligraphyTool::setAngle.

The single change made on line 201 of KarbonCalligraphyTool.cpp stops tilt parameters from being ignored when they are present.

Bug report, for reference: https://bugs.kde.org/show_bug.cgi?id=485709

I am currently not able to confirm that my commit does indeed fix the bug I reported, since I do not have a drawing tablet for my dev machine (runs Ubuntu). I have a Surface tablet running windows that i confirmed the bug on, but my dev environment is currently not set up for a Windows build to allow me to test this fix with my Surface.

I have, however, confirmed that Krita compiles and runs fine.

I have tested the fix (using the Windows CI build for this PR) and can confirm that the Calligraphy Tool now responds to pen angle when the "Use tablet angle" setting is enabled.

Test Plan

To confirm that this fix is indeed a fix, the reviewer will need a drawing tablet that supports pen tilt.

Then, run Krita and do the following in a new document:

  1. Select calligraphy tool
  2. Enable "Use tablet angle" in the tool settings
  3. Draw horizontal, wavy strokes on the canvas with the pen tilted at ~45 degrees (relative to the tablet), and with the pen oriented at 12 o'clock, 1:30, and 3 o'clock relative to the top of the canvas.
  4. Disable "Use tablet angle" and draw the same strokes as in step 3.
  5. Visually confirm that the strokes drawn with "Use tablet angle" enabled do respond to pen angle, while strokes drawn with "Use tablet angle" disabled do not. This is the expected behaviour.

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 George Gianacopoulos

Merge request reports