Skip to content

Extend image shape and allow bitmap text to use image shape for text outlines.

This extends ImageShape to allow setting the image and viewport. It extends the factory to be able to generate a shape from the params. The goal here is to ensure that KoSVGTextShape's textOutline() can also provide shapes for bitmaps, like many Emoji fonts as well as older bitmap fonts.

This is useful for the font branch, but separated out to keep it simple to review.

This also scales gradients for the new shapes, so when gradients are used on text they are visually similar, which would make this MR fix woltherav/krita#61

Test Plan

Color Emoji:

  • Make a text with Noto Color Emoji (here the font that is not marked as ColrV1), tested with "", I also tested with dx="10,10,10,10" rotate="15,30,45,65"
  • Shape Editing Tool -> Convert to Shape.
  • Result: Sequence should become a groupshape with properly transformed ImageShapes.

image

Bitmap Font:

  • Make a 72DPI doc.
  • Make a text with a bitmap font (one of the ones that come default with Linux, or use Pixtura12 at size 12, also set textRendering to "optimizeSpeed"), don't forget to add some colors.
  • Shape Editing Tool -> Convert to Shape.
  • Result: Sequence of rectangles with the bitmap set as KoClipMask. You should be able to change the colors.

image

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!) ... Do we have relevant unittests for this?
  • 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