Skip to content

Draft: Make font families into resources and improve related text property widgets.

This sorts fonts into families and makes those families into resources, as per discussion. Also wrote a blogpost.

text-properties-font-synthesis-small

text-properties-font-variable-font-small

Issues

  • [BLOCKING] Font refresh isn't working as expected, partially because Krita doesn't actually support refreshing the resources halfway through runtime. In particular, when adding a font file of a particular family, and then adding more in that same family, the font family resource isn't refreshed correctly. This may be because I don't understand the versioning system, but I'm unsure. We either find a way to fix this, or we drop the whole commit and set fontconfig refresh interval to 0, disabling the refresh.
  • [BLOCKING] Right now, the thumbnail (and the SVG data) is regenerated for each font family upon start, because I couldn't figure out where else to trigger it. This may be another instance of me not understanding the resource system.
  • [BLOCKING] I had to make the resource files into 'non-serializable' instead of 'ephemeral', as Krita was complaining about md5sums (even though I was not setting them). I am unsure what the effects of this are.
  • [BLOCKING] The fontregistery doesn't load when there's an existing resource database, and the database needs to be removed to work. It complains about KisStorageModel data query did not return anything
  • The tagging resource model is right now shared between dropdowns, which means each of them is affected by filtering. This is annoying, I might need to turn the tagging model into a QML element that is unique per font dropdown.
  • Similarly, tagging is not yet possible inside the font resource dropdown.
  • search is slow on font families because there's so many, I may need to figure out a way to implement a signal compressor.
  • while visually all the font labels can be localized, they can't be searched upon.
  • Similarly, finding a fontfamily based on string values is incomplete right now, and Krita is not always able to find the font.
  • The icons inside the dropdown are semi-randomly picked from the icons that already exist.
  • I'm using the text samples from QFontDatabase to generate the preview, but this is missing many text samples, and we need to figure out how to handle these better.
  • The style search for when values are changed could be better, and doesn't 100% work when italics are involved.
  • The sorting method for sorting fonts into font families could also be better. Of note is that variable fonts are now split out, which may not be desirable.

Test Plan

  • Delete resource database
  • Load Krita
  • Check text properties docker.
  • For checking out label localization, the majority of localized labels are available in default Microsoft fonts, in particular, the east-asian locales tend to have translated names available inside the font.

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!)
    • WWSRepresentation needs unittests, still.
  • 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?

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 Wolthera van Hövell

Merge request reports

Loading