Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions pgzero/loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@ def getfont(
and so on.

"""
if fontname is not None and sysfontname is not None:
raise ValueError("Can't set both fontname and sysfontname")

fontname = fontname or ptext.DEFAULT_FONT_NAME
fontsize = fontsize or ptext.DEFAULT_FONT_SIZE

Expand All @@ -262,8 +265,9 @@ def getfont(

if key in ptext._font_cache:
return ptext._font_cache[key]

if fontname is None:
if sysfontname is not None:
font = pygame.font.SysFont(sysfontname, fontsize)
elif fontname is None:
font = ptext._font_cache.get(key)
if font:
return font
Expand Down
2 changes: 1 addition & 1 deletion pgzero/ptext.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ def drawbox(text, rect, fontname=None, sysfontname=None, lineheight=None, anchor
y = rect.y + vanchor * rect.height
fontsize = _fitsize(text, fontname, sysfontname, bold, italic, underline,
rect.width, rect.height, lineheight, strip)
return draw(text, (x, y), fontname=fontname, fontsize=fontsize, lineheight=lineheight,
return draw(text, (x, y), fontname=fontname, sysfontname=sysfontname, fontsize=fontsize, lineheight=lineheight,
width=rect.width, strip=strip, anchor=anchor, **kwargs)


Expand Down