Created attachment 172733 [details] OBSERVED and EXPECTED RESULT SUMMARY The text size of keyboard layout plasmoid in some languages (e.g persian[ir]) is inconsistent. This bug is visible when panel height is high (e.g 52). refer to attachment. STEPS TO REPRODUCE 1. Add persian keyboard layout 2. add system tray plasmoid to panel 3. resize panel to 52 OBSERVED RESULT very big "ir" versus small other icons EXPECTED RESULT same size as "us" or other system tray icons. SOFTWARE/OS VERSIONS Operating System: Arch Linux KDE Plasma Version: 6.1.4 KDE Frameworks Version: 6.5.0 Qt Version: 6.7.2 Graphics Platform: Wayland ADDITIONAL INFORMATION The problem arise from /usr/share/plasma/plasmoids/org.kde.plasma.keyboardlayout/contents/ui/main.qml. "font.pointSize" at line 89 is set to "height" which I think should change.
Can reproduce. I'm pretty sure of what's going on here: because the System Tray allocates the same square area for every applet, when the Latin letters for the current language are taller than they are wide, the text vertically fills the space rather than horizontally filling the space, and the the font size ends up larger than when the text is wider than it is long (e.g. with something like "us"). The effect is even more pronounced with Hebrew, which gets the Latin abbreviation "il". That's even narrower than "ir"! And if I add Latin American Spanish with the code "lat", then the text is small because it has to fit into the same box. We could set a maximum text size so that it can't be quite so tall when the letters are narrow, but we can't make the size fixed or else longer codes would overflow.
(In reply to Nate Graham from comment #1) > Can reproduce. I'm pretty sure of what's going on here: because the System > Tray allocates the same square area for every applet, when the Latin letters > for the current language are taller than they are wide, the text vertically > fills the space rather than horizontally filling the space, and the the font > size ends up larger than when the text is wider than it is long (e.g. with > something like "us"). > > The effect is even more pronounced with Hebrew, which gets the Latin > abbreviation "il". That's even narrower than "ir"! And if I add Latin > American Spanish with the code "lat", then the text is small because it has > to fit into the same box. > > We could set a maximum text size so that it can't be quite so tall when the > letters are narrow, but we can't make the size fixed or else longer codes > would overflow. Thanks for your reply. I've set {font.pointSize} to {Math.max(root.height * 0.4)} and seems to be kina OK for "li",''fa" and they are same size "us", but layouts like "lat" or "apl" are smaller than normal. so it is not the best design. The another solution is that user change font size like digital clock widget which I don't think it is that much "better". Why don't we consider display text to be all two or three letters? for example to embrace ISO 639 language codes. In this case we have more control on font size. Also in keyboard layout context we're talking about languages than countries. For instance If I also install "Kurdish (Iran, Arabic-Latin)" and "Persian" for both of them the text display is "ir" and it is hard to distinguish them. and these are different languages.
The language code is actually user-configurable, or at least it will be in Plasma 6.2. Anyway, it sounds like you've done some work on this; would you be interested in submitting a patch?
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-desktop/-/merge_requests/2456
Git commit be73656d68bbc5c60de46cbf5be2af4a99f730c9 by Nate Graham, on behalf of Sauf Lvc. Committed on 23/08/2024 at 16:36. Pushed by ngraham into branch 'master'. applets/keyboardlayout: Constrain text label to lower of width or height This fixes the problem of the text changing size while switching due to Latin letters having different heights and widths. FIXED-IN: 6.2.0 M +5 -1 applets/keyboardlayout/contents/ui/main.qml https://invent.kde.org/plasma/plasma-desktop/-/commit/be73656d68bbc5c60de46cbf5be2af4a99f730c9