Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a2de756

Browse files
authored
Merge pull request #15078 from anntzer/ft2fontdoc
Clarify docstring of FT2Font.get_glyph_name.
2 parents fece8e8 + 4c5079e commit a2de756

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/ft2font_wrapper.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -945,19 +945,20 @@ static PyObject *PyFT2Font_draw_glyph_to_bitmap(PyFT2Font *self, PyObject *args,
945945
const char *PyFT2Font_get_glyph_name__doc__ =
946946
"get_glyph_name(index)\n"
947947
"\n"
948-
"Retrieves the ASCII name of a given glyph in a face.\n";
948+
"Retrieves the ASCII name of a given glyph in a face.\n"
949+
"\n"
950+
"Due to Matplotlib's internal design, for fonts that do not contain glyph \n"
951+
"names (per FT_FACE_FLAG_GLYPH_NAMES), this returns a made-up name which \n"
952+
"does *not* roundtrip through `.get_name_index`.\n";
949953

950954
static PyObject *PyFT2Font_get_glyph_name(PyFT2Font *self, PyObject *args, PyObject *kwds)
951955
{
952956
unsigned int glyph_number;
953957
char buffer[128];
954-
955958
if (!PyArg_ParseTuple(args, "I:get_glyph_name", &glyph_number)) {
956959
return NULL;
957960
}
958-
959961
CALL_CPP("get_glyph_name", (self->x->get_glyph_name(glyph_number, buffer)));
960-
961962
return PyUnicode_FromString(buffer);
962963
}
963964

0 commit comments

Comments
 (0)