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
ord('œ̃')... TypeError when processing ligatures #362
Comments
Thanks for opening the ticket. The current font renderer is GDI based. It may be able to be updated to support this, but I'm not sure yet. If possible, can you share some example text? Or, a simple example that shows the crash? That would be very helpful to troubleshoot. |
I just realized that you did share some example text, in the issue title: ord('œ̃') I can confirm your error. import pyglet
pyglet.options["advanced_font_features"] = True |
thank you, benmoran... or is it just Ben? |
I installed from github pyglet-1.5-maintenance; when I run the code, I get this (and this time it's just some text, I haven't gotten to the ligatures yet)
after I close the window, I get this:
|
moreover, when I add the option
it's worth noting, that this specific label was succesfully loaded before, without the option active... |
Post your system specs (including windows build), python specs, the font you are using (if other than default), the label arguments including the full text of what you are trying to display. There is too little information to go off of right now. |
yeah, of course
I was using the default font, also I tried Times New Roman, nothing changed there are 2 different dropouts: the first without 1.
successfully loaded and later on the text of this label is being changed, it works then I try to load this
it crashes on word_layout... 2.
|
and, by the way, I did not install all the windows' recommended system updates.... since 2013 I think... or 2016... the update is switched off on my PC maybe it has something to do with the problem? |
Ok that narrowed it down. I found the issues, I put in a pull request to fix them, we will have to wait until Benjamin takes a look at it and merges it in. Then you will have to update again to test it out, thank you. |
thank you, caffeinePills |
#363 Was merged into 1.5 branch. Try it out and see if you are able to run it. |
Could you provide the HTML string that is causing this issue? |
below are the dictionaries I use, each keyword is brought into a separate pyglet document and separate pyglet layout 'meanings': '< p>< b>from, of, with, by, to...< /b>< /p>', 'word': '< h3>de< /h3>', 'book': '< p>(Harry Potter et la Chambre des Secrets)< /p>', 'ex_list': ["< p>'mourir de faim', 'to die of hunger'< /p>", "< p>'du pain et de la confiture', 'bread and jam'< /p>", "< p>'rouge de colère', 'red with anger'< /p>"], 'info': '[də, d] [de, d’]', 'quote': "< p>< i>...de la magie ! Dobby se souvient comment c'était quand Celui-Dont-On-Ne-Doit-Pas-Prononcer-Le-Nom était au sommet de sa puissance ! Nous, les elfes ...< /i>< /p>" 'meanings': < p>< b>the, him, her, it, them< /b>< /p> 'word': '< h3>le< /h3>', 'book': "< p>(Harry Potter et le Prisonnier d'Azkaban)< /p>", 'ex_list': ["< p>'se casser la jambe', 'to break one’s leg'< /p>", "< p>'le soir', 'in the evening'< /p>", "< p>'le quart de', 'a quarter of'< /p>"], 'info': '[lə, la] [le, la, l’, les]', 'quote': '< p>< i>...que tu racontes ? Hermione se précipita vers la table et retourna le pot au lait. Criant et se ...< /i>< /p>' I'm not sure it's about html though... the html label with simple text is also being shown bolder, its letters closer to each other. But I did not test it with unformatted documents, well (or attributed, if it matters... I did not work with attributed at all, did not grasp the conception, he) p.s. in each of the html tag I added a space, otherwise the redactor ran them no matter what.... how can I tell it to ignore the tags? |
Could you try the new 1.5 maintenance branch and see if that makes a difference? I made some more changes and some fixes. I apologize as I have been busy these past few weeks. |
@timeis-byte Newest release should have all of the latest fixes. |
I'm going to close this now due to age and lack of reply, but please let us know if you still have issues after updating. |
hi everybody!) as the one who raised the issue, I hereby confirm: now everything works just fine ^-^ AK |
I have front.stack, which is a dictionary with some ligatures, french pronunciations
I also have front.bulk, which is a pyglet layout
first I take some texts from front.stack and create a formatted pyglet document like:
second I change the current document of existing pyglet layout:
front.bulk.document = bulk
when done on text without ligatures, that works.
When there are ligatures, it raises TypeError, somewhere deep down the line there happens ord(' some ligature here' )
I understand why it happens technically - ligature is viewed by python as a string of length 2
but what should I do with that? remove all the ligatures from the original text somehow? or modify pyglet module code somehow?
I am not very good at that, so if you have any advice, I would like to hear 'em
thanks in advance ^-^
i got this, by the way:
Exception ignored on calling ctypes callback function: <function Win32Window.get_window_proc..f at 0x0776D610>
Traceback (most recent call last):
File "b:\miniconda3\envs\doors\lib\site-packages\pyglet\window\win32_init.py", line 720, in f
result = event_handler(msg, wParam, lParam)
File "b:\miniconda3\envs\doors\lib\site-packages\pyglet\window\win32_init_.py", line 994, in _event_lbuttondown
return self.event_mousebutton(
File "b:\miniconda3\envs\doors\lib\site-packages\pyglet\window\win32_init.py", line 988, in _event_mousebutton
self.dispatch_event(ev, x, y, button, self.get_modifiers())
File "b:\miniconda3\envs\doors\lib\site-packages\pyglet\window_init.py", line 1333, in dispatch_event
if EventDispatcher.dispatch_event(self, *args) != False:
File "b:\miniconda3\envs\doors\lib\site-packages\pyglet\event.py", line 411, in dispatch_event
self._raise_dispatch_exception(event_type, args, handler, exception)
File "b:\miniconda3\envs\doors\lib\site-packages\pyglet\event.py", line 476, in _raise_dispatch_exception
raise exception
File "b:\miniconda3\envs\doors\lib\site-packages\pyglet\event.py", line 408, in dispatch_event
if handler(*args):
File "B:\PyPro\doors\engine\moves.py", line 496, in on_mouse_press_if_charger
load_next_from_stack()
File "B:\PyPro\doors\engine\moves.py", line 474, in load_next_from_stack
place_the_text(front.stack[ int(front.stack['now']) ] )
File "B:\PyPro\doors\engine\moves.py", line 751, in place_the_text
front.bulk.document = bulk
File "b:\miniconda3\envs\doors\lib\site-packages\pyglet\text\layout.py", line 920, in _set_document
self._init_document()
File "b:\miniconda3\envs\doors\lib\site-packages\pyglet\text\layout.py", line 1034, in _init_document
self._update()
File "b:\miniconda3\envs\doors\lib\site-packages\pyglet\text\layout.py", line 957, in _update
lines = self._get_lines()
File "b:\miniconda3\envs\doors\lib\site-packages\pyglet\text\layout.py", line 933, in _get_lines
glyphs = self._get_glyphs()
File "b:\miniconda3\envs\doors\lib\site-packages\pyglet\text\layout.py", line 1076, in _get_glyphs
glyphs.extend(font.get_glyphs(text[start:end]))
File "b:\miniconda3\envs\doors\lib\site-packages\pyglet\font\base.py", line 386, in get_glyphs
self.glyphs[c] = glyph_renderer.render(c)
File "b:\miniconda3\envs\doors\lib\site-packages\pyglet\font\win32.py", line 427, in render
ord(text), ord(text), byref(abc)):
TypeError: ord() expected a character, but string of length 2 found
The text was updated successfully, but these errors were encountered: