Last active
May 25, 2019 17:54
-
-
Save vbarbarosh/ac40584edf421901ac12874c04749432 to your computer and use it in GitHub Desktop.
app_fontmerge – Merge several .woff2 files into a single one https://codescreens.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # http://www.gnu.org/software/bash/manual/bash.html#The-Set-Builtin | |
| # http://redsymbol.net/articles/unofficial-bash-strict-mode/ | |
| set -o nounset -o errexit -o pipefail | |
| # Merge several .woff2 files into a single one. Primary use case is to | |
| # feed resulted file to a svgtext app. | |
| # | |
| # https://github.com/fonttools/fonttools | |
| pyftmerge "$@" | |
| mv merged.ttf a.ttf | |
| # After a little bit of research it turns out that google can return | |
| # single .ttf file if User-Agent header will not contain | |
| # **AppleWebKit/537 Chrome/74**. That is when opening url from browser | |
| # google will return css with a bunch of .woff2 files, but requesting | |
| # the same url with curl google will return a css with single .ttf | |
| # file. | |
| # | |
| # curl https://fonts.googleapis.com/css?family=Molengo \ | |
| # -H User-Agent:'AppleWebKit/537 Chrome/74' | |
| # | |
| # curl https://fonts.googleapis.com/css?family=Roboto \ | |
| # -H User-Agent:'AppleWebKit/537 Chrome/74' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment