google-font-download

Locally host Google's web fonts

Github星跟蹤圖

google-font-download

This is a small shell script that allows you to download Google's web fonts to
your local file system. Additionally, a CSS file that uses your local copy of
the fonts is generated. You may want to use this if you want to avoid
requesting resources from 3rd party servers (for example for privacy reasons or
because you do not have a connection to the public internet).

Requirements

To run this script, you will need:

  • Bash (>= 4.x)
  • curl
  • getopt, preferrably a version that preserves quoted whitespace and supports long options
  • tput
  • fmt
  • sed, in a version that has extended regex support using either -E (BSD) or -r (GNU)
  • awk
  • tr
  • grep

License

The script is released under the 2-clause BSD license. The SPDX identifier of
this license is BSD-2-Clause. See the LICENSE file for
the terms.

Usage

Synopsis

google-font-download [OPTION...] [FONT...]

Options

Positional Arguments

This script accepts an arbitrary number of font specs. A font spec consists
of a font name as accepted by Google's servers, optionally followed by
a colon, an optional font weight in numbers or the string "bold" and an
optional font style of "italic" (or "i") for italics. In EBNF:

fontspec = fontname, [ ":", [ fontweight ], [ fontstyle ] ]
fontweight = number, "bold"
number = { digit }
digit = "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"
fontstyle = "italic", "i"

While Google's servers will accept other inputs and abbreviations for font
weight and font style, they are not supported by this script.

Note: if you don't use the URL argument, your font spec should not be URL-encoded and only one font weight
is supported per font specification. If you want to download multiple font
weights or styles, provide multiple font specs.

For example, to download Open Sans in

  • light (300),
  • normal (400),
  • normal italic (400italic),
  • bold (700), and
  • bold italic (700italic),
    run:
google-font-download \
    "Open Sans:300" "Open Sans:400" "Open Sans:400italic" \
    "Open Sans:700" "Open Sans:700italic"

or in URL format:

google-font-download --url="https://fonts.google.com/?selection.family=Open+Sans:300,400,400i,700,700i"

You can also mix the arguments:

google-font-download --url="https://fonts.google.com/?selection.family=Open+Sans:300,400,400i" \
"Open Sans:700" "Open Sans:700i"

主要指標

概覽
名稱與所有者neverpanic/google-font-download
主編程語言Shell
編程語言Shell (語言數: 2)
平台
許可證BSD 2-Clause "Simplified" License
所有者活动
創建於2015-06-13 22:47:52
推送於2020-06-21 20:39:27
最后一次提交2020-06-20 11:27:48
發布數13
最新版本名稱1.4.3 (發布於 2020-06-20 13:36:29)
第一版名稱1.1 (發布於 2015-06-14 00:16:13)
用户参与
星數705
關注者數22
派生數71
提交數61
已啟用問題?
問題數15
打開的問題數2
拉請求數7
打開的拉請求數2
關閉的拉請求數4
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?