Skip to content

Fix `kerning` property handling and add toggle button in text editor

Lucid Sunlight requested to merge awakening/krita:text-kerning into master

KoSvgTextProperties::parseSvgTextAttribute expects auto|<length> value during parsing, but conversions between SVG and TextDocument used normal|<length>, resulting into kerning always defaulting to 0 when saving text objects.

Now:

  • auto, enables kerning.
  • 0, disables kerning.
  • values bigger than 0, disables kerning and adds current value to letter-spacing.
  • percentage values, don't seem to work well in general at the moment, will eventually apply consistent letter spacing (after 3-4 saves), but then lose it when switched to Rich text.

Now that it handles properly, kerning is now enabled by default, previously it was practically disabled (new text object would have it enabled, but then any save would disable it).

Screenshots
  • Example of kerning off and on

    kerning-off-on

  • Main editor window

    text-editor

  • Format menu

    format-menu

Test Plan

  • Pick Noto Sans or any other font with kerning.
  • Create a Placeholder Text.
  • While looking at Text, click Save.
  • Have kerning still enabled and see no visual changes.
  • Toggle kerning on and off and see a visual change.

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.

Merge request reports