LoginSignup
0
1

More than 1 year has passed since last update.

kivydで、日本語フォントがnot foundになってしまう件について

Posted at

日本語フォントを使おうとした際に出るエラーに関して

resource_add_path("C:/Users/info/AppData/Local/Microsoft/Windows/Fonts")
LabelBase.register(DEFAULT_FONT,"日本語フォント.otf")
※otfは拡張子のため、フォントによっては色んな拡張子があります。

Fontのパスを、Windowsのプロパティのままコピーすると
ディレクトリの区切り文字が\になっていますが、
/に変更すると読み込みはうまくいきます。

よく出るエラー内容はこちら

Traceback (most recent call last):
   File "c:\Users\info\Desktop\MyPython\sample.py", line 9, in <module>
   File "C:\Users\info\anaconda3\lib\site-packages\kivy\core\text\__init__.py", line 315, in register
     raise IOError('File {0} not found'.format(font_type))
 OSError: File ZakkuriGothic-BLK.otf not found

フォントのパスを確認する方法

1、C:\Windows\Fonts というフォルダを開き、パスを確認したいフォントを右クリック
2、プロパティを開き、パスを確認

0
1
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
0
1