From b0844341d1508ec1f8382f335c10354d1560d8ca Mon Sep 17 00:00:00 2001 From: Clemens Lang Date: Tue, 26 Jun 2018 20:45:40 +0200 Subject: [PATCH] Sort WOFF2 before WOFF by default, recommend WOFF2 Apparently browsers process the list of fonts in-order and stop at the first supported option. For this reason, it does not make sense to put WOFF2 after WOFF when generating both, as reported in #21. Instead, change the order of the 'all' default format to start with WOFF2 and WOFF, sort the older formats towards the end and change the recommendation to use WOFF2 and WOFF. Closes: #21 --- README.md | 10 +++++++--- google-font-download | 13 ++++++++----- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 1a8dac6..699a4dc 100644 --- a/README.md +++ b/README.md @@ -42,9 +42,13 @@ the terms. webfont formats. Supported identifiers are eot, woff, woff2, svg, and ttf. Additionally, the special value all - expands to all supported formats. The default is all. Note - that you may not really need all formats. In most cases, WOFF is enough. - See http://caniuse.com/#search=woff for a current status. + expands to all supported formats in the order woff2, + woff, eot, svg, + ttf. The default is all. The generated CSS + file will contain the font formats in the given order, which browsers + will process in-order. Note that you probably do not need all formats. + In most cases, a combination of WOFF2 and WOFF is enough. See + http://caniuse.com/#search=woff for a current status.
-h, --help
Display this message and exit.
-l LANGSPEC, --languages=LANGSPEC
diff --git a/google-font-download b/google-font-download index e65a2be..bd3399f 100755 --- a/google-font-download +++ b/google-font-download @@ -70,10 +70,13 @@ usage() { servers. FORMAT is a comma-separated list of identifiers for webfont formats. Supported identifiers are eot, woff, woff2, svg, and ttf. Additionally, the special value \`all' expands - to all supported formats. The default is \`$format'. Note - that you may not really need all formats. In most cases, - WOFF is enough. See http://caniuse.com/#search=woff for - a current status. + to all supported formats in the order woff2, woff, eot, svg, + ttf. The default is \`$format'. The generated CSS file will + contain the font formats in the given order, which browsers + will process in-order. Note that you probably do not need + all formats. In most cases, a combination of WOFF2 and WOFF + is enough. See http://caniuse.com/#search=woff for a current + status. -h, --help Display this message and exit. @@ -308,7 +311,7 @@ fi declare -a formats if [ "$format" = "all" ]; then # Deal with the special "all" value - formats=("eot" "woff" "woff2" "svg" "ttf") + formats=("woff2" "woff" "eot" "svg" "ttf") else IFS=', ' read -r -a formats <<< "$format" for f in "${formats[@]}"; do