diff --git a/src/ft2font_wrapper.cpp b/src/ft2font_wrapper.cpp index 102cfbda3dac..98e9ff74f77a 100644 --- a/src/ft2font_wrapper.cpp +++ b/src/ft2font_wrapper.cpp @@ -635,11 +635,10 @@ static PyObject *PyFT2Font_set_text(PyFT2Font *self, PyObject *args, PyObject *k size_t size; if (PyUnicode_Check(textobj)) { - size = PyUnicode_GET_SIZE(textobj); + size = PyUnicode_GET_LENGTH(textobj); codepoints.resize(size); - Py_UNICODE *unistr = PyUnicode_AsUnicode(textobj); for (size_t i = 0; i < size; ++i) { - codepoints[i] = unistr[i]; + codepoints[i] = PyUnicode_ReadChar(textobj, i); } } else if (PyBytes_Check(textobj)) { size = PyBytes_Size(textobj);
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: