servo / font-kit

A cross-platform font loading library written in Rust
Apache License 2.0
685 stars 103 forks source link

Potential font loading performance increase of >50% #215

Open leifniem opened 1 year ago

leifniem commented 1 year ago

Forgive me if this is wrong information or unorthodox, but for my first Rust project i have been utilizing font_kit and plaqyed around a little with the loading approach.

I have a 2GB folder with ~5.5k fonts, which loads in roundabout 50 seconds with the current implementation. Using jwalk and it's processing capabilities to only keep the relevant files and distinguishing between single and collection types by their file extension managed to get it down to ~11s using Font::from_path to read the files.

If i did research correctly collections should use the ttc or otc extensions only, which would make this approach viable, if not i'll happily stand corrected.

Thanks for this library it's great :)