Bug 500135

Summary: Broken fonts are causing Krita with the new text tool to crash on startup
Product: [Applications] krita Reporter: Tyson Tan <tysontanx>
Component: Tool/TextAssignee: wolthera <griffinvalley>
Status: RESOLVED FIXED    
Severity: normal CC: griffinvalley
Priority: NOR    
Version First Reported In: nightly build (please specify the git hash!)   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: broken fonts that crash krita on startup

Description Tyson Tan 2025-02-15 14:40:18 UTC
Created attachment 178401 [details]
broken fonts that crash krita on startup

Krita's recent nightly builds merged a significant amount of new text tool code. However, the latest appimages (7d7928dcc4, 2025-02-15) crash at startup during the "Loading resources..." phase.

I attempted to remove all Krita settings and resources, but it didn't resolve the issue. Running the same appimages on a new user account worked fine.

The only differing resources seemed to be user-installed fonts. I discovered two broken fonts in my system. After removing them, the appimages launched successfully again.

Here are the problematic fonts for your reference (see attachment), which may help you develop a mechanism to prevent such issues:

华康简标题宋.TTF 
This font was installed on my system; Kfont could not identify its content.

HKBS.TTF
I don't recall installing this one; Kfont also failed to recognize its content.

Windows 11 couldn't open these fonts as well. They belong to an outdated collection called "Fonts for Official Documents" used in my organization.
Comment 1 wolthera 2025-02-15 15:39:52 UTC
Hi, could you share the fonts in question? I'd like to see if I can recognise they're broken, and if so avoid loading them!
Comment 2 wolthera 2025-02-15 15:40:13 UTC
Ah, sorry, hadn't realised you already attached them. Thanks!
Comment 3 wolthera 2025-02-15 15:42:34 UTC
Ok, quick look with fontforge it seems both the cmap and the os/2 table version of these fonts are broken, so I know I can test against that at the least.
Comment 4 wolthera 2025-02-25 13:36:56 UTC
Git commit 0215c2bb9c1b51685513d33d2baa0a8863edab2c by Wolthera van Hövell tot Westerflier.
Committed on 25/02/2025 at 13:36.
Pushed by woltherav into branch 'master'.

Fix loading TTF fonts without a family name.

Previously we only had this check for non-TTF fonts.

M  +7    -6    libs/flake/text/KoFFWWSConverter.cpp
M  +2    -1    libs/flake/text/KoFFWWSConverter.h

https://invent.kde.org/graphics/krita/-/commit/0215c2bb9c1b51685513d33d2baa0a8863edab2c
Comment 5 Tyson Tan 2025-02-26 01:17:38 UTC
Thank you, wolthera! :)