ImaginarySense / Imaginary-Teleprompter

Easy to use, free software, teleprompter app.
http://imaginary.tech/teleprompter
GNU General Public License v3.0
269 stars 54 forks source link

Font selection takes long to load and resulting list is incomplete #66

Open Cuperino opened 3 years ago

Cuperino commented 3 years ago

SUMMARY Font selection takes a long time to load and resulting font selection list is incomplete.

STEPS TO REPRODUCE

  1. Install thousands of open type and true type fonts on operating system
  2. Select text in editor
  3. Click on font selection dropdown menu

OBSERVED RESULT

Font selection dropdown takes a long time to load

EXPECTED RESULT Font selection dropdown should load instantaneously. All compatible fonts should be loaded.

SUGGESTED OUTCOME Font selection dropdown should implement lazy loading to achieve an instantaneous loading perception. Truncated font selection may be automatically solved as a by product of implementing lazy loading.

Version: beta-v
OS: KDE neon User Edition 5.21 x86_64
CPU: Intel i7-1065G7 (8) @ 3.900GHz
va2ron1 commented 3 years ago

Font selection dropdown has a little delay, limitation by CKEditor, but the loading is almost instantaneously on Windows 10 and macOS Catalina & Big Sur. Also the font selection loads all the fonts.

Note: The system fonts wasn't tested on Linux, maybe there's a limitation with the Electron dependencies.

Version: beta-v

OS: Windows 10 Pro 2004 (Build 19041.928)
CPU: AMD Ryzen 7 3750H

OS: macOS Catalina 10.15.7
CPU: Intel Core i9 2.4 GHz 8-Core
Cuperino commented 3 years ago

There may have been way too many fonts installed on my system... After removing nearly 500 mb of font files I rarely used, load time went from around one and a half minutes to 7 seconds. Fonts continue to stop loading on the same font, meaning the max number of loadable fonts may still be exceeded or there may be a different reason for it stopping at that location.

I've noticed before that Linux takes longer to load fonts than Windows and macOS. Nevertheless, load times are still an order of magnitude higher on Imaginary Teleprompter compared to various other applications. The good thing is the issue is insignificant when you don't have an exorbitant amount of fonts on your system. Therefore, this may be a low priority bug.

@va2ron1, how many fonts have you got installed on your Windows and macOS systems? I have 1072 fonts installed on the Linux box in question.

va2ron1 commented 3 years ago

@Cuperino on the Mac with Catalina I have 508 fonts and 249 on Windows

Cuperino commented 3 years ago

I suspect font loading under Linux or font loading in general does something that makes it O(n²) in complexity. The reason I think this is I only removed about a third of the size of fonts in my system, and loading time went down by nearly 80%. Will move Linux fonts to Windows and do further testing there.