Part: Remove Py_UNICODE usage from Part.makeWireString and FT2FC.

This commit is contained in:
tritao
2025-03-22 21:39:34 +00:00
committed by Kacper Donat
parent 97638e0c82
commit d5a1098add
3 changed files with 13 additions and 32 deletions

View File

@@ -1981,7 +1981,7 @@ private:
double height;
double track = 0;
Py_UNICODE *unichars = nullptr;
Py_UCS4 *unichars = nullptr;
Py_ssize_t pysize;
PyObject *CharList;
@@ -2014,28 +2014,11 @@ private:
}
pysize = PyUnicode_GetLength(p);
#ifdef FC_OS_WIN32
//PyUNICODE is only 16 bits on Windows (wchar_t), so passing 32 bit UCS4
//will result in unknown glyph in even positions, and wrong characters in
//odd positions.
unichars = (Py_UNICODE*)PyUnicode_AsWideCharString(p, &pysize);
#else
unichars = (Py_UNICODE *)PyUnicode_AsUCS4Copy(p);
#endif
unichars = PyUnicode_AsUCS4Copy(p);
}
else if (PyUnicode_Check(intext)) {
pysize = PyUnicode_GetLength(intext);
#ifdef FC_OS_WIN32
//PyUNICODE is only 16 bits on Windows (wchar_t), so passing 32 bit UCS4
//will result in unknown glyph in even positions, and wrong characters in
//odd positions.
unichars = (Py_UNICODE*)PyUnicode_AsWideCharString(intext, &pysize);
#else
unichars = (Py_UNICODE *)PyUnicode_AsUCS4Copy(intext);
#endif
unichars = PyUnicode_AsUCS4Copy(intext);
}
else {
throw Py::TypeError("** makeWireString bad text parameter");