Bug 491041 - Clock Widget Does not Respect DPI Scaling
Summary: Clock Widget Does not Respect DPI Scaling
Status: RESOLVED WORKSFORME
Alias: None
Product: plasmashell
Classification: Plasma
Component: Digital Clock widget (show other bugs)
Version: master
Platform: Other Linux
: NOR minor
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-30 22:48 UTC by Nick
Modified: 2024-08-31 03:48 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
"Automatic" size on a 100% scale display (this system otherwise also uses 150% scaling) (19.44 KB, image/png)
2024-07-30 22:48 UTC, Nick
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nick 2024-07-30 22:48:13 UTC
Created attachment 172134 [details]
"Automatic" size on a 100% scale display (this system otherwise also uses 150% scaling)

SUMMARY
The font scaling on the digital clock widget does not seem to respect DPI scaling, so when switching displays, it can sometimes appear too large or too small, depending on the selected font settings. 

STEPS TO REPRODUCE
1. Set the font size in the digital clock widget to an appropriate size on a display at 100% scaling. 
2. Switch to a monitor that uses, say, 150% scaling
3. The inverse will produce the same basic bug

OBSERVED RESULT
When switching to a display with different scaling, the text will appear either too large or too small. 

EXPECTED RESULT
The font size should scale appropriately with the display DPI settings.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Fedora 40 KDE Spin
(available in About System)
KDE Plasma Version: 6.1.3
KDE Frameworks Version: 6.4.0
Qt Version: 6.7.2

ADDITIONAL INFORMATION
Kernel 6.9.11-200.fc40.x86_64
Comment 1 Nate Graham 2024-07-31 03:51:07 UTC
I don't see the issue in the screenshot. Maybe pairing it with a "before" image would help?

Regardless the clock itself definitely respects the system's scale factor. Are you seeing the same issue without manually overriding the font size? If not, then what you're seeing is caused by your use of a manual font size override.
Comment 2 Nick 2024-07-31 15:36:14 UTC
(In reply to Nate Graham from comment #1)
> I don't see the issue in the screenshot. Maybe pairing it with a "before"
> image would help?
> 
> Regardless the clock itself definitely respects the system's scale factor.
> Are you seeing the same issue without manually overriding the font size? If
> not, then what you're seeing is caused by your use of a manual font size
> override.

Hey Nate, perhaps there's some other bugginess going on that's not directly related to scaling, but here's what I'm experiencing.

If I set the size to Auto, it does this, which I have to imagine is incorrect, since it's comically oversized compared to the status bar icons on the panel (this is at 100%, but has the same behavior at 150%):
https://i.imgur.com/lzNnPoF.png

So I manually set the font size to 7pt, which on 150% scaling looks like this:
https://i.imgur.com/Mez6ILU.png

But then on 100% scaling, it looks like this:
https://i.imgur.com/VubfHUK.png

I've left it there since that's the only "happy medium" I can find. Still, I would think a font *point* setting should scale with the display DPI anyway, and the Auto size seems way off. Auto would probably work fine if there were more "padding" around it I think? 

Hope this helps
Comment 3 Nate Graham 2024-07-31 18:36:15 UTC
The "Auto" size is actually correct since you have the clock in its (default) two-row mode. It's large to ensure that the text remains readable. If you force the text to display in single-row mode, you'll see that the text becomes much smaller, and should be approximately the height of the System Tray icons.

Before we proceed, can you confirm that?

And if you can confirm it, can you try manipulating the scale between 100% and 150% to see if the text remains the same height, or if it exhibits the original issue you're reporting?
Comment 4 Nick 2024-07-31 18:39:36 UTC
(In reply to Nate Graham from comment #3)
> The "Auto" size is actually correct since you have the clock in its
> (default) two-row mode. It's large to ensure that the text remains readable.
> If you force the text to display in single-row mode, you'll see that the
> text becomes much smaller, and should be approximately the height of the
> System Tray icons.
> 
> Before we proceed, can you confirm that?
> 
> And if you can confirm it, can you try manipulating the scale between 100%
> and 150% to see if the text remains the same height, or if it exhibits the
> original issue you're reporting?

Switching to Single row is done by disabling the "Show date" checkbox, right? I just tried that, it appears to have the opposite effect and made the text size even larger:
https://i.imgur.com/7pJMYqC.png
Comment 5 Nate Graham 2024-07-31 18:41:51 UTC
Should be:

Information: [x] Show Date [Always beside time]

Note that it's only visible on horizontal panels.
Comment 6 Nick 2024-07-31 18:48:02 UTC
(In reply to Nate Graham from comment #5)
> Should be:
> 
> Information: [x] Show Date [Always beside time]
> 
> Note that it's only visible on horizontal panels.

Hmm yeah, same behavior doing that:

https://i.imgur.com/kVNeCDn.png
Comment 7 Nick 2024-07-31 18:53:07 UTC
Okay, I think I can confirm this is probably a bug stemming elsewhere and not necessarily from DPI switching or even the settings specifically on the Digital Clock widget. I just added a new default panel, and we get different behavior with the clock widget:

https://i.imgur.com/omlKofR.png

Above is the new panel, below is the old panel. Not sure what's different about the current panel config that's causing the clock widget to act funky, but there's something!
Comment 8 Nick 2024-07-31 18:59:09 UTC
(In reply to Nick from comment #7)
> Okay, I think I can confirm this is probably a bug stemming elsewhere and
> not necessarily from DPI switching or even the settings specifically on the
> Digital Clock widget. I just added a new default panel, and we get different
> behavior with the clock widget:
> 
> https://i.imgur.com/omlKofR.png
> 
> Above is the new panel, below is the old panel. Not sure what's different
> about the current panel config that's causing the clock widget to act funky,
> but there's something!

Ah disregard. Sorry for the double-ping, but the difference I was seeing was just the result of the panel heights being different. It definitely still gets weirdly huge in Auto size mode.
Comment 9 Nate Graham 2024-07-31 20:22:57 UTC
Pretty sure I know what's going on. Is your Digital Clock widget in between two "Margins Separator" widgets? Make sure both the System Tray and Clock are between them. This is the way it is on a default panel. I'm guessing on your custom panel, the Digital Clock is outside of the area between two of those, or else there's only one of them.
Comment 10 Nick 2024-07-31 20:35:39 UTC
(In reply to Nate Graham from comment #9)
> Pretty sure I know what's going on. Is your Digital Clock widget in between
> two "Margins Separator" widgets? Make sure both the System Tray and Clock
> are between them. This is the way it is on a default panel. I'm guessing on
> your custom panel, the Digital Clock is outside of the area between two of
> those, or else there's only one of them.

That did help a bit! Not sure why the margins separator make a difference there but I'm not complaining. I think the other factor here is I am/was running a larger panel height, and it seems like the clock widget might be scaling up a little disproportionately. When switching the panel height from 46 > 48 > 50px, the clock seems to grow more than the tray icons, but it's not that big of a deal. I think for now I'll bring the panel height down and between that and adding the margins separator widgets, it'll be a good happy medium. 

I do still think the manual type setting should scale with the screen DPI though; that would allow the user to fine-tune the size and it be consistent in relation to the panel size, regardless of which screen they're connected to. But that's just me!
Comment 11 Nate Graham 2024-08-01 15:49:56 UTC
Ok cool. So now can you share two screenshots, one at 100% scale and one at 250% scale, each showing the clock in the following configuration:

- Panel thickness: 40
- Clock and System Tray both between two Margin Separator widgets
- Date beside time
- Text point size manually forced to 50


And then two more again with the point size at 7?

Thanks a lot!
Comment 12 Bug Janitor Service 2024-08-16 03:47:10 UTC
🐛🧹 ⚠️ This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information, then set the bug status to REPORTED. If there is no change for at least 30 days, it will be automatically closed as RESOLVED WORKSFORME.

For more information about our bug triaging procedures, please read https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging.

Thank you for helping us make KDE software even better for everyone!
Comment 13 Bug Janitor Service 2024-08-31 03:48:00 UTC
🐛🧹 This bug has been in NEEDSINFO status with no change for at least 30 days. Closing as RESOLVED WORKSFORME.