Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The viewport title appears as garbled characters in Chinese #2261

Open
s95050937 opened this issue Jan 22, 2024 · 5 comments
Open

The viewport title appears as garbled characters in Chinese #2261

s95050937 opened this issue Jan 22, 2024 · 5 comments
Labels
state: pending not addressed yet type: bug bug

Comments

@s95050937
Copy link

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 s95050937 added state: pending not addressed yet type: bug bug labels Jan 22, 2024
@v-ein
Copy link
Contributor

v-ein commented Jan 22, 2024

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).

@monkeycc
Copy link

#1760 (comment)
Can the problem be solved?

ocornut/imgui@fe0a24f
DefWindowProcW() instead of DefWindowProc() so that title text are correctly converted
Can the problem be solved?

@v-ein
Copy link
Contributor

v-ein commented Jan 24, 2024

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.

@monkeycc
Copy link

Looking forward to you fixing this issue
thanks

@utmcontent
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: pending not addressed yet type: bug bug
Projects
None yet
Development

No branches or pull requests

4 participants