Bug 464174

Summary: Add Watermark with text fails to process any items with some fonts.
Product: [Applications] digikam Reporter: Andrew Sayman <andrew.sayman>
Component: Plugin-Bqm-WaterMarkAssignee: Digikam Developers <digikam-bugs-null>
Status: CONFIRMED ---    
Severity: normal CC: caulier.gilles, metzpinguin
Priority: NOR    
Version: 7.9.0   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Andrew Sayman 2023-01-11 23:31:20 UTC
SUMMARY

I have recently moved to Windows 11. I'm setting up a new workflow and Adding a text watermark does not work. The error output and the debug view output is not useful. It's worth noting that the Watermark plugin works if I use an image instead of text. This is not some general failure where my system can't do any batch processing.


STEPS TO REPRODUCE
1. Add an image to the batch queue manager
2. Select Decorate -> Add Watermark
3. Click on text
4. Set the watermark text to 'a'
5. Click run

OBSERVED RESULT

The item fails to be processed.

18:21:43 :: Item "P1200861.jpg" from queue "#1": Processing...
18:21:43 :: Item "P1200861.jpg" from queue "#1": Failed to process item...
18:21:43 :: Item "P1200861.jpg" from queue "#1": 
18:21:43 :: Item "P1200861.jpg" from queue "#1": Failed to process item...
18:21:43 :: Item "P1200861.jpg" from queue "#1": Failed to create file...

In the debug view the only output is:

[5872] QLayout: Attempting to add QLayout "" to QWidget "", which already has a layout

EXPECTED RESULT

A new version of the image is generated which has 'a' somewhere in it.

SOFTWARE/OS VERSIONS
Windows: 11
Comment 1 Andrew Sayman 2023-01-11 23:40:24 UTC
It appears to have something to do with the font selection. When I pick fonts that begin in "MS," it fails with an empty error message. When I pick "Noto Sans," "Noto Serif," or "DejaVu Serif" then the watermark is successfully added.
Comment 2 Maik Qualmann 2023-01-12 07:39:42 UTC
It seems to be a bug in QFontMetrics. Also reproducible with "fixed" fonts. In the function for calculating the font size, the width of the bounding rect always remains the same as the font size increases.

Maik
Comment 3 caulier.gilles 2023-05-02 17:22:48 UTC
Maik, there is a UPSTREAM Qt bug about QFontMetrics ?
Comment 4 caulier.gilles 2023-10-15 08:13:05 UTC
@Andrew Sayman,

This problem still reproducible with the new digiKam 8.2.0 pre-release Windows
installer available at usual place:

https://files.kde.org/digikam/

This new bundle is based on last Qt framework 5.15.11 and KDE framework 5.110.

Thanks in advance

Gilles Caulier