@@ -741,6 +741,29 @@ def test_ft2font_set_text():
741741 assert font .get_bitmap_offset () == (6 , 0 )
742742
743743
744+ def test_ft2font_loading ():
745+ file = fm .findfont ('DejaVu Sans' )
746+ font = ft2font .FT2Font (file , hinting_factor = 1 , _kerning_factor = 0 )
747+ for glyph in [font .load_char (ord ('M' )),
748+ font .load_glyph (font .get_char_index (ord ('M' )))]:
749+ assert glyph is not None
750+ assert glyph .width == 576
751+ assert glyph .height == 576
752+ assert glyph .horiBearingX == 0
753+ assert glyph .horiBearingY == 576
754+ assert glyph .horiAdvance == 640
755+ assert glyph .linearHoriAdvance == 678528
756+ assert glyph .vertBearingX == - 384
757+ assert glyph .vertBearingY == 64
758+ assert glyph .vertAdvance == 832
759+ assert glyph .bbox == (54 , 0 , 574 , 576 )
760+ assert font .get_num_glyphs () == 2 # Both count as loaded.
761+ # But neither has been placed anywhere.
762+ assert font .get_width_height () == (0 , 0 )
763+ assert font .get_descent () == 0
764+ assert font .get_bitmap_offset () == (0 , 0 )
765+
766+
744767@pytest .mark .parametrize ('family_name, file_name' ,
745768 [("WenQuanYi Zen Hei" , "wqy-zenhei.ttc" ),
746769 ("Noto Sans CJK JP" , "NotoSansCJK.ttc" ),
0 commit comments