Bug 141592

Summary: Position of inserted text is not exact [patch]
Product: [Applications] digikam Reporter: Daniel Bauer <linux>
Component: Plugin-Editor-InsertTextAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles, metzpinguin, scl+kde
Priority: NOR    
Version: 0.9.1   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In: 4.14.0
Sentry Crash Report:
Bug Depends on:    
Bug Blocks: 181813    
Attachments: text placed in "insert-text"-tool
text as finally inserted (viewed in editor)
textwidget.patch
textwidget2.patch

Description Daniel Bauer 2007-02-12 15:03:54 UTC
Version:           0.9.1svn (using KDE KDE 3.5.6)
Installed from:    SuSE RPMs
OS:                Linux

When using the insert-text tool, the text is not inserted at the exact position (at least with turned 270°). See attached screenshots.
Comment 1 Daniel Bauer 2007-02-12 15:04:56 UTC
Created attachment 19639 [details]
text placed in "insert-text"-tool
Comment 2 Daniel Bauer 2007-02-12 15:06:55 UTC
Created attachment 19640 [details]
text as finally inserted (viewed in editor)

the text was placed in the right bottom corner of an image (see attachement
textins1.png), but it is inserted slightly more below, so that the beginning is
cut off.
Comment 3 Andi Clemens 2008-08-21 09:48:34 UTC
I can confirm this, but this doesn't apply only to rotated text, it happens all the time.
To reproduce:

1. set some white text onto the image
2. apply filter
3. restart the filter, change color to red for example
4. you'll see that the "text widget" on the left has moved slightly to the left and down

This seems to be the "real" position of the text, I think the preview on the left isn't synchronized correctly with the position of the text. I'll take a look on this.

Andi
Comment 4 Andi Clemens 2008-08-23 15:23:00 UTC
I guess we can't do anything about this right now because we calculate the position from the preview widget. Since operations with float and double will be not absolutely precise, it can happen that the text is not positioned correctly.

Maybe this will work better when all filters are ported to the new image editor so that we can work on the original image size?

Andi
Comment 5 caulier.gilles 2008-12-06 18:09:14 UTC
Andi,

What's news about this file ?

Gilles Caulier
Comment 6 Andi Clemens 2008-12-06 18:14:33 UTC
Nothing new :-(
Worked on that 1 week ago, I don't know where we are loosing precision. I tried everything, even working on the pure original image data (not the preview data), somehow the text is not exactly set.

Andi
Comment 7 caulier.gilles 2011-12-17 19:03:34 UTC
*** Bug 276626 has been marked as a duplicate of this bug. ***
Comment 8 Maik Qualmann 2015-10-06 20:39:19 UTC
Created attachment 94865 [details]
textwidget.patch

This patch fixes the different font size and / or text position. The Qt function setPointSizeF() not working correctly on all platforms. We need first render the text to original size and then scale the pixmap to preview size.

Maik
Comment 9 caulier.gilles 2015-10-07 04:02:39 UTC
Comment on attachment 94865 [details]
textwidget.patch

Perfect fix. Tested here and all work better now.

Gilles
Comment 10 Maik Qualmann 2015-10-07 18:46:21 UTC
Created attachment 94879 [details]
textwidget2.patch

Patch for commit.

Maik
Comment 11 Maik Qualmann 2015-10-07 19:00:09 UTC
Git commit bc91c372df147edcd5c7335cdc8c151a5de4d3a2 by Maik Qualmann.
Committed on 07/10/2015 at 18:58.
Pushed by mqualmann into branch 'master'.

apply patch #94879 to fix the different font size and / or text position
FIXED-IN: 4.14.0

M  +2    -1    NEWS
M  +90   -58   imageplugins/decorate/inserttextwidget.cpp
M  +1    -1    imageplugins/decorate/inserttextwidget.h

http://commits.kde.org/digikam/bc91c372df147edcd5c7335cdc8c151a5de4d3a2
Comment 12 caulier.gilles 2015-10-10 08:44:13 UTC
Git commit 33430f9c6ab86541fc67b106a04d8339bebe4eac by Gilles Caulier.
Committed on 10/10/2015 at 08:43.
Pushed by cgilles into branch 'frameworks'.

backport commit #bc91c372df147edcd5c7335cdc8c151a5de4d3a2 from git/master to frameworks branch

M  +96   -63   imageplugins/decorate/inserttextwidget.cpp
M  +1    -1    imageplugins/decorate/inserttextwidget.h

http://commits.kde.org/digikam/33430f9c6ab86541fc67b106a04d8339bebe4eac