Lunacy takes VERY long to start because of the fonts

Lunacy version:
OS version: Arch Linux and openSUSE Tumbleweed and Ubuntu 22.04

I noticed one problem, if there are a lot of fonts installed in the operating system, Lunacy takes a very long time to start up. Sometimes it can run for 10-15 minutes, and sometimes for an hour! In this case it actively uses 25% of the CPU.

I noticed this problem in all Linux distributions and it persists in the beta-version of the program as well. At the moment I have about 8-9 gigabytes of fonts installed and it takes an hour to run.

I think it is necessary to optimize this point, the problem does not appear if there are not many fonts in the system.

Hello

What is your Lunacy version?

Lunacy beta 9.0.4

Thank you

Okay, we haven’t really tested for 10 gigs of fonts installed. During the first launch Lunacy caches the font library and afterwards everything should launch fine. The catch is that any modification/installation of a new font will make the app cache everything again.

We will think of how we could optimize the processes involved, as an option we could make font loading take place in a different CPU thread

1 Like

Good evening, thanks for the quick response. Caching helps, but unfortunately not much. For example, a program can run for an hour, but after caching startup time is reduced to 10-15 minutes.

Also because of the huge font libraries, the program hangs when trying to apply any font to text. I hope this will be fixed, I really like the program.

As a professional designer of 15+ years, and as someone who also works with many other professional designers, none of us have/need 9+ gigs of fonts installed on our systems. Hell, we don’t even have that combined. It sounds to me like you found and downloaded a massive torrent full of fonts and just installed all of them. For perspective, most fonts average (depending on how many weights are included) 700kb - 1.3mb (though, many of them are much smaller, like 50-100kb). But, for the sake of easy math, let’s say every font is 1mb (again, most of them are much, much smaller). It would take 1,024 fonts at 1mb PER FONT to equal 1gig. So, in this scenario, it would take 9,216 fonts to come out to 9gigs. There isn’t a single professional designer on this planet who uses or needs that many fonts.

For one thing, you can’t even keep track of which fonts are good and which aren’t. For another, that’s way too many choices, with many of them looking very similar (it’s just a statistical fact that many of them will look the same). Also, not only does Lunacy have to deal with loading 9,000+ fonts, but so does Linux. I can tell you this problem is not limited to Lunacy either, as Photoshop, Affinity Photo 2, etc would all choke trying to load that many. There are about 9,216 other reasons not to install that many fonts.

As far as Icon8 and Lunacy is concerned, if I were them, I wouldn’t bother trying to solve for this issue. The amount of development time and resources required to solve an issue that probably 0.001% of the userbase faces is definitely not worth it, when the easier solution, that is better for all parties involved would be for you to uninstall all of those fonts and install 15-20 good fonts.

1 Like

@nrthbound Glad to hear that you are not part of the devs, otherwise the issue was never fixed.
Because it’s a bug.

Just think about this:

I run Lunacy with 1826 font families installed on my Linux laptop - and the application hangs for a really long time on startup.
I run Figma with 1826 font families installed on my Linux laptop plus Figma uses the Google font library - and i never have any lags.

This is what we have when app developers are not clueless designers.

The issue looks like a bug about fonts.

I don’t have 9 gigs of fonts, but as you can see from the log Lunacy thinks I have over 14000 font families, which is far from it.

...
03:19:05.724 SystemFonts	Done	> System fonts cache loaded: 14872 font families
...
03:19:05.066 Launcher	Default	> Launch args: /opt/icons8/lunacy/Lunacy.dll
03:19:05.070 Settings	Default	> DeviceId: f067e69d-ff13-4602-bf5f-657e5398260e
03:19:05.133 Account	Done	> Already authorized to EU_Prod. Refreshing
03:19:05.147 Api	Default	> Connection restoring: EU_Prod
03:19:05.159 Api	Default	> Main Connection is: EU_Prod
03:19:05.520 Push EU_Prod	Info	> Connecting
03:19:05.724 SystemFonts	Done	> System fonts cache loaded: 14872 font families
03:19:06.226 Push EU_Prod	Info	> Initializing
03:19:06.243 Push EU_Prod	Done	> Connected
03:19:06.750 Push EU_Prod	Error	> Disconnected
03:19:06.771 Account	Done	> Authorized to EU_Prod
03:19:06.782 Push EU_Prod	Info	> Connecting
03:19:07.152 Push EU_Prod	Info	> Initializing
03:19:07.153 Push EU_Prod	Done	> Connected
03:19:13.440 UpdateChecker	Default	> Remote version: 9.1.1
03:24:20.024 Render	Info	> Running a GC and GL cleanup on 20sec of AFK (once in 5min)

Here is what i have actually about fonts:

In ~/.local/share/fonts folder i have total 718 font files:

find ~/.local/share/fonts -type f \( -iname "*.otf" -o -iname "*.ttf" \) | wc -l
718

(see listing: https://fars.ee/E7-D)

In ~/.fonts folder i have total 0 fonts files but have 695 symlinks to font files from ~/.local/share/fonts folder:

find ~/.fonts -type f \( -iname "*.otf" -o -iname "*.ttf" \) | wc -l
0
find ~/.fonts -type l \( -iname "*.otf" -o -iname "*.ttf" \) | wc -l
695

(see listing of symlinks: https://fars.ee/mi6O)

In ~/usr/share/fonts folder i have total 3081 font files:

find /usr/share/fonts -type f \( -iname "*.otf" -o -iname "*.ttf" \) | wc -l
3081

(see listing: https://fars.ee/x26R)

Font family is not equal to a font file. E.g. you may have about 100 font files installed, but it may only be 1 font family (see Releases · be5invis/Iosevka · GitHub).

So I have not installed over 14,000 font families . But Lunacy consider i do. It’s a bug.

Here you can see the actual amount of fonts i have (font-manager app):


All: 1826
System: 567
User: 1293

Perhaps we can optimize the font loading process to prevent it from affecting UI responsiveness. Currently, I have encountered an issue where the UI freezes every time it is launched.

You are correct, 14000 font families are not 14000 fonts, as one font family may include tens of font faces. For that reason, we cache the font info during the first launch so Lunacy won’t have to load them all over again every time.

These cache works pretty well both on Windows and MacOS and was tested with around 9k font faces.
Perhaps the issue is on the Linux’s side, it is possible the system takes too long to provide the number of fonts installed, as we use that number to check against the numbers in the cache. If the number is the same, the cache remains, if it has changed the cache will refresh.
We had cases of a very fast cache loading even with 100k font families installed, as it is a simple .json file.

Yes, fresh good news!

We have tested everything related to fonts once again and found a way to optimize the process. It should improve in 9.2, but you will be able to check the beta out tomorrow.

3 Likes

I just tested v.9.2 and everything seems to be fine now, no hang-ups, app launches without freezing.
Looks like you’ve fixed it!
Good job, thanks :+1: