• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

neverpanic/google-font-download: Locally host Google's web fonts

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

neverpanic/google-font-download

开源软件地址(OpenSource Url):

https://github.com/neverpanic/google-font-download

开源编程语言(OpenSource Language):

Shell 80.0%

开源软件介绍(OpenSource Introduction):

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

-u URL, --url=URL
Dowload the fonts specified in the URL. Note: You can mix it with normal arguments (See below).
-f FORMAT, --format=FORMAT
Download the specified set of webfont formats from Google's 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 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
Download the specified subset of languages from Google's webfonts. LANGSPEC is a comma-separated list of idenfitiers for font subsets. Common identifiers are latin, latin-ext, cyrillic, cyrillic-ext, greek, greek-ext, etc. An undocumented language is all which means the full (non-subset) files are served. The default is latin.
-o OUTPUT, --output=OUTPUT
Write the generated CSS into OUTPUT. The file will be overwritten and will be created if it doesn't exist. The default is font.css.

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"



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap