Bug 497116 - Unable to open font on Wayland
Summary: Unable to open font on Wayland
Status: RESOLVED UPSTREAM
Alias: None
Product: kfontview
Classification: Applications
Component: general (show other bugs)
Version: 6.2.4
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL: https://gitlab.freedesktop.org/xorg/l...
Keywords:
Depends on:
Blocks:
 
Reported: 2024-12-06 03:58 UTC by dantmnf
Modified: 2024-12-19 07:22 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dantmnf 2024-12-06 03:58:06 UTC
SUMMARY
The kfontview and kcm_fontinst is broken (again) on Wayland

STEPS TO REPRODUCE
1. Start a Plasma Wayland session
2. Use kfontview to open a random font

OBSERVED RESULT

% kfontview /usr/share/fonts/noto/NotoSans-Regular.ttf
kf.xmlgui: cannot find .rc file "kfontviewpart.rc" for component "kfontviewpart"
kf.kio.core: Url QUrl("file:///usr/share/fonts/noto/NotoSans-Regular.ttf") already represents a local file, cancelling job.
X Error of failed request:  BadLength (poly request too large or internal Xlib length error)
  Major opcode of failed request:  139 (RENDER)
  Minor opcode of failed request:  20 (RenderAddGlyphs)
  Serial number of failed request:  19
  Current serial number in output stream:  374

Similarly, the kcm_fontinst will crash kcmshell or systemsettings:
% systemsettings kcm_fontinst
Service  org.kde.fontinst  not registered, starting "/usr/lib/kf6/kauth/fontinst"
qml: Page SubCategoryPage_QMLTYPE_130(0x5b61530315b0) is already in the PageRow
qml: Pushed pages do not conform to the rules. Please check the documentation.
qml: push (file:///usr/lib/qt6/qml/org/kde/kirigami/PageRow.qml:223)
onActiveSubCategoryRowChanged (qrc:/qt/qml/org/kde/systemsettings/SubCategoryPage.qml:180)
X Error of failed request:  BadLength (poly request too large or internal Xlib length error)
  Major opcode of failed request:  139 (RENDER)
  Minor opcode of failed request:  20 (RenderAddGlyphs)
  Serial number of failed request:  19
  Current serial number in output stream:  370


EXPECTED RESULT
kfontview opens a preview window

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma: 
KDE Plasma Version: 6.2.4
KDE Frameworks Version: 6.8.0
Qt Version: 6.8.1

ADDITIONAL INFORMATION

With QT_QPA_PLATFORM=xcb, the preview window is correctly shown.
Comment 1 Nicolas Fella 2024-12-06 17:23:47 UTC
Works fine for me.

Does systemsettings actually crash, i.e. does the crash reporter trigger?
Comment 2 dantmnf 2024-12-07 04:52:55 UTC
It is actually terminated by Xlib on XGetImage.

Further investigation points to my UI font (HarmonyOS Sans), which is used on the first line of preview panel.

With Noto Sans as UI font, it can open NotoSans-Regular.ttf, but not HarmonyOS_Sans_Regular.ttf (same error message).

The HarmonyOS Sans font is available at https://developer.huawei.com/consumer/en/doc/design-guides-V1/font-0000001157868583-V1
Comment 3 dantmnf 2024-12-08 16:30:50 UTC
Oh the link in my previous comment points to an outdated version, the current faulting version is at https://developer.huawei.com/images/download/next/HarmonyOS-Sans.zip

Other Xft-based apps don't like this font either, resulting in same error messages and terminated. Seems like a bug in Xft.
Comment 4 dantmnf 2024-12-09 14:29:32 UTC
Upstream bug: https://gitlab.freedesktop.org/xorg/lib/libxft/-/issues/22
Comment 5 John Kizer 2024-12-19 07:22:08 UTC
Impressive digging, thanks for creating that! Linking that URL in the Bugzilla field here and marking as upstream.