@@ -181,12 +181,12 @@ def test_textbbox_equal(font: ImageFont.FreeTypeFont) -> None:
181181 # basic test
182182 ("text" , "L" , "FreeMono.ttf" , 15 , 36 , 36 ),
183183 ("text" , "1" , "FreeMono.ttf" , 15 , 36 , 36 ),
184- # issue 4177
185- ("rrr" , "L" , "DejaVuSans/DejaVuSans.ttf" , 18 , 21 , 22.21875 ),
184+ # issue 4177; mode "1" is placed on whole pixels, so it still differs
185+ ("rrr" , "L" , "DejaVuSans/DejaVuSans.ttf" , 18 , 22.21875 , 22.21875 ),
186186 ("rrr" , "1" , "DejaVuSans/DejaVuSans.ttf" , 18 , 24 , 22.21875 ),
187187 # test 'l' not including extra margin
188188 # using exact value 2047 / 64 for raqm, checked with debugger
189- ("ill" , "L" , "OpenSansCondensed-LightItalic.ttf" , 63 , 33 , 31.984375 ),
189+ ("ill" , "L" , "OpenSansCondensed-LightItalic.ttf" , 63 , 31.984375 , 31.984375 ),
190190 ("ill" , "1" , "OpenSansCondensed-LightItalic.ttf" , 63 , 33 , 31.984375 ),
191191 ),
192192)
@@ -196,7 +196,7 @@ def test_getlength(
196196 fontname : str ,
197197 size : int ,
198198 layout_engine : ImageFont .Layout ,
199- length_basic : int ,
199+ length_basic : float ,
200200 length_raqm : float ,
201201) -> None :
202202 f = ImageFont .truetype ("Tests/fonts/" + fontname , size , layout_engine = layout_engine )
@@ -887,10 +887,7 @@ def test_anchor(
887887 name , text = "quick" , "Quick"
888888 path = f"Tests/images/test_anchor_{ name } _{ anchor } .png"
889889
890- if layout_engine == ImageFont .Layout .RAQM :
891- width , height = (129 , 44 )
892- else :
893- width , height = (128 , 44 )
890+ width , height = (129 , 44 )
894891
895892 bbox_expected = (left , top , left + width , top + height )
896893
@@ -945,7 +942,9 @@ def test_anchor_multiline(
945942 d .line (((300 , 0 ), (300 , 400 )), "gray" )
946943 d .multiline_text ((300 , 200 ), text , fill = "black" , anchor = anchor , font = f , align = align )
947944
948- assert_image_similar_tofile (im , target , 4 )
945+ # the reference is shared between the layout engines, and they no longer
946+ # differ by more than the GPOS kerning that basic layout cannot apply
947+ assert_image_similar_tofile (im , target , 6 )
949948
950949
951950def test_anchor_invalid (font : ImageFont .FreeTypeFont ) -> None :
0 commit comments