Skip to content

Commit

Permalink
Issue mozfr#530: host OpenSans font ourselves
Browse files Browse the repository at this point in the history
* Don't provide fallbacks for old browsers, just use woff
* Cache them via .htaccess
* Put them in a local fonts folder

A quick check on my local instance gives good results on page load (/3)
  • Loading branch information
pascalchevrel committed Nov 15, 2015
1 parent 4551662 commit a40d1e8
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 17 deletions.
16 changes: 14 additions & 2 deletions web/.htaccess
Expand Up @@ -13,11 +13,23 @@
<IfModule mod_expires.c>
ExpiresActive on
ExpiresDefault "access plus 1 week"

ExpiresByType application/json "access plus 0 seconds"
ExpiresByType application/javascript "access plus 1 year"
ExpiresByType application/font-woff "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType text/css "access plus 1 year"
ExpiresByType application/font-woff "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
</IfModule>

<IfModule mod_deflate.c>
# Compress all output labeled with one of the following MIME-types
# (for Apache versions below 2.3.7, you don't need to enable `mod_filter`
# and can remove the `<IfModule mod_filter.c>` and `</IfModule>` lines
# as `AddOutputFilterByType` is still in the core directives).
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE application/font-woff \
image/svg+xml
</IfModule>
</IfModule>
Binary file added web/fonts/OpenSans/OpenSans-Bold-webfont.woff
Binary file not shown.
Binary file added web/fonts/OpenSans/OpenSans-Italic-webfont.woff
Binary file not shown.
Binary file added web/fonts/OpenSans/OpenSans-Light-webfont.woff
Binary file not shown.
Binary file not shown.
Binary file added web/fonts/OpenSans/OpenSans-Regular-webfont.woff
Binary file not shown.
Binary file not shown.
43 changes: 28 additions & 15 deletions web/style/transvision.css
@@ -1,33 +1,46 @@
/* Fonts */
/* Updated on www.mozilla.org 2015-06-17 */

@font-face {
font-family: 'Open Sans';
font-family: 'Open Sans Light';
src: url(/fonts/OpenSans/OpenSans-Light-webfont.woff) format('woff');
font-weight: normal;
font-style: normal;
}

@font-face {
font-family: 'Open Sans Light';
src: url(/fonts/OpenSans/OpenSans-Semibold-webfont.woff) format('woff');
font-weight: bold;
font-style: normal;
}

@font-face {
font-family: 'Open Sans Light';
src: url(/fonts/OpenSans/OpenSans-LightItalic-webfont.woff) format('woff');
font-weight: normal;
src: url(https://www.mozilla.org/media/fonts/OpenSans-Regular-webfont.eot?#iefix) format('embedded-opentype'),
url(https://www.mozilla.org/media/fonts/OpenSans-Regular-webfont.woff) format('woff'),
url(https://www.mozilla.org/media/fonts/OpenSans-Regular-webfont.ttf) format('truetype'),
url(https://www.mozilla.org/media/fonts/OpenSans-Regular-webfont.svg#OpenSansRegular) format('svg');
font-style: italic;
}

@font-face {
font-family: 'Open Sans';
src: url(/fonts/OpenSans/OpenSans-Regular-webfont.woff) format('woff');
font-weight: normal;
font-style: normal;
font-weight: bold;
src: url(https://www.mozilla.org/media/fonts/OpenSans-Semibold-webfont.eot?#iefix) format('embedded-opentype'),
url(https://www.mozilla.org/media/fonts/OpenSans-Semibold-webfont.woff) format('woff'),
url(https://www.mozilla.org/media/fonts/OpenSans-Semibold-webfont.ttf) format('truetype'),
url(https://www.mozilla.org/media/fonts/OpenSans-Semibold-webfont.svg#OpenSansSemibold) format('svg');
}

@font-face {
font-family: 'Open Sans Light';
font-family: 'Open Sans';
src: url(/fonts/OpenSans/OpenSans-Bold-webfont.woff) format('woff');
font-weight: bold;
font-style: normal;
}

@font-face {
font-family: 'Open Sans';
src: url(/fonts/OpenSans/OpenSans-Italic-webfont.woff) format('woff');
font-weight: normal;
src: url(https://www.mozilla.org/media/fonts/OpenSans-Light-webfont.eot?#iefix) format('embedded-opentype'),
url(https://www.mozilla.org/media/fonts/OpenSans-Light-webfont.woff) format('woff'),
url(https://www.mozilla.org/media/fonts/OpenSans-Light-webfont.ttf) format('truetype'),
url(https://www.mozilla.org/media/fonts/OpenSans-Light-webfont.svg#OpenSansLight) format('svg');
font-style: italic;
}

/* General structure */
Expand Down

0 comments on commit a40d1e8

Please sign in to comment.