DearPyGui icon indicating copy to clipboard operation
DearPyGui copied to clipboard

Chinese fonts not working on macOS

Open Youjin1985 opened this issue 5 months ago • 1 comments

Version of Dear PyGui

Version: 2.1.0 Operating System: macOs 14.6.1 (23G93)

My Issue/Question

I follow documentation https://dearpygui.readthedocs.io/en/latest/documentation/fonts.html and still get ? in place of any Chinese character

To Reproduce

Run the code below...

Expected behavior

Expected Chinese characters

Screenshots/Video

Image

Standalone, minimal, complete and verifiable example

def main():
    viewport_width = dpg.get_viewport_client_width()
    viewport_height = dpg.get_viewport_client_height()

    with dpg.window(tag="Primary Window", label="字体测试", width=viewport_width, height=viewport_height):

        for i in range(10):
            dpg.add_selectable(label=f'字 {i}')

if __name__ == '__main__':
    import dearpygui.dearpygui as dpg
    dpg.create_context()

    with dpg.font_registry():
        with dpg.font("NotoSerifCJKjp-Medium.otf", 20) as font1:
            dpg.add_font_range(0x4e00, 0x9fff)

    dpg.show_font_manager()
    dpg.create_viewport()
    main()
    dpg.setup_dearpygui()
    dpg.show_viewport()
    dpg.start_dearpygui()
    dpg.destroy_context()

Youjin1985 avatar Jul 16 '25 03:07 Youjin1985

ok it works if I add 'dpg.bind_font(font1)' after dpg.add_font_range(0x4e00, 0x9fff)

HOW ABOUT YOU ADD IT TO DOCUMENTATION PLEASE???

Youjin1985 avatar Jul 16 '25 03:07 Youjin1985