@@ -678,6 +678,29 @@ def test_ft2font_get_sfnt_table(font_name, header):
678
678
assert font .get_sfnt_table (header ) == _expected_sfnt_tables [font_name ][header ]
679
679
680
680
681
+ @pytest .mark .parametrize ('left, right, unscaled, unfitted, default' , [
682
+ # These are all the same class.
683
+ ('A' , 'A' , 57 , 248 , 256 ), ('A' , 'À' , 57 , 248 , 256 ), ('A' , 'Á' , 57 , 248 , 256 ),
684
+ ('A' , 'Â' , 57 , 248 , 256 ), ('A' , 'Ã' , 57 , 248 , 256 ), ('A' , 'Ä' , 57 , 248 , 256 ),
685
+ # And a few other random ones.
686
+ ('D' , 'A' , - 36 , - 156 , - 128 ), ('T' , '.' , - 243 , - 1056 , - 1024 ),
687
+ ('X' , 'C' , - 149 , - 647 , - 640 ), ('-' , 'J' , 114 , 495 , 512 ),
688
+ ])
689
+ def test_ft2font_get_kerning (left , right , unscaled , unfitted , default ):
690
+ file = fm .findfont ('DejaVu Sans' )
691
+ font = ft2font .FT2Font (file , hinting_factor = 1 , _kerning_factor = 0 )
692
+ font .set_size (100 , 100 )
693
+ assert font .get_kerning (font .get_char_index (ord (left )),
694
+ font .get_char_index (ord (right )),
695
+ ft2font .KERNING_UNSCALED ) == unscaled
696
+ assert font .get_kerning (font .get_char_index (ord (left )),
697
+ font .get_char_index (ord (right )),
698
+ ft2font .KERNING_UNFITTED ) == unfitted
699
+ assert font .get_kerning (font .get_char_index (ord (left )),
700
+ font .get_char_index (ord (right )),
701
+ ft2font .KERNING_DEFAULT ) == default
702
+
703
+
681
704
@pytest .mark .parametrize ('family_name, file_name' ,
682
705
[("WenQuanYi Zen Hei" , "wqy-zenhei.ttc" ),
683
706
("Noto Sans CJK JP" , "NotoSansCJK.ttc" ),
0 commit comments