-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
64 additions
and
14 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,4 @@ | |
.env | ||
/db/ | ||
/db_config/ | ||
/NotoSansJP-Medium.ttf | ||
/OFL.txt | ||
/Noto.zip | ||
/NotoSansCJKjp-Medium.ttf |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,65 @@ | ||
#!/bin/sh | ||
#!/bin/bash | ||
|
||
set -exu | ||
function info () { | ||
local SUFFIX=$(tput sgr0) | ||
|
||
cd $(dirname "$0") | ||
if [ $1 -eq 0 ]; then | ||
local PREFIX | ||
elif [ $1 -eq 1 ]; then | ||
local PREFIX="$(tput bold)==> " | ||
elif [ $1 -eq 2 ]; then | ||
local PREFIX=" -> " | ||
fi | ||
|
||
mkdir tmp | ||
cd tmp | ||
wget --https-only -O Noto.zip 'https://fonts.google.com/download?family=Noto%20Sans%20JP' | ||
unzip Noto.zip static/NotoSansJP-Medium.ttf OFL.txt | ||
mv static/NotoSansJP-Medium.ttf OFL.txt ../ | ||
cd ../ | ||
rm -rf tmp | ||
echo -E "${PREFIX}${2}${SUFFIX}" >> /dev/stderr | ||
} | ||
|
||
function findtools () { | ||
info 1 "find ${1} ..." | ||
|
||
if which ${1} &> /dev/null; then | ||
local LOCATION=$(which ${1}) | ||
info 2 "found! (${LOCATION})" | ||
info 0 | ||
|
||
echo -n "${LOCATION}" | ||
else | ||
info 2 "not found! exiting..." | ||
fi | ||
|
||
} | ||
|
||
cd $(dirname "${0}") | ||
|
||
OTF_VARIANT="Sans" | ||
OTF_FILENAME="Noto${OTF_VARIANT}CJKjp-Medium.otf" | ||
OTF_URL="https://raw.githubusercontent.com/notofonts/noto-cjk/main/${OTF_VARIANT}/OTF/Japanese/${OTF_FILENAME}" | ||
|
||
TTF_FILENAME="${OTF_FILENAME%.*}.ttf" | ||
|
||
if [ -e "${TTF_FILENAME}" ]; then | ||
info 1 "${TTF_FILENAME} is exists! exiting..." | ||
exit | ||
fi | ||
|
||
WGET=$(findtools wget) | ||
[ ! ${WGET} ] && exit 1 | ||
|
||
FONTFORGE=$(findtools fontforge) | ||
[ ! ${FONTFORGE} ] && exit 1 | ||
|
||
info 1 "download ${OTF_FILENAME}" | ||
$WGET --https-only --output-document "${OTF_FILENAME}" "${OTF_URL}" | ||
# info 0 | ||
|
||
info 1 "convert ${OTF_FILENAME} to ${TTF_FILENAME}" | ||
$FONTFORGE -lang=ff -c 'Open($1); Generate($2)' "${OTF_FILENAME}" "${TTF_FILENAME}" | ||
info 0 | ||
|
||
info 1 "remove unnecessary file" | ||
info 2 "delete ${OTF_FILENAME}" | ||
rm -f "${OTF_FILENAME}" | ||
info 0 | ||
|
||
info 1 "complete! now available font" | ||
info 2 "at ${TTF_FILENAME}" |
This file contains 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