Bug 439470

Summary: KFontView is unable to open or install a font on Wayland
Product: [Applications] kfontview Reporter: Patrick Silva <bugseforuns>
Component: generalAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: adam, almazgaliev99, amgadelsaiegh, andydecleyre, bbaster, bizyaev, boba_fit, bribbers, bugs, cdennett, coderjoe05, demm, doankimhuy.it, eseifert, f.alexander.wilms, flying-sheep, ftefrjbhfvasf32, goeran, hasezoey, ilgaz, ivan, j.oster+5f2vykb9, jsonkoba, k2squared, kde, kde, martin.tlustos, maxpatera, mtjhrj, nate, oldherl, philipp.reichmuth, postix, public.paul.meier+kde, rdieter, reverier.xu, rm, sgtnasty, skierpage, sunspark, tgh6407, thenerdiestguy, yatian.liu.98, yvan, zawertun
Priority: VHI Keywords: wayland
Version: 5.27.6   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=439375
Latest Commit: Version Fixed In: 6.0
Sentry Crash Report:
Attachments: screenshot

Description Patrick Silva 2021-07-04 12:03:59 UTC
Created attachment 139843 [details]
screenshot

STEPS TO REPRODUCE
1. use Wayland session
2. double-click on a font file in Dolphin or right-click on it and choose
"Open with > KFontView"
3. 

OBSERVED RESULT
I get "Could not read font." error message (see the attached screenshot)
and the font can not be installed.

EXPECTED RESULT
KFontView is able to install a font on Wayland.

SOFTWARE/OS VERSIONS
Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.22.80
KDE Frameworks Version: 5.84.0
Qt Version: 5.15.3
Graphics Platform: Wayland
Comment 1 Sam 2021-11-23 14:50:55 UTC
I have the same issue, kfontview works when using X11. KDE Plasma 5.23.3, Frameworks 5.88.0, Qt 5.15.2 (Huh, same as kernel). Graphics platform is Wayland.
Comment 2 skierpage 2021-12-08 05:48:50 UTC
This is a serious bug, but I can't change its Importance.

The workaround (for me, in Fedora 35 KDE spin) to run kfontview under XWayland is to enter `QT_QPA_PLATFORM=xcb kfontview` in a terminal. Then Help > About Font Viewer > Components displays "The xcb windowing system", and I can open and view .ttf font files.
Comment 3 Doan Kim Huy 2021-12-29 01:04:39 UTC
Any updates on this bug? It is still here in Plasma 5.23.4, KDE Frameworks 5.89, Qt 5.15.2.
Comment 4 Joe Cardenas 2022-01-05 15:35:00 UTC
(In reply to Doan Kim Huy from comment #3)
> Any updates on this bug? It is still here in Plasma 5.23.4, KDE Frameworks
> 5.89, Qt 5.15.2.

Work is ongoing. 
There's this merge request: https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/1279 which should re-enable the font manager. Previews still don't work, but, as far as I understand, that should fix installing fonts.
Comment 5 Patrick Silva 2022-01-19 13:46:39 UTC
*** Bug 448753 has been marked as a duplicate of this bug. ***
Comment 6 gene c 2022-03-27 22:24:14 UTC
Fails for me as well with 5.24.3 (wayland on Archlinux).
Comment 7 phrxmd 2022-05-13 07:19:29 UTC
Can reproduce under Plasma 5.24.5 on OpenSUSE TW.
Comment 8 Patrick Silva 2022-05-23 01:47:51 UTC
*** Bug 454222 has been marked as a duplicate of this bug. ***
Comment 9 Patrick Silva 2022-07-04 15:38:35 UTC
*** Bug 456311 has been marked as a duplicate of this bug. ***
Comment 10 bbaster 2022-08-07 15:10:09 UTC
Starting KFontView with the environment variable QT_QPA_PLATFORM=xcb works as a workaround on a Wayland session.
Comment 11 Patrick Silva 2022-08-13 00:56:35 UTC
*** Bug 457819 has been marked as a duplicate of this bug. ***
Comment 12 Patrick Silva 2022-08-22 12:25:33 UTC
*** Bug 458149 has been marked as a duplicate of this bug. ***
Comment 13 Boba Fit 2022-10-21 12:17:14 UTC
Still a bug in Plasma 5.26.1
Comment 14 Philipp A. 2022-11-03 14:14:52 UTC
Workaround:

1. run `cp /usr/share/applications/org.kde.kfontview.desktop ~/.local/share/applications/`
2. Change the `Exec` line to `Exec=QT_QPA_PLATFORM=xcb kfontview %U`
Comment 15 oldherl 2023-04-06 02:00:27 UTC
*** Bug 468188 has been marked as a duplicate of this bug. ***
Comment 16 Martin van Es 2023-04-24 20:34:33 UTC
Since Wayland is now ubiquitous and default for allmost all distributions, could somebody have a look at this bug again?

Operating System: Kubuntu 23.04
KDE Plasma Version: 5.27.4
KDE Frameworks Version: 5.104.0
Qt Version: 5.15.8
Kernel Version: 6.3.0 (64-bit)
Graphics Platform: Wayland
Processors: 8 × Intel® Core™ i7-10510U CPU @ 1.80GHz
Memory: 31.1 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics
Manufacturer: Notebook
Product Name: N141CU
System Version: Not Applicable
Comment 17 Patrick Silva 2023-05-29 16:45:24 UTC
*** Bug 470422 has been marked as a duplicate of this bug. ***
Comment 18 Peter 2023-05-29 21:32:20 UTC
(In reply to Patrick Silva from comment #17)
> *** Bug 470422 has been marked as a duplicate of this bug. ***

What's interesting about this one being closed, is that I actually am on x.org, not wayland.. so, the bug affecting truetype fonts from fonts.google.com is applicable to both x.org and wayland. Curiously, truetype fonts from non-fonts.google.com sources work just fine in the viewer and font management. There must be some sort of flag or header formatting that google is doing to the file that the component doesn't know how to parse. Windows does not have the issue.
Comment 19 Peter 2023-05-30 23:47:41 UTC
Replying to myself here, the issue in comment 18 has been resolved. One needs to make sure fonts.googleapis.com is not being blocked when the zip file is being created.
Comment 20 Patrick Silva 2023-07-13 17:09:42 UTC
*** Bug 472229 has been marked as a duplicate of this bug. ***
Comment 21 Bug Janitor Service 2023-09-15 20:29:24 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/3290
Comment 22 Kai Uwe Broulik 2023-10-20 16:36:05 UTC
Git commit 5c5bba6d8d6c289d6de3536ba77edf839ba42170 by Kai Uwe Broulik.
Committed on 20/10/2023 at 18:20.
Pushed by broulik into branch 'master'.

kcms/kfontinst: Open own X connection when not running under X

Ensures that it at least somewhat works on Wayland.

While at it, ports xcb_image back to XImage so we only need an Xlib display.

M  +1    -2    kcms/kfontinst/lib/CMakeLists.txt
M  +46   -35   kcms/kfontinst/lib/FcEngine.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/5c5bba6d8d6c289d6de3536ba77edf839ba42170
Comment 23 skierpage 2023-11-23 09:37:48 UTC
The patch just calls Qt's X11 support directly. So I suspect it will only work under Wayland if the system is running the XWayland compatibility code.
Comment 24 Patrick Silva 2024-02-15 22:39:52 UTC
*** Bug 481371 has been marked as a duplicate of this bug. ***
Comment 25 Patrick Silva 2024-02-27 09:51:27 UTC
*** Bug 481884 has been marked as a duplicate of this bug. ***
Comment 26 Kai Uwe Broulik 2024-02-27 09:52:32 UTC
Yes. Reworking the font management to be independent of X is a whole different story. I am working on it but it will take a lot of effort, so I won't promise it will be done soon.
Comment 27 postix 2024-05-04 12:23:06 UTC
(In reply to Kai Uwe Broulik from comment #26)
> Yes. Reworking the font management to be independent of X is a whole
> different story. I am working on it but it will take a lot of effort, so I
> won't promise it will be done soon.

When you do so, will you also consider the security issues mentioned in [1] too? :)

[1] https://security.opensuse.org/2024/04/02/kde6-dbus-polkit.html#legacy-fontinst-d-bus-service