DearPyGui icon indicating copy to clipboard operation
DearPyGui copied to clipboard

Viewport name and input fields don't properly support Latin extended

Open Ondrejtra opened this issue 3 years ago • 3 comments

Version: 1.3.1 Operating System: Windows 10 21H1

Keyboard layout: CES (Czech QWERTZ) Code is saved with UTF-8 encoding.

My Issue/Question

Creating a viewport that uses Latin extended characters causes them to become messed up. Typing Latin extended characters into a text input field causes a similar issue, which doesn't appear when pasting the same range of characters or showing them as a default value.

To Reproduce

Create a viewport that uses Latin extended characters, or type Latin extended into a text input field. Pasting instead of typing into the input field does not trigger the issue.

Expected behavior

Latin extended characters appear correctly, like when shown in a text field.

Screenshots/Video

image

  • The first input uses a default value, the second input has the same characters typed.
  • The text is to demonstrate the font range is bound correctly.
  • The viewport uses the same default value.

Standalone, minimal, complete and verifiable example

import dearpygui.dearpygui as dpg

test_text = "á č ď é ě í ň ó ř š ť ú ů ý ž Á Č Ď É Ě Í Ň Ó Ř Š Ť Ú Ů Ý Ž abcdefghijklmnopqrstuvwxyz"

dpg.create_context()

with dpg.font_registry():
    with dpg.font("UbuntuMono-R.ttf", 15) as font1:
        dpg.add_font_range(0x0100, 0x017F)
    dpg.bind_font(font1)

with dpg.window(label="Input window", width=1000, height=500):
    dpg.add_input_text(default_value=test_text)
    dpg.add_input_text()
    dpg.add_text(default_value=test_text)

dpg.create_viewport(
    title=test_text,
    width=1280,
    height=720)

dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()

Ubuntu font can be downloaded here: https://design.ubuntu.com/font/ The same issue can be observed with GNU Unifont (to prove it is not font-specific): https://unifoundry.com/unifont/index.html

Ondrejtra avatar Jan 23 '22 14:01 Ondrejtra

I can confirm this, Hungarian characters are garbled as well.

misigun avatar Apr 21 '22 09:04 misigun

We will address this ASAP.

hoffstadt avatar Apr 27 '22 21:04 hoffstadt

I my case there is nothing wrong with viewport title. But bug with input and Russian symbols I can confirm too. изображение

Code is the same except two changes. First changes symbols to Russian:

# test_text = "á č ď é ě í ň ó ř š ť ú ů ý ž Á Č Ď É Ě Í Ň Ó Ř Š Ť Ú Ů Ý Ž abcdefghijklmnopqrstuvwxyz"
test_text = "а б в г д е ё ж з и й к л м н о п р с т у ф х ц ч ш щ ь ы ъ э ю я abcdefghijklmnopqrstuvwxyz"

Second changes font range:

        # dpg.add_font_range(0x0100, 0x017F)
        dpg.add_font_range_hint(dpg.mvFontRangeHint_Cyrillic)

For me I solve this problem using remapping with next code:

        # remapping capital and small "ё"
        dpg.add_char_remap(0xa8, 0x401)
        dpg.add_char_remap(0xb8, 0x451)
        # set counter value equal to utf8 code of Russian capital "А" with consequent remapping from "А" to "я"
        utf = 0x410
        for i in range(0xc0, 0x100):
            dpg.add_char_remap(i, utf)
            utf += 1

vanekrus avatar Aug 04 '22 02:08 vanekrus