Fix font name for windows
This commit is contained in:
parent
df457cd467
commit
039e6be501
|
@ -340,11 +340,12 @@ class HUD(object):
|
|||
def __init__(self, width, height):
|
||||
self.dim = (width, height)
|
||||
font = pygame.font.Font(pygame.font.get_default_font(), 20)
|
||||
fonts = [x for x in pygame.font.get_fonts() if 'mono' in x]
|
||||
font_name = 'courier' if os.name == 'nt' else 'mono'
|
||||
fonts = [x for x in pygame.font.get_fonts() if font_name in x]
|
||||
default_font = 'ubuntumono'
|
||||
mono = default_font if default_font in fonts else fonts[0]
|
||||
mono = pygame.font.match_font(mono)
|
||||
self._font_mono = pygame.font.Font(mono, 14)
|
||||
self._font_mono = pygame.font.Font(mono, 12 if os.name == 'nt' else 14)
|
||||
self._notifications = FadingText(font, (width, 40), (0, height - 40))
|
||||
self.help = HelpText(pygame.font.Font(mono, 24), width, height)
|
||||
self.server_fps = 0
|
||||
|
|
|
@ -419,14 +419,12 @@ class HUD(object):
|
|||
def __init__(self, width, height):
|
||||
self.dim = (width, height)
|
||||
font = pygame.font.Font(pygame.font.get_default_font(), 20)
|
||||
if os.name == 'nt':
|
||||
fonts = [x for x in pygame.font.get_fonts() if 'arial' in x]
|
||||
else:
|
||||
fonts = [x for x in pygame.font.get_fonts() if 'mono' in x]
|
||||
font_name = 'courier' if os.name == 'nt' else 'mono'
|
||||
fonts = [x for x in pygame.font.get_fonts() if font_name in x]
|
||||
default_font = 'ubuntumono'
|
||||
mono = default_font if default_font in fonts else fonts[0]
|
||||
mono = pygame.font.match_font(mono)
|
||||
self._font_mono = pygame.font.Font(mono, 14)
|
||||
self._font_mono = pygame.font.Font(mono, 12 if os.name == 'nt' else 14)
|
||||
self._notifications = FadingText(font, (width, 40), (0, height - 40))
|
||||
self.help = HelpText(pygame.font.Font(mono, 24), width, height)
|
||||
self.server_fps = 0
|
||||
|
|
|
@ -383,11 +383,12 @@ class HUD(object):
|
|||
def __init__(self, width, height):
|
||||
self.dim = (width, height)
|
||||
font = pygame.font.Font(pygame.font.get_default_font(), 20)
|
||||
fonts = [x for x in pygame.font.get_fonts() if 'mono' in x]
|
||||
font_name = 'courier' if os.name == 'nt' else 'mono'
|
||||
fonts = [x for x in pygame.font.get_fonts() if font_name in x]
|
||||
default_font = 'ubuntumono'
|
||||
mono = default_font if default_font in fonts else fonts[0]
|
||||
mono = pygame.font.match_font(mono)
|
||||
self._font_mono = pygame.font.Font(mono, 14)
|
||||
self._font_mono = pygame.font.Font(mono, 12 if os.name == 'nt' else 14)
|
||||
self._notifications = FadingText(font, (width, 40), (0, height - 40))
|
||||
self.help = HelpText(pygame.font.Font(mono, 24), width, height)
|
||||
self.server_fps = 0
|
||||
|
|
|
@ -272,7 +272,8 @@ class HUD (object):
|
|||
|
||||
def _init_hud_params(self):
|
||||
"""Initialized visual parameters such as font text and size"""
|
||||
fonts = [x for x in pygame.font.get_fonts() if 'mono' in x]
|
||||
font_name = 'courier' if os.name == 'nt' else 'mono'
|
||||
fonts = [x for x in pygame.font.get_fonts() if font_name in x]
|
||||
default_font = 'ubuntumono'
|
||||
mono = default_font if default_font in fonts else fonts[0]
|
||||
mono = pygame.font.match_font(mono)
|
||||
|
|
Loading…
Reference in New Issue