diff --git a/lib/matplotlib/tests/test_text.py b/lib/matplotlib/tests/test_text.py index 83b65be400db..b43222cbb9c4 100644 --- a/lib/matplotlib/tests/test_text.py +++ b/lib/matplotlib/tests/test_text.py @@ -1317,3 +1317,8 @@ def test_draw_text_as_path_fallback(monkeypatch): _test_complex_shaping(subfig[0]) _test_text_features(subfig[1]) _test_text_language(subfig[2]) +def test_small_chinese_character_rendering(): + fig, ax = plt.subplots() + ax.text(0.5, 0.5, '字体', fontsize=6) + # Smoke test to ensure it renders without crashing + fig.canvas.draw() \ No newline at end of file diff --git a/src/ft2font.cpp b/src/ft2font.cpp index 3e53a87343a6..a2bcad884421 100644 --- a/src/ft2font.cpp +++ b/src/ft2font.cpp @@ -639,7 +639,8 @@ bool FT2Font::load_char_with_fallback(FT2Font *&ft_object_with_glyph, void FT2Font::load_glyph(FT_UInt glyph_index, FT_Int32 flags) { - FT_CHECK(FT_Load_Glyph, face, glyph_index, flags); + // Force vector outlines by ignoring embedded bitmaps to fix small character rendering + FT_CHECK(FT_Load_Glyph, face, glyph_index, flags | FT_LOAD_NO_BITMAP); FT_Glyph thisGlyph; FT_CHECK(FT_Get_Glyph, face->glyph, &thisGlyph); glyphs.push_back(thisGlyph);