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

Fonts are sent without gzip compression #3564

Closed
jessetan opened this issue Jan 30, 2018 · 5 comments
Closed

Fonts are sent without gzip compression #3564

jessetan opened this issue Jan 30, 2018 · 5 comments
Labels
Improvement Minor improvement to code

Comments

@jessetan
Copy link
Contributor

The fonts used (Lato and Roboto) are not sent using gzip compression. This makes them responsible for the bulk of the traffic on an initial page load. See the blue bars in the following graph:
network-rtd

Suggestion:
Turn on gzip compression for the following types in the RTD nginx config.

extension MIME type
ttf application/font-sfnt (or old style application/x-font-ttf)
otf application/font-sfnt (or old style application/x-font-otf)
eot application/vnd.ms-fontobject

This may have already been fixed, as suggested by #2955 (comment), but the actual PR and files are not publicly visible so it cannot be verified if the mime types for these fonts are set up properly. This also does not mention otf fonts.

Note that woff(2) fonts do not seem to benefit from gzip compression.

@davidfischer
Copy link
Contributor

As far as I can tell, these fonts are sent without compression regardless of whether the request says it can handle gzip compression. I will look to see if I can get this resolved.

@davidfischer
Copy link
Contributor

I'm thinking perhaps the easiest way to solve this is just to change the theme to bundle woffs instead of TTFs.

@jessetan
Copy link
Contributor Author

jessetan commented May 1, 2018

I've looked into changing the TTF file in the theme to WOFF(2) files, but I haven't found the exact same version of the lato font yet. Even if I use new TTF files I get a slightly different look in Chrome on macOS, probably due to increased hinting information in newer versions of the font.
Until we can get exactly the same visual appearance with WOFF, turning on gzip compression will save at least some bandwidth. It will also work for other themes that might use TTF.

@davidfischer
Copy link
Contributor

davidfischer commented May 1, 2018

We bundled the woff files for the .org in this PR: #3982

I generated these woff files on fontsquirrel.

Edit: In case you look at that PR, the woff2 (but not regular woff) got mangled by git. I have a fix here: #4049

@davidfischer
Copy link
Contributor

This is now resolved. After we moved all our static media to assets.readthedocs.org which is served by Azure's CDN solution all static assets serve with correct gzip settings.

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

No branches or pull requests

3 participants