#1006435 bouncy: leveleditor does not start (pygame.error: font not initialized)

Package:
bouncy
Source:
bouncy
Submitter:
Bernhard Reiter
Date:
2022-02-25 12:18:03 UTC
Severity:
minor
Tags:
#1006435#5
Date:
2022-02-25 12:07:23 UTC
From:
To:
Dear Maintainer,

the included level editor does not start, due to a font error.
Expected behaviour: it should start.
Potential fix: see patch below.

Thanks for maintaining bouncy, it is one of the few games suitable
for smaller children.

Best Regards,
Bernhard

== reproduction
Start the level editor like

pushd /usr/share/games/bouncy/
python leveledit.py data/level2.csv
[..]
Traceback (most recent call last):
  File "leveledit.py", line 2, in <module>
    import fonts
  File "/usr/share/games/bouncy/fonts.py", line 6, in <module>
    size=20, bold=False, italic=False)
  File "/usr/share/games/bouncy/pyglyph/font.py", line 74, in get_font
    font = self.impl_get_font(family, size, bold, italic)
  File "/usr/share/games/bouncy/pyglyph/font.py", line 165, in impl_get_font
    fake_italic=fake_italic)
  File "/usr/share/games/bouncy/pyglyph/font.py", line 255, in __init__
    self.pygame_font = pygame.font.Font(filename, size)
pygame.error: font not initialized

== potential fix
The same file font.py works for the main game, so when switching
the import order to be similiar to game.py, the level editor comes up.
--- leveledit.py.orig   2020-12-23 11:34:17.522314902 +0100
+++ leveledit.py        2020-12-23 11:34:28.982508935 +0100
@@ -1,5 +1,4 @@
 import sys, pygame, csv, shutil, os
-import fonts
 from pygame.locals import *
 from pygame.constants import *

@@ -13,6 +12,7 @@
 pygame.display.set_mode(viewport, OPENGL | DOUBLEBUF)

 import objects
+import fonts

 import pyglyph