hoffstadt / hoffstadt/DearPyGui

Error loading font for Chinese path

Open
#2,297 5 comments 1 reaction 0 assignees View on GitHub
state: pending type: bug
Dominant language
C++
Stars
15.6k
Forks
783
PR merge metrics
No merged PRs in 30d

Description

ttf_path E:\中文\config\ttf\MiSans-Regular.ttf

```python
ttf_path = r"E:\中文\config\ttf\MiSans-Regular.ttf"
with dpg.font_registry():
with dpg.font(
ttf_path, 40, default_font=True
) as default_font:
dpg.add_font_range_hint(dpg.mvFontRangeHint_Chinese_Full)

dpg.bind_font(default_font)
```

```python

Exception: Error: [1000] Message: Font file could not be found

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "E:\anaconda3\envs\gui\lib\site-packages\dearpygui\dearpygui.py", line 1905, in font_registry
yield widget
File "e:\code\main.py", line 440, in run
ttf_path, 40, default_font=True
File "E:\anaconda3\envs\gui\lib\contextlib.py", line 112, in __enter__
return next(self.gen)
File "E:\anaconda3\envs\gui\lib\site-packages\dearpygui\dearpygui.py", line 1878, in font
widget = internal_dpg.add_font(file, size, label=label, user_data=user_data, use_internal_label=use_internal_label, tag=tag, pixel_snapH=pixel_snapH, parent=parent, **kwargs)
SystemError: returned a result with an error set

During handling of the above exception, another exception occurred:

Exception: Error: [1009] Message: No container to pop.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "e:/code/main.py", line 15, in
main(parent)
File "e:/code/main.py", line 11, in main
dbok.run(dizhi)
File "e:\code\main.py", line 445, in run
dpg.add_font_range_hint(dpg.mvFontRangeHint_Chinese_Full)
File "E:\anaconda3\envs\gui\lib\contextlib.py", line 130, in __exit__
self.gen.throw(type, value, traceback)
File "E:\anaconda3\envs\gui\lib\site-packages\dearpygui\dearpygui.py", line 1907, in font_registry
internal_dpg.pop_container_stack()
SystemError: returned a result with an error set

```

How to solve it ?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.