@@ -370,7 +370,9 @@ def test_TTF_GlyphMetrics(with_sdl_ttf):
370370 results = [x .value for x in (minX , maxX , minY , maxY , adv )]
371371 assert sdlttf .TTF_GetError () == b""
372372 assert ret == 0
373- assert results == expected [char ]
373+ # Allow deviation of up to 1px
374+ # With FreeType >= 2.14.0 maxY for 'j' is 29 instead of expected 28
375+ assert results == pytest .approx (expected [char ], abs = 1 )
374376 sdlttf .TTF_CloseFont (font )
375377
376378@pytest .mark .skipif (sdlttf .dll .version < 2018 , reason = "not available" )
@@ -391,12 +393,14 @@ def test_TTF_GlyphMetrics32(with_sdl_ttf):
391393 results = [x .value for x in (minX , maxX , minY , maxY , adv )]
392394 assert sdlttf .TTF_GetError () == b""
393395 assert ret == 0
394- assert results == expected [char ]
396+ # Allow deviation of up to 1px
397+ # With FreeType >= 2.14.0 maxY for 'j' is 29 instead of expected 28
398+ assert results == pytest .approx (expected [char ], abs = 1 )
395399 sdlttf .TTF_CloseFont (font )
396400
397401def test_TTF_SizeText (with_font ):
398402 font = with_font
399- min_expected_w = 69 # SDL2_ttf 2.0.18
403+ min_expected_w = 67 # SDL2_tff 2.22.0 with FreeType >= 2.14.0
400404 max_expected_w = 70 # SDL2_ttf <= 2.0.15
401405 min_expected_h = 21 # SDL2_ttf 2.0.15 with FreeType 2.10.1
402406 max_expected_h = 25 # SDL2_ttf < 2.0.15
@@ -409,7 +413,7 @@ def test_TTF_SizeText(with_font):
409413
410414def test_TTF_SizeUTF8 (with_font ):
411415 font = with_font
412- min_expected_w = 72 # SDL2_ttf 2.0.18
416+ min_expected_w = 70 # SDL2_tff 2.22.0 with FreeType >= 2.14.0
413417 max_expected_w = 73 # SDL2_ttf <= 2.0.15
414418 min_expected_h = 21 # SDL2_ttf 2.0.15 with FreeType 2.10.1
415419 max_expected_h = 25 # SDL2_ttf < 2.0.15
@@ -422,7 +426,7 @@ def test_TTF_SizeUTF8(with_font):
422426
423427def test_TTF_SizeUNICODE (with_font ):
424428 font = with_font
425- min_expected_w = 69 # SDL2_ttf 2.0.18
429+ min_expected_w = 67 # SDL2_tff 2.22.0 with FreeType >= 2.14.0
426430 max_expected_w = 70 # SDL2_ttf <= 2.0.15
427431 min_expected_h = 21 # SDL2_ttf 2.0.15 with FreeType 2.10.1
428432 max_expected_h = 25 # SDL2_ttf < 2.0.15
0 commit comments