mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Revert #3780 for PyPy3 as it hasn't been updated yet.
This commit is contained in:
commit
aaca672173
|
@ -465,8 +465,9 @@ class TestImageFont(PillowTestCase):
|
||||||
font.getsize(u"’")
|
font.getsize(u"’")
|
||||||
|
|
||||||
@unittest.skipIf(
|
@unittest.skipIf(
|
||||||
sys.platform.startswith("win32") and sys.version.startswith("2"),
|
sys.platform.startswith("win32")
|
||||||
"requires Python 3.x on Windows",
|
and (sys.version.startswith("2") or hasattr(sys, "pypy_translation_info")),
|
||||||
|
"requires CPython 3.x on Windows",
|
||||||
)
|
)
|
||||||
def test_unicode_extended(self):
|
def test_unicode_extended(self):
|
||||||
# issue #3777
|
# issue #3777
|
||||||
|
|
|
@ -327,7 +327,7 @@ getfont(PyObject* self_, PyObject* args, PyObject* kw)
|
||||||
static int
|
static int
|
||||||
font_getchar(PyObject* string, int index, FT_ULong* char_out)
|
font_getchar(PyObject* string, int index, FT_ULong* char_out)
|
||||||
{
|
{
|
||||||
#if PY_VERSION_HEX < 0x03000000
|
#if (PY_VERSION_HEX < 0x03030000) || (defined(PYPY_VERSION_NUM))
|
||||||
if (PyUnicode_Check(string)) {
|
if (PyUnicode_Check(string)) {
|
||||||
Py_UNICODE* p = PyUnicode_AS_UNICODE(string);
|
Py_UNICODE* p = PyUnicode_AS_UNICODE(string);
|
||||||
int size = PyUnicode_GET_SIZE(string);
|
int size = PyUnicode_GET_SIZE(string);
|
||||||
|
@ -336,7 +336,7 @@ font_getchar(PyObject* string, int index, FT_ULong* char_out)
|
||||||
*char_out = p[index];
|
*char_out = p[index];
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
#if PY_VERSION_HEX < 0x03000000
|
||||||
if (PyString_Check(string)) {
|
if (PyString_Check(string)) {
|
||||||
unsigned char* p = (unsigned char*) PyString_AS_STRING(string);
|
unsigned char* p = (unsigned char*) PyString_AS_STRING(string);
|
||||||
int size = PyString_GET_SIZE(string);
|
int size = PyString_GET_SIZE(string);
|
||||||
|
@ -345,6 +345,7 @@ font_getchar(PyObject* string, int index, FT_ULong* char_out)
|
||||||
*char_out = (unsigned char) p[index];
|
*char_out = (unsigned char) p[index];
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
if (PyUnicode_Check(string)) {
|
if (PyUnicode_Check(string)) {
|
||||||
if (index >= PyUnicode_GET_LENGTH(string))
|
if (index >= PyUnicode_GET_LENGTH(string))
|
||||||
|
@ -373,7 +374,7 @@ text_layout_raqm(PyObject* string, FontObject* self, const char* dir, PyObject *
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if PY_VERSION_HEX < 0x03000000
|
#if (PY_VERSION_HEX < 0x03030000) || (defined(PYPY_VERSION_NUM))
|
||||||
if (PyUnicode_Check(string)) {
|
if (PyUnicode_Check(string)) {
|
||||||
Py_UNICODE *text = PyUnicode_AS_UNICODE(string);
|
Py_UNICODE *text = PyUnicode_AS_UNICODE(string);
|
||||||
Py_ssize_t size = PyUnicode_GET_SIZE(string);
|
Py_ssize_t size = PyUnicode_GET_SIZE(string);
|
||||||
|
@ -392,8 +393,9 @@ text_layout_raqm(PyObject* string, FontObject* self, const char* dir, PyObject *
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if (PyString_Check(string)) {
|
#if PY_VERSION_HEX < 0x03000000
|
||||||
|
else if (PyString_Check(string)) {
|
||||||
char *text = PyString_AS_STRING(string);
|
char *text = PyString_AS_STRING(string);
|
||||||
int size = PyString_GET_SIZE(string);
|
int size = PyString_GET_SIZE(string);
|
||||||
if (! size) {
|
if (! size) {
|
||||||
|
@ -410,6 +412,7 @@ text_layout_raqm(PyObject* string, FontObject* self, const char* dir, PyObject *
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
if (PyUnicode_Check(string)) {
|
if (PyUnicode_Check(string)) {
|
||||||
Py_UCS4 *text = PyUnicode_AsUCS4Copy(string);
|
Py_UCS4 *text = PyUnicode_AsUCS4Copy(string);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user