Bug 413394 - An option to set font size
Summary: An option to set font size
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Unclassified
Component: Digital Clock (show other bugs)
Version: master
Platform: Other Linux
: NOR wishlist
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: usability
Depends on:
Blocks:
 
Reported: 2019-10-24 13:47 UTC by alex285
Modified: 2022-07-27 18:23 UTC (History)
11 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.26
nate: Usability-
g-a-d: VisualDesign+


Attachments
a screen with the issue (1.17 MB, image/png)
2019-10-24 13:47 UTC, alex285
Details
vertical panel, large font (838.43 KB, image/jpeg)
2022-06-05 03:29 UTC, Jin Liu
Details
vertical panel, small font (840.27 KB, image/jpeg)
2022-06-05 03:29 UTC, Jin Liu
Details
Patch on 5.25beta to add font size settings (3.68 KB, patch)
2022-06-06 03:32 UTC, Jin Liu
Details
Screenshot of the patch (509.76 KB, image/jpeg)
2022-06-06 03:37 UTC, Jin Liu
Details

Note You need to log in before you can comment on or make changes to this bug.
Description alex285 2019-10-24 13:47:59 UTC
Created attachment 123457 [details]
a screen with the issue

Digital clock Applet it is super huge even when we set the date (which btw i believe it should be a default option), and while there is an option to change the font, there is not an option to change the size
Comment 1 Nate Graham 2019-10-24 18:56:25 UTC
The Event Calendar widget does this, but people keep asking for this to be built into the default Digital Clock widget. I think it's probably inevitable.
Comment 2 alex285 2019-10-24 20:00:07 UTC
(In reply to Nate Graham from comment #1)
> The Event Calendar widget does this, but people keep asking for this to be
> built into the default Digital Clock widget. I think it's probably
> inevitable.

it is funny you say, because I related that issue to Event Calendar on a video[1], and i hope it is inevitable because Event Calendar is a great addition! i dont know its codebase if it is active developed etc, but i guess it will gain more attention if it becomes by default

although there should be some re-write on options perhaps
 

[1]https://youtu.be/0npewm2YvNo
Comment 3 Tristan Miller 2021-02-25 08:30:08 UTC
(In reply to alex285 from comment #0)
> Created attachment 123457 [details]
> a screen with the issue
> 
> Digital clock Applet it is super huge even when we set the date (which btw i
> believe it should be a default option), and while there is an option to
> change the font, there is not an option to change the size

I liked the super-huge time display because it was easy to read.  After updating Plasma today on my openSUSE Tumbleweed installation, I find that the time is now displayed in a small font (the same size as the date) and so no longer so easy to see at a distance.

It would be great if this change to the default styling could be reverted, or else for this feature request about setting the font size be implemented.
Comment 4 Justin Zobel 2021-06-13 12:07:47 UTC
I'd also like to see this added. Especially with the one-liner option now, the clock takes up excessive space. I want to keep the one-liner but have it smaller.
Comment 5 kderemie 2021-08-08 23:48:33 UTC
The only thing off about an otherwise truly gorgeous taskbar is the damnable clock!

At a height of 34px, even a "General" font size of 7px looks too large, not to mention everything else becomes entirely unreadable at that size. A separate option for this is a small thing, but it would go a huuuuge way towards polish. It's like the last missing piece.
Comment 6 Nate Graham 2021-08-09 01:50:25 UTC
If you find that the clock text/digits are too big, you might try putting Margins Separator widgets around it in the panel.
Comment 7 kderemie 2021-08-10 02:40:18 UTC
Thanks for your reply Nate. Unfortunately I tried it and it didn't seem to have any effect on the size of the clock widget or its font. For now what I've done is simply reverted to using the two-line time/date style, which seems the only way to get the font to a reasonable size. 

I think since the option to hide the date is available, changing font size to match should hopefully follow one day.
Comment 8 Gianluca Pettinello 2021-08-10 14:02:30 UTC
workaround
file: DigitalClock.qml

        State {
            name: "oneLineDate"
            // the one-line mode has no effect on a vertical panel because it would never fit
            when: plasmoid.formFactor !== PlasmaCore.Types.Vertical && main.oneLineMode

            PropertyChanges {
                target: main
                Layout.fillHeight: true
                Layout.fillWidth: false
                Layout.minimumWidth: contentItem.width
                Layout.maximumWidth: Layout.minimumWidth

            }

            PropertyChanges {
                target: contentItem

                height: sizehelper.height
                width: dateLabel.width + dateLabel.anchors.rightMargin + labelsGrid.width
            }

            AnchorChanges {
                target: labelsGrid

                anchors.right: contentItem.right
            }

            PropertyChanges {
                target: dateLabel

                height: timeLabel.height
                width: dateLabel.paintedWidth + PlasmaCore.Units.smallSpacing

                font.pixelSize: 20 //workaround
                verticalAlignment: Text.AlignVCenter
                anchors.rightMargin: labelsGrid.columnSpacing

                fontSizeMode: Text.VerticalFit
            }

            AnchorChanges {
                target: dateLabel

                anchors.right: labelsGrid.left
                anchors.verticalCenter: labelsGrid.verticalCenter
            }

            PropertyChanges {
                target: timeLabel

                height: sizehelper.height
                width: sizehelper.contentWidth

                font.pixelSize: 20 //workaround
                fontSizeMode: Text.VerticalFit
            }
Comment 9 xgdgsc 2022-04-26 06:19:42 UTC
With some fonts like "Snap ITC" and show seconds enabled, the width of this widget changes with time seconds changing, causing the whole task bar moves horizontally every second.
Comment 10 Jin Liu 2022-06-05 03:29:24 UTC
Created attachment 149471 [details]
vertical panel, large font
Comment 11 Jin Liu 2022-06-05 03:29:53 UTC
Created attachment 149472 [details]
vertical panel, small font
Comment 12 Jin Liu 2022-06-05 03:35:48 UTC
(In reply to xgdgsc from comment #9)
> With some fonts like "Snap ITC" and show seconds enabled, the width of this
> widget changes with time seconds changing, causing the whole task bar moves
> horizontally every second.

One similar issue is, in a vertical panel, the font size varies widely between one-digit and two-digit hours. (see attachments above)
Comment 13 Jin Liu 2022-06-06 03:32:40 UTC
Created attachment 149501 [details]
Patch on 5.25beta to add font size settings

This is a patch on 5.25 beta. It adds an option (in digital clock's configuration - appearence) to set font size. I'll try to submit it later.

To apply it:
> sudo bash
> cd /usr/share/plasma/plasmoids/org.kde.plasma.digitalclock/contents
> patch -p1 < digitalclock-fontsize.patch
> # restart plasmashell (systemctl --user restart plasma-plasmashell.service)

I don't know if this applies on 5.24, but you can have a try.

However, it doesn't fix the other problem mentioned above:
> With some fonts like "Snap ITC" and show seconds enabled, the width of this
> widget changes with time seconds changing, causing the whole task bar moves
> horizontally every second.
I guess this requires much greater change, where the widget should remember its max width (when displaying 23:59:59 perhaps) and don't resize every second.
Comment 14 Jin Liu 2022-06-06 03:37:48 UTC
Created attachment 149502 [details]
Screenshot of the patch
Comment 15 Bug Janitor Service 2022-06-06 04:53:35 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/1809
Comment 16 Nate Graham 2022-07-27 18:23:19 UTC
Git commit e94e21f2590a937398fe8fe60ae0aae0279e002f by Nate Graham, on behalf of Jin Liu.
Committed on 27/07/2022 at 18:23.
Pushed by ngraham into branch 'master'.

applets/digital-clock: add a font size setting

This allows the user to choose between automatically determined font size
(the default, and the current behavior), and completely manual font settings.

The UI refactor and layout code changes necessary for this feature also
happily fix a few bugs along the way.
Related: bug 421548, bug 395468
FIXED-IN: 5.26

M  +16   -0    applets/digital-clock/package/contents/config/main.xml
M  +56   -55   applets/digital-clock/package/contents/ui/DigitalClock.qml
M  +62   -65   applets/digital-clock/package/contents/ui/configAppearance.qml

https://invent.kde.org/plasma/plasma-workspace/commit/e94e21f2590a937398fe8fe60ae0aae0279e002f