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

outline_width crashing mpf when using special characters. #1705

Open
Pucksnok opened this issue Jul 21, 2023 · 6 comments
Open

outline_width crashing mpf when using special characters. #1705

Pucksnok opened this issue Jul 21, 2023 · 6 comments

Comments

@Pucksnok
Copy link

Pucksnok commented Jul 21, 2023

Hello.
Been trying the new feature outline_width with my code. After some trial and error I think I know why it crash my MPF (v.0.56.x).

When I use special characters in my text it freeze/crash MPF with no error message in logging or in terminal, without special characters it works great.

Example to crash... excuse the formating.

- type: text
  text: Pokémon
  outline_width: 2

Example where it works... excuse formating.

- type: text
  text: Pokemon
  outline_width: 2
@Pucksnok
Copy link
Author

Can also add if setting the outline_width too high it freeze as well, for example outline_width: 2 works perfect while outline_width: 8 freeze the kivy window, timers etc. still run in console.

@toomanybrians
Copy link
Member

I wonder if this happens if the font you use does not include the special character? As for the outline_width, I don't really have a guess there.

For both of these, the code in MPF-MC is very simple, anything you set in a config is just passed on to Kivy (which is the Python multimedia interface MPF-MC uses). So troubleshooting this would be a Kivy issue and something to figure out with that project and their forums.

As an example, here are the only instances of "outline_width" in all of MPF-MC, in the file mpfmc/widgets/text.py:

    def _get_outline_width(self) -> Optional[int]:
        return self._label.outline_width

    def _set_outline_width(self, outline_width: Optional[int]) -> None:
        self._label.outline_width = outline_width

    outline_width = AliasProperty(_get_outline_width, _set_outline_width)

So really there's not much we can do at the MPF-MC level.

One option would be to update the documentation with a note that the outline width might crash if it gets too big? And then depending on what you figure out with the fonts and special characters, maybe a doc update there too?

Sorry we don't have a better answer!

@Pucksnok
Copy link
Author

Thanks, I will try a bit with other fonts. I use impact that's in the fonts-folder in my machines folder.

Will do an update if/when I get some progress. Well try and do some update to documentation if it's the same with other fonts and I can get someone to replicate it with code.

Cheers.

@Pucksnok
Copy link
Author

Just updating with what I find.

If I wait when it freeze instead of closing mpf/mpfmc I get a error message with (0xC0000028), seems I can find some stuff with it and this looks to be the issue..

_The workaround from #7914 works fine:

import os os.environ['KIVY_TEXT'] = 'pil'

The second working workaround is to update library:

venv\share\sdl2\bin\SDL2_ttf.dll

from 2.0.18 to latest one 2.20.1
https://github.com/libsdl-org/SDL_ttf/releases

Seems this bug was fixed starting from 2.19.2 (Fixed crash when loading fonts at certain sizes on Windows) SDL_ttf issue_

kivy/kivy#7914

kivy/kivy#8108

I will try and install a nightly master edition of Kivy and see if it works, not sure mpf-mc allows it but can't hurt to try.

@Pucksnok
Copy link
Author

I will also try this on my Linux machine, my guess it should work without issue there. I will report back on Sunday when I have the time to test.

@toomanybrians
Copy link
Member

This looks really promising! (The update from SDL ttf 2.0.x to 2.20.x.) The way those get installed varies per platform, but it's definitely possible to update them. And also, yeah, you should be able to run with any version of Kivy. I've been using 2.1.0 in my MPF 0.57 dev branch which seems fine, so even moving to the latest release of 2.2.1 might help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants