Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Very slow fc-cache updating on linux #85

Closed
mtglsk opened this issue Feb 12, 2015 · 4 comments
Closed

Very slow fc-cache updating on linux #85

mtglsk opened this issue Feb 12, 2015 · 4 comments
Assignees

Comments

@mtglsk
Copy link

mtglsk commented Feb 12, 2015

Running fc-cache -f -v with han sans takes up to minutes with the font. Never noted such a slow down with other big fonts (like freefont / unifont).

@kenlunde kenlunde self-assigned this Feb 12, 2015
@kenlunde
Copy link
Contributor

How many of the Source Han Sans fonts, and which specific ones, are you trying to install? Also, much of this may depend on what fc-cache is actually trying to perform under the hood. Is it inspecting or traversing the various sfnt tables in the fonts?

Keep in mind that the Source Han Sans fonts push implementation limits in various ways, such as the number of glyphs (65,535 is at the architectural limit, which very few, if any, fonts can claim), a relatively large number of weights (seven, which can multiply the amount of time a process takes), and complex GSUB and GPOS tables. All of these characteristics may expose various inefficiencies in some environments.

I am closing this issue for now, because there is nothing to be done to the fonts, and other environments are able to enumerate these fonts without any substantial lag. But, please provide any additional details for the benefit of others, and me.

@mtglsk
Copy link
Author

mtglsk commented Feb 12, 2015

I decided to try to clean the global cache (/var/cache/fontconfig/*) and run caching again, it seems to speed up a little bit, but nevertheless, this probably is some bug upstream. From my reading it seems that fontconfig checks every glyph to know if there are any empty outlines inside GSUB, could this be the cause of the slowdown? I should probably file a bug upstream... I'm using the large version, btw. I tried each one and there is always a slowdown.

@kenlunde
Copy link
Contributor

It might be useful to post this as an Issue against fontconfig, being sure to provide a reference to the Source Han Sans fonts as a good test case. Checking to make sure that a glyph exists for every GID that is referenced in the 'GSUB' table might indeed be the culprit, considering the extremely large number of substitutions in the 'locl' GSUB feature. One way to test this would be to remove the 'GSUB' and 'GPOS' tables, which can be done by using the AFDKO sfntedit tool. The command line would be as follows:

% sfntedit -d GPOS,GSUB <font>

@behdad
Copy link

behdad commented Feb 25, 2015

I have noticed that slowness... Some versions of fontconfig were computing a cryptographically strong hash of the font file. That was extremely slow. We remove that. Even then, the new Adobe CFF rasterizer in FreeType is five times slower than old FreeType CFF rasterizer for loading glyphs unhinted. Fontconfig loads all glyphs to make sure they have an outline...

See:
https://savannah.nongnu.org/bugs/?43248
https://bugs.freedesktop.org/show_bug.cgi?id=64766

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants