DearPyGui icon indicating copy to clipboard operation
DearPyGui copied to clipboard

The viewport title appears as garbled characters in Chinese

Open s95050937 opened this issue 1 year ago • 6 comments

I have currently set the viewport title to Traditional Chinese. The Chinese displayed within the window is correct. However, I've noticed that the Chinese display becomes garbled in the title bar and the name when the application is minimized. Is there any way to fix this issue?

import dearpygui.dearpygui as dpg
import dearpygui.dearpygui as dpg
dpg.create_context()

reg = dpg.add_font_registry()
fontName = dpg.add_font(file="C:\Windows\Fonts\msjh.ttc", size=18, parent=reg)
dpg.add_font_range(0x0001, 0x9FFF, parent=fontName)
dpg.bind_font(fontName)
with dpg.window():
    dpg.add_button(label='測試')
dpg.create_viewport(title="測試", width=1000, height=500)
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()

image image

s95050937 avatar Jan 22 '24 09:01 s95050937

A bit of explanation (from the corresponding Discord thread):

It's an issue with how DPG configures viewport title on Windows. Quite similar to tickets #1075, #2212, and ImGui ticket #5725 (but occurs in a different place in the code). Reported to ImGui repo as #5975.

Basically mvPrerender() on Win32 uses SetWindowTextA() to set window title, but it passes in a UTF8-encoded string, which is very wrong.

Until the issue is fixed, I'd recommend to use plain ASCII for the window title (yep, that restricts it to English-only text).

v-ein avatar Jan 22 '24 15:01 v-ein

https://github.com/hoffstadt/DearPyGui/issues/1760#issuecomment-1217108500 Can the problem be solved?

https://github.com/ocornut/imgui/commit/fe0a24f38a3501906bd304b381e3510fce9b8891 DefWindowProcW() instead of DefWindowProc() so that title text are correctly converted Can the problem be solved?

monkeycc avatar Jan 24 '24 15:01 monkeycc

Can the problem be solved?

Yes, in a couple of different ways. I'm not sure yet which one should be implemented. Depends on how the build process is set up.

v-ein avatar Jan 24 '24 17:01 v-ein

Looking forward to you fixing this issue thanks

monkeycc avatar Jan 25 '24 09:01 monkeycc

file="C:\Windows\Fonts\msjh.ttc", size=18, parent=reg Wrong font file for title drag rectangle.

utmcontent avatar Feb 21 '24 03:02 utmcontent