Not able to display Hindi words/characters (with matras/ diacritics/ vowels)

OS: Win 10
PsychoPy version : 2022.2.4
Standard Standalone? y
What are you trying to achieve?: Just trying to display text stimulus (display_word.zip)

What did you try to make it work?

python code

import psychopy.visual
import psychopy.event

win = psychopy.visual.Window(size=[400, 400],units="pix",fullscr=False)

#word_to_display = "hello" #displays correctly
#word_to_display = "कमल" #displays correctly, क + म + ल
word_to_display = "कमाल" #displays incorrectly, क + म + ा + ल

text = psychopy.visual.TextStim(win=win,text=word_to_display)
text.draw()

win.flip()
psychopy.event.waitKeys()
win.close()

builder Download zip file from here: display_word.zip

What specifically went wrong when you tried that?

C:\Users\XXXXXXXXXXXXXXX\Desktop\codes\PsychopyHindi>python test_by_code.py
pygame 2.1.0 (SDL 2.0.16, Python 3.8.10)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "test_by_code.py", line 10, in <module>
    text = psychopy.visual.TextStim(win=win,text=word_to_display)
  File "C:\Program Portable\PsychoPy\psychopy_2022.2\lib\site-packages\psychopy\visual\text.py", line 227, in __init__
    self.setText(text, log=False)
  File "C:\Program Portable\PsychoPy\psychopy_2022.2\lib\site-packages\psychopy\visual\text.py", line 387, in setText
    setAttribute(self, 'text', text, log)
  File "C:\Program Portable\PsychoPy\psychopy_2022.2\lib\site-packages\psychopy\tools\attributetools.py", line 134, in setAttribute
    setattr(self, attrib, value)
  File "C:\Program Portable\PsychoPy\psychopy_2022.2\lib\site-packages\psychopy\tools\attributetools.py", line 27, in __set__
    newValue = self.func(obj, value)
  File "C:\Program Portable\PsychoPy\psychopy_2022.2\lib\site-packages\psychopy\visual\text.py", line 378, in text
    self._setTextShaders(text)
  File "C:\Program Portable\PsychoPy\psychopy_2022.2\lib\site-packages\psychopy\visual\text.py", line 396, in _setTextShaders
    self._pygletTextObj = pyglet.text.Label(
  File "C:\Program Portable\PsychoPy\psychopy_2022.2\lib\site-packages\pyglet\text\__init__.py", line 452, in __init__
    super(Label, self).__init__(document, x, y, width, height,
  File "C:\Program Portable\PsychoPy\psychopy_2022.2\lib\site-packages\pyglet\text\__init__.py", line 273, in __init__
    super(DocumentLabel, self).__init__(document,
  File "C:\Program Portable\PsychoPy\psychopy_2022.2\lib\site-packages\pyglet\text\layout.py", line 820, in __init__
    self.document = document
  File "C:\Program Portable\PsychoPy\psychopy_2022.2\lib\site-packages\pyglet\text\layout.py", line 929, in _set_document
    self._init_document()
  File "C:\Program Portable\PsychoPy\psychopy_2022.2\lib\site-packages\pyglet\text\layout.py", line 1043, in _init_document
    self._update()
  File "C:\Program Portable\PsychoPy\psychopy_2022.2\lib\site-packages\pyglet\text\layout.py", line 966, in _update
    lines = self._get_lines()
  File "C:\Program Portable\PsychoPy\psychopy_2022.2\lib\site-packages\pyglet\text\layout.py", line 942, in _get_lines
    glyphs = self._get_glyphs()
  File "C:\Program Portable\PsychoPy\psychopy_2022.2\lib\site-packages\pyglet\text\layout.py", line 1085, in _get_glyphs
    glyphs.extend(font.get_glyphs(text[start:end]))
  File "C:\Program Portable\PsychoPy\psychopy_2022.2\lib\site-packages\pyglet\font\base.py", line 394, in get_glyphs
    self.glyphs[c] = glyph_renderer.render(c)
  File "C:\Program Portable\PsychoPy\psychopy_2022.2\lib\site-packages\pyglet\font\win32.py", line 432, in render
    ord(text), ord(text), byref(abc)):
TypeError: ord() expected a character, but string of length 2 found
3.3274  WARNING         Monitor specification not found. Creating a temporary one...

I also opened a thread on PsychoPy github repo:

Thanks for making this possible. PsychoPy have been really helpful for us.

Hey, I am also facing the same issue currently. were you able to sort this out?

Not yet, we switched our experiment to jsPsych for now. As mentioned by @jon on Github thread, it might be worth checking the new and updated Textbox2 component. It might work.

Thank you so much! the textbox2 component works and I am able to display the texts in Hindi using the Noto Sans font. But for other south Indian languages, it seems this font is not compatible. Do you have any font suggestions that I can try, which you think might work?

No idea, you might have to do hit and trial, or raise an issue here with broken images of text.