Skip to content

Commit

Permalink
Sort WOFF2 before WOFF by default, recommend WOFF2
Browse files Browse the repository at this point in the history
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
  • Loading branch information
neverpanic committed Jun 26, 2018
1 parent 352849b commit b084434
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,13 @@ the terms.
webfont formats. Supported identifiers are <code>eot</code>,
<code>woff</code>, <code>woff2</code>, <code>svg</code>, and
<code>ttf</code>. Additionally, the special value <code>all</code>
expands to all supported formats. The default is <code>all</code>. 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.</dd>
expands to all supported formats in the order <code>woff2</code>,
<code>woff</code>, <code>eot</code>, <code>svg</code>,
<code>ttf</code>. The default is <code>all</code>. 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.</dd>
<dt><code>-h</code>, <code>--help</code></dt>
<dd>Display this message and exit.</dd>
<dt><code>-l LANGSPEC</code>, <code>--languages=LANGSPEC</code></dt>
Expand Down
13 changes: 8 additions & 5 deletions google-font-download
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b084434

Please sign in to comment.