1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

可変フォントを静的フォントにして使いたい

Last updated at Posted at 2025-05-15

0.可変フォントって?

スタイル(BoldだのMediumだのItallicだのの差分のこと)がすべて一個にまとまっているフォント(.ttf,otf)のこと。このままだとUEなどの可変フォント読み込み機能がないようなツールではスタイルを変えることができない。
今回使用したのはWeightの情報だけで肉付けしている可変フォント。Itallicがあるようなものだと少し変わるかもしれない。

1.Pythonのインストール

FontToolsというものを使うためにPythonをインストールする必要があります。
Python3.9以上必須
この記事見ながら自分はインストールしました。

インストールが完了したら、Windows+Rやらでコマンドプロンプトを起動する。

where pyhton

とか

where pip

とかでインストールできているか確認(ファイルパスが出ていたら成功)

2.FontToolsのインストール

コマンドプロンプトで、

pip install fonttools

py -m pip install fonttools

と打つとダウンロードが始まります。(py -mはきちんとインストールできていれば不要です。おまじない)

3.フォントの太さを変えて書き出す

コマンドを実行するともとになったフォントと同じ階層にフォントが書き出される

fonttools varLib.instancer ["ファイルパス+フォント名"] wght=(お好みのウェイト数)

fonttools varLib.instancer "H:\FontExport\RobotoFlex\RobotoFlex.ttf" wght=700

ウェイトはこの辺を参考に
https://github.com/fontforge/designwithfontforge.com/blob/gh-pages/ja-JP/Bold_and_Other_Weights.md
http://designwithfontforge.com/ja-JP/Bold_and_Other_Weights.html
処理が走って終わると書き出される
image.png

Wight700←→Wight400(Def) ※英語のみ

image.png

4.別ツールで確認

UEに入れてみる
image.png
きちんと反映されているね、ε-(´∀`*)ホッ

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?