Skip to content

Commit a975224

Browse files
committed
Fix some bugs
1 parent fca9305 commit a975224

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src_c/font.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,10 @@ font_getter_style_name(PyObject *self, void *closure)
832832
static int
833833
font_setter_outline(PyObject *self, PyObject *value, void *closure)
834834
{
835+
if (!PgFont_GenerationCheck(self)) {
836+
RAISE_FONT_QUIT_ERROR_RETURN(-1);
837+
}
838+
835839
TTF_Font *font = PyFont_AsFont(self);
836840
int val;
837841

@@ -846,6 +850,10 @@ font_setter_outline(PyObject *self, PyObject *value, void *closure)
846850
static PyObject *
847851
font_getter_outline(PyObject *self, void *closure)
848852
{
853+
if (!PgFont_GenerationCheck(self)) {
854+
return RAISE_FONT_QUIT_ERROR();
855+
}
856+
849857
return PyLong_FromLong(TTF_GetFontOutline(PyFont_AsFont(self)));
850858
}
851859

@@ -1079,7 +1087,7 @@ static PyGetSetDef font_getsets[] = {
10791087
{"point_size", (getter)font_getter_point_size,
10801088
(setter)font_setter_point_size, DOC_FONT_FONT_POINTSIZE, NULL},
10811089
{"outline", (getter)font_getter_outline, (setter)font_setter_outline,
1082-
"TODO", NULL},
1090+
DOC_FONT_FONT_OUTLINE, NULL},
10831091
{NULL, NULL, NULL, NULL, NULL}};
10841092

10851093
static PyMethodDef font_methods[] = {

test/font_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,6 @@ def test_font_property_should_raise_exception_after_quit(self):
953953
("fixed_width", None),
954954
("fixed_sizes", None),
955955
("antialiased", 45),
956-
("outline", 10),
957956
("kerning", 46),
958957
("vertical", 47),
959958
("pad", 48),
@@ -993,6 +992,10 @@ def test_font_property_should_raise_exception_after_quit(self):
993992
properties.append(("point_size", 1))
994993
else:
995994
skip_properties.add("point_size")
995+
if version >= (2, 0, 12):
996+
properties.append(("outline", 2006))
997+
else:
998+
skip_properties.add("outline")
996999

9971000
font = pygame_font.Font(None, 10)
9981001
actual_names = []

0 commit comments

Comments
 (0)