1.0.2 • Published 1 year ago

font-range v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

TypeScript version Node.js version APLv2

Font Range

NJNKNC

Google Font provides a subset of Korean, Japanese, and Chinese Slicing Patterns through machine learning.

Font Range helps you to subset using unicode range in Google Fonts.

K0K1

Result

Usage

Google font CSS file(include unicode-range file) url and font path are fine.

fontRange(google_font_css_url, font_path);
fontRange(google_font_css_url, font_path, save_path); // Option1
fontRange(google_font_css_url, font_path, {
  savePath:    "<SAVE SUBSET PATH>",
  format:      "<FONT FORMAT>",
  nameForamt:  "<NAME FORAMT>",
  defaultArgs: "<Default Args>",
  etcArgs:     "<ETC pyftsubset args>"
}); // Option2
  • save_path's default: <font_path>
  • format's default: "woff2"
  • nameFormat's default: "{NAME}_{INDEX}{EXT}"
  • defaultArgs's default:
"--layout-features='*' \
 --glyph-names \
 --symbol-cmap \
 --legacy-cmap \
 --notdef-glyph \
 --notdef-outline \
 --recommended-glyphs \
 --name-legacy \
 --drop-tables= \
 --name-IDs='*' \
 --name-languages='*'
"
  • etcArgs's default: ""

Requires

It has dependencies on the following packages:

pip install fonttools[ufo,woff,unicode]  zopfli brotli

CSS URL?

The URL of Noto Sans is included in the package.

Noto

const targets = {
  weston:   "https://fonts.googleapis.com/css2?family=Noto+Sans&display=swap",
  korean:   "https://fonts.googleapis.com/css2?family=Noto+Sans+KR&display=swap",
  japanese: "https://fonts.googleapis.com/css2?family=Noto+Sans+JP&display=swap",
  chinese:  "https://fonts.googleapis.com/css2?family=Noto+Sans+SC&display=swap",
  chinese_traditional: "https://fonts.googleapis.com/css2?family=Noto+Sans+TC&display=swap",
};

License

Licensed under the APLv2. See the LICENSE file for details.