hoffstadt / hoffstadt/DearPyGui
MTLTextureDescriptor failed assertion when trying to use dpg.font_registry()
- Dominant language
- C++
- Stars
- 15.6k
- Forks
- 783
- PR merge metrics
- No merged PRs in 30d
Description
## Version of Dear PyGui
Version: 1.11.1
Operating System: macOs 14.5
## My Issue/Question
Cannot use custom fonts - any attempt to include dpg.font_registry() into the code leads to crash with message:
-[MTLTextureDescriptorInternal validateWithDevice:]:1357: failed assertion `Texture Descriptor Validation
MTLTextureDescriptor has width of zero.
MTLTextureDescriptor has height of zero.
## To Reproduce
Steps to reproduce the behavior:
1. save example code from "Font Loading Instructions" https://dearpygui.readthedocs.io/en/latest/documentation/fonts.html input python file. Place file NotoSerifCJKjp-Medium.otf at same path.
2. run that python file
3. See error
## Expected behavior
Expected normal usage.
```python
import dearpygui.dearpygui as dpg
dpg.create_context()
# add a font registry
with dpg.font_registry():
# first argument ids the path to the .ttf or .otf file
default_font = dpg.add_font("NotoSerifCJKjp-Medium.otf", 20)
second_font = dpg.add_font("NotoSerifCJKjp-Medium.otf", 10)
with dpg.window(label="Font Example", height=200, width=200):
dpg.add_button(label="Default font")
b2 = dpg.add_button(label="Secondary font")
dpg.add_button(label="default")
# set font of specific widget
dpg.bind_font(default_font)
dpg.bind_item_font(b2, second_font)
dpg.show_font_manager()
dpg.create_viewport(title='Custom Title', width=800, height=600)
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()
```
Contributor guide
Assessment
This issue has not been assessed yet.