Bug 465055 - All PDFs are shown stretched in y-axis
Summary: All PDFs are shown stretched in y-axis
Status: CONFIRMED
Alias: None
Product: okular
Classification: Applications
Component: PDF backend (show other bugs)
Version: 22.08.3
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-30 20:52 UTC by pietz
Modified: 2024-05-07 15:19 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
A PDF with a circle (2.15 KB, application/pdf)
2023-01-31 15:48 UTC, pietz
Details
A screenshot how okular shows the circe as an ellipsis (38.93 KB, image/png)
2023-01-31 15:49 UTC, pietz
Details
Showing the difference of PNG vs PDF (same content) (75.05 KB, image/png)
2023-06-23 18:05 UTC, pietz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description pietz 2023-01-30 20:52:14 UTC
SUMMARY
All PDFs are shown in stretched a few percent in y-axis

STEPS TO REPRODUCE
1. Open a PDF. Compare it to e.g. firefox rendering
2. 
3. 

OBSERVED RESULT
Correct aspect ratio

EXPECTED RESULT
Stretched aspect ratio - a few percent in y-axis

SOFTWARE/OS VERSIONS
PDF Backend
Version 0.6.5
Comment 1 pietz 2023-01-31 15:48:17 UTC
Created attachment 155827 [details]
A PDF with a circle
Comment 2 pietz 2023-01-31 15:49:03 UTC
Created attachment 155828 [details]
A screenshot how okular shows the circe as an ellipsis

I added two images which demonstrate the bug.
Comment 3 Albert Astals Cid 2023-02-01 21:16:44 UTC
Your monitor is broken and reports wrong DPI.

I guess we should add a "My monitor is broken please ignore DPI" checkbox given how many people keep reporting issues like this
Comment 4 pietz 2023-02-02 07:40:34 UTC
Come on! I am not joking. Nice try :-)

When I open the PDF with Firefox or Gnome PDF viewer it is displayed perfectly round.
Comment 5 pietz 2023-02-02 07:50:09 UTC
Regarding your DPI idea: Even if there was a problem with DPI, the screenshot would "revert" this issue because a screenshot is not done on the monitor but on the graphics layer. Your assumption would only be correct if I had taken the picture with my smartphone.

This is definitely a bug within Okular or its backend.
Comment 6 Oliver Sander 2023-02-02 08:27:28 UTC
Well, even if it is, it must be something subtle, because most people see a rendering of the circle in just the way it should be.  Albert and me, for example.

Is your setup a laptop with a built-in screen?  Can you reproduce the problem if you use another screen?  Another computer?
Comment 7 pietz 2023-02-02 10:28:40 UTC
Most bugs all over the world are issued by special circumstances.

I use two tower computers with two monitors. Both have Kubuntu 22.10 but only one is displaying it wrong - the other one is displaying it as a circle.

The computer with the wrong displaying is using ppa-backports - the other one with the correct display has no ppa-backports.

Is there some logfile maybe where I can look into deep?
Comment 8 Oliver Sander 2023-02-02 10:36:08 UTC
What happens when you swap the monitors?
Comment 9 pietz 2023-02-02 10:44:36 UTC
You mean swapping left and right? Or swapping the computers?

Okular shows it as an ellipsis on both monitors. And Firefox e.g. shows it as a circle on booth monitors.

I can also go virtually on the monitor with rdesktop (which avoids he real monitor) and also see an ellipsis on this virtual screen. So I guess it is really drawn wrong on the graphics card rendering engine.
Comment 10 pietz 2023-02-02 10:46:32 UTC
Maybe deleting of some .local/config/share/pdf-backend-settings helps? Do you know, which folders contain stuff which might be interfering somehow? I could backup those files and search for differences?
Comment 11 Albert Astals Cid 2023-02-02 22:17:42 UTC
>  I am not joking.

Neither am I. Either the DPI of your monitor is borked or you're using a different resolution aspect ratio than the native resolution of your monitor.
Comment 12 pietz 2023-02-03 09:07:13 UTC
(In reply to Albert Astals Cid from comment #11)
> >  I am not joking.
> 
> Neither am I. Either the DPI of your monitor is borked or you're using a
> different resolution aspect ratio than the native resolution of your monitor.

And what is your explanation that Firefox and other PDF viewers show a circle on the same monitor? Can Firefox change the DPI in it's specific firefox-window-area? I told this now many times that only Okular has the problem and all other viewers (Firefox, LibreOffice, GIMP, ..) are all well rendering a circle.
Comment 13 Oliver Sander 2023-02-03 09:17:27 UTC
Relax.  This is just very difficult to debug without being able to reproduce it locally.

Access to dpi information is gathered in the method `realDpi` in the file `utils.cpp`.  Are you able to build your own Okular (it is not very difficult)? If so, this is the place to start looking.
Comment 14 pietz 2023-02-03 09:42:26 UTC
First off, THANKS for your always fast reply on my issue!

Compiling should not be a problem for me. Can you give me a hint, where to load the sources? But I guess, when I compile my own okular, it will display a circle - murphy's law :-)

But maybe, should I try to purge okular and reinstall it completely? Are there some hidden files with okular settings in my home directory?  Maybe its gone then? But then we will never find the source of the issue...
Comment 15 Oliver Sander 2023-02-03 09:47:43 UTC
Building Okular is described at https://okular.kde.org/build-it/

> But I guess, when I compile my own okular, it will display a circle - murphy's law :-)

That's possible.  But then you will have free time to fix some other Okular bug if you are interested.  There are lot's. :-)

BTW, have you checked whether your issue persists if you change from X11 to Wayland or vice versa?

I don't think hidden config files have anything to do with this, but I may be wrong.
Comment 16 pietz 2023-02-06 16:24:04 UTC
Hi,

I nearly get my git clone compiled. But I get the following error when linking:

/usr/bin/ld: /lib/x86_64-linux-gnu/libKF5GuiAddons.so.5: undefined reference to `QWaylandClientExtension::~QWaylandClientExtension()@Qt_5'


I use Qt 5.15.12 and actually have all (necessary) development packages in my kubuntu system. I also checked that installed libkf5guiaddons-dev on my system - yes it is!

What could might the solution to link it? Or can I somehow deactivate wayland in the cmake process (I use X11 and not Wayland on my system) to avoid the linking against wayland?
Comment 17 pietz 2023-05-04 16:10:05 UTC
Does no one have a hint for me?

I hoped for Kubuntu 23.04 but the bug is still there. I want to get rid of that scaling problem in every PDF :^)
Comment 18 pietz 2023-05-16 20:40:24 UTC
I also set up up a very new kubuntu system from stick and the stretching is still the same: circles as vertical ovals…
Comment 19 pietz 2023-05-17 07:14:02 UTC
Maybe it is because of the resolution of the monitors. They are both 1860 x 1050 pixels which is not so often the case in industry. Could that lead to an stretched display of PDFs?
Comment 20 pietz 2023-05-17 10:51:31 UTC
(In reply to pietz from comment #19)
> Maybe it is because of the resolution of the monitors. They are both 1860 x
> 1050 pixels which is not so often the case in industry. Could that lead to
> an stretched display of PDFs?

Sorry, it was a mistyping in the previous post. It is 1680 x 1050 (16:10 aspect ratio). Could that lead to the issue with the wrong display of all PDFs?
Comment 21 Oliver Sander 2023-05-17 20:24:32 UTC
Did you get Okular to build and link on your computer in the meantime?  My apologies,  but I am not the one who can help with linker problems.
Comment 22 pietz 2023-06-23 18:05:56 UTC
Created attachment 159866 [details]
Showing the difference of PNG vs PDF (same content)

(In reply to Oliver Sander from comment #21)
> Did you get Okular to build and link on your computer in the meantime?  My
> apologies,  but I am not the one who can help with linker problems.

Not yet. But I have additional and HELPFUL information:

I have two monitors with a "not so often appearing" aspect ratio. They are both 16:10 (1680x1050). Maybe this has something to do with it? Because the oval or ellipse is EXACTLY what a 16:9 ratio is doing. When I screenshot the ellipse and stretch it by a value of (10 / 9) I get exactly a circle (I tried it with a screenshot and stretching width from 9 untis to 10 units in GIMP).

It also appears that it ONLY happens to PDFs. I transformed my PDF with GIMP to a PNG and this is displayed as a circle. I attached a new screenshot with both files next to each other.

So my guess there is some calculation fixed to 16:9 monitors somehow?
Comment 23 Bug Janitor Service 2023-07-18 20:14:18 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/okular/-/merge_requests/781
Comment 24 Oliver Sander 2023-08-23 07:22:01 UTC
I would still be interested to see what your Utils::realDpi method does.  Have you been able to get your local Okular to link yet?

Looking at the code again I see that if the system reports different dpi for x and y (which are then ignored) it issues a warning:

  qCDebug(OkularCoreDebug) << "QScreen calculation returned a non square dpi." << res << ". Falling back";

Do you see this message when you enable Okular debug output with kdebugdialog5?
(KDE gurus: please correct me if something else is needed to enable the warning).
Comment 25 pietz 2023-10-07 10:59:30 UTC
I have an interesting update. The bug (or the scaling issue) only exists, when you open a PDF through a click in dolphin or when you open a file in okular directly. But when you drag a PDF into an already opened instance of okular, the aspect ratio is CORRECT!

So, the circle.pdf in the attachment shows an ellipsis when opened directly and it is shown as a real circle when you drop the PDF file in the middle of the okular window.

Maybe we can nail it down somehow with this new interesting fact?
Comment 26 pietz 2023-10-07 13:56:45 UTC
Oh, its even more easy: When I press F5 for reload, the circle draws round when the whole PDF is redrawn. So it has to do something with the FIRST loading of the PDF...
Comment 27 pietz 2024-05-07 15:19:27 UTC
Since Okular Version 23.08.5 (fresh install of Kubuntu 24.04) the "hack" with a reload doesn't work anymore. It is now always stretched...
Can no one else reproduce this?