Skip to content

Commit

Permalink
[Update] 設定ファイルから読み込む項目を追加
Browse files Browse the repository at this point in the history
  • Loading branch information
omonomo committed Oct 13, 2024
1 parent 79a9a3a commit e52770e
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 15 deletions.
27 changes: 21 additions & 6 deletions font_generator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -359,22 +359,37 @@ settings_txt=$(find . -maxdepth 1 -name "${settings}.txt" | head -n 1)
if [ -n "${settings_txt}" ]; then
S=$(grep -m 1 "^version=" "${settings_txt}") # フォントバージョン
if [ -n "${S}" ]; then font_version="${S#version=}"; fi
S=$(grep -m 1 "^moveY_powerline=" "${settings_txt}") # Powerline Y座標補正値
if [ -n "${S}" ]; then y_pos_pl_revise="${S#moveY_powerline=}"; fi
S=$(grep -m 1 "^scaleY_powerline=" "${settings_txt}") # Powerline Y座標拡大率
if [ -n "${S}" ]; then height_scale_pl_revise="${S#scaleY_powerline=}"; fi
S=$(grep -m 1 "^scale_decimal=" "${settings_txt}") # 小数拡大率
if [ -n "${S}" ]; then scale_calt_decimal="${S#scale_decimal=}"; fi

S=$(grep -m 1 "font_familyname=" "${settings_txt}") # フォントファミリー名
if [ -n "${S}" ]; then font_familyname="${S#font_familyname=}"; fi

S=$(grep -m 1 "font_familyname_suffix=" "${settings_txt}") # フォントファミリー名接尾語
if [ -n "${S}" ]; then font_familyname_suffix="${S#font_familyname_suffix=}"; fi

S=$(grep -m 1 "vendor_id=" "${settings_txt}") # メーカー ID
if [ -n "${S}" ]; then vendor_id="${S#vendor_id=}"; fi

S=$(grep "^copyright=" "${settings_txt}") # 著作権
if [ -n "${S}" ]; then
copyright="${S//copyright=/}";
copyright="${copyright//
/\\n\\n\" + \"}\n\n";
fi

S=$(grep -m 1 "^copyright_nerd_fonts=" "${settings_txt}") # 著作権 (Nerd fonts)
if [ -n "${S}" ]; then copyright_nerd_fonts="${S#copyright_nerd_fonts=}\n\n"; fi

S=$(grep -m 1 "^copyright_license=" "${settings_txt}") # ライセンス
if [ -n "${S}" ]; then copyright_license="${S#copyright_license=}"; fi

S=$(grep -m 1 "^moveY_powerline=" "${settings_txt}") # Powerline Y座標補正値
if [ -n "${S}" ]; then y_pos_pl_revise="${S#moveY_powerline=}"; fi

S=$(grep -m 1 "^scaleY_powerline=" "${settings_txt}") # Powerline Y座標拡大率
if [ -n "${S}" ]; then height_scale_pl_revise="${S#scaleY_powerline=}"; fi

S=$(grep -m 1 "^scale_decimal=" "${settings_txt}") # 小数拡大率
if [ -n "${S}" ]; then scale_calt_decimal="${S#scale_decimal=}"; fi
fi

# Powerline の Y座標移動量
Expand Down
23 changes: 14 additions & 9 deletions run_ff_ttx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,6 @@ symbol_only_flag="false" # カーニング設定を記号、桁区切りのみ

font_version="0.1.0"

version="version"
version_txt=$(find . -maxdepth 1 -name "${version}.txt" | head -n 1)
if [ -n "${version_txt}" ]; then
font_v=$(head -n 1 < ${version_txt})
if [ -n "${font_v}" ]; then
font_version=${font_v}
fi
fi

option_format_fg() { # font_generator 用のオプションを整形 (戻り値: 整形したオプション)
local opt # 整形前のオプション
local leaving_tmp_flag # 一時作成ファイルを残すか
Expand Down Expand Up @@ -130,6 +121,20 @@ forge_ttx_help()
echo " -F Complete Mode (generate finished fonts)" # 完成品作成
}

# 設定読み込み
settings="settings" # 設定ファイル名
settings_txt=$(find . -maxdepth 1 -name "${settings}.txt" | head -n 1)
if [ -n "${settings_txt}" ]; then
S=$(grep -m 1 "^version=" "${settings_txt}") # フォントバージョン
if [ -n "${S}" ]; then font_version="${S#version=}"; fi

S=$(grep -m 1 "font_familyname=" "${settings_txt}") # フォントファミリー名
if [ -n "${S}" ]; then font_familyname="${S#font_familyname=}"; fi

S=$(grep -m 1 "font_familyname_suffix=" "${settings_txt}") # フォントファミリー名接尾語
if [ -n "${S}" ]; then font_familyname_suffix="${S#font_familyname_suffix=}"; fi
fi

echo
echo "*** FontForge and TTX runner ***"
echo
Expand Down
7 changes: 7 additions & 0 deletions settings.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# フォントのバージョン
version=3.2.4b

# フォント名
font_familyname=Cyroit
font_familyname_suffix=

# メーカー ID
vendor_id=PfEd

# 著作権
copyright=Copyright (c) 2023 omonomo
copyright=[Inconsolata]\nCopyright 2006 The Inconsolata Project Authors (https://github.com/cyrealtype/Inconsolata)
Expand Down
8 changes: 8 additions & 0 deletions table_modificator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,14 @@ table_modificator_help()
echo " -p Run calt patch only"
}

# 設定読み込み
settings="settings" # 設定ファイル名
settings_txt=$(find . -maxdepth 1 -name "${settings}.txt" | head -n 1)
if [ -n "${settings_txt}" ]; then
S=$(grep -m 1 "font_familyname=" "${settings_txt}") # フォントファミリー名
if [ -n "${S}" ]; then font_familyname="${S#font_familyname=}"; fi
fi

echo
echo "= Font tables Modificator ="
echo
Expand Down
8 changes: 8 additions & 0 deletions uvs_table_maker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ uvs_table_maker_help()
echo " -N string Set fontfamily (\"string\")"
}

# 設定読み込み
settings="settings" # 設定ファイル名
settings_txt=$(find . -maxdepth 1 -name "${settings}.txt" | head -n 1)
if [ -n "${settings_txt}" ]; then
S=$(grep -m 1 "font_familyname=" "${settings_txt}") # フォントファミリー名
if [ -n "${S}" ]; then font_familyname="${S#font_familyname=}"; fi
fi

echo
echo "- UVS table [cmap, format 14] maker -"
echo
Expand Down

0 comments on commit e52770e

Please sign in to comment.