Skip to content

Commit b429078

Browse files
committed
Add stub for sysfont
1 parent 0468555 commit b429078

File tree

3 files changed

+24
-15
lines changed

3 files changed

+24
-15
lines changed

buildconfig/stubs/mypy_allow_list.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,4 @@ pygame\.newbuffer
2525
pygame\.pkgdata
2626
pygame\.pypm
2727
pygame\._sdl2\.mixer
28-
pygame\.sysfont.*
2928
pygame\.docs.*

buildconfig/stubs/pygame/font.pyi

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
from typing import Callable, Hashable, Iterable, List, Literal, Optional, Tuple, Union
1+
from typing import List, Literal, Optional, Tuple, Union
22

33
from pygame.surface import Surface
44

5+
from pygame.sysfont import (
6+
get_fonts as get_fonts,
7+
match_font as match_font,
8+
SysFont as SysFont,
9+
)
10+
511
from pygame.typing import ColorLike, FileLike
612

713
# TODO: Figure out a way to type this attribute such that mypy knows it's not
@@ -13,19 +19,6 @@ def quit() -> None: ...
1319
def get_init() -> bool: ...
1420
def get_sdl_ttf_version(linked: bool = True) -> Tuple[int, int, int]: ...
1521
def get_default_font() -> str: ...
16-
def get_fonts() -> List[str]: ...
17-
def match_font(
18-
name: Union[str, bytes, Iterable[Union[str, bytes]]],
19-
bold: Hashable = False,
20-
italic: Hashable = False,
21-
) -> str: ...
22-
def SysFont(
23-
name: Union[str, bytes, Iterable[Union[str, bytes]], None],
24-
size: int,
25-
bold: Hashable = False,
26-
italic: Hashable = False,
27-
constructor: Optional[Callable[[Optional[str], int, bool, bool], Font]] = None,
28-
) -> Font: ...
2922

3023
class Font:
3124
@property

buildconfig/stubs/pygame/sysfont.pyi

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
from typing import Callable, Hashable, Iterable, List, Optional, Union
2+
3+
from pygame.font import Font
4+
5+
def get_fonts() -> List[str]: ...
6+
def match_font(
7+
name: Union[str, bytes, Iterable[Union[str, bytes]]],
8+
bold: Hashable = False,
9+
italic: Hashable = False,
10+
) -> str: ...
11+
def SysFont(
12+
name: Union[str, bytes, Iterable[Union[str, bytes]], None],
13+
size: int,
14+
bold: Hashable = False,
15+
italic: Hashable = False,
16+
constructor: Optional[Callable[[Optional[str], int, bool, bool], Font]] = None,
17+
) -> Font: ...

0 commit comments

Comments
 (0)