[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[pygame] unicode bug at font.c



Title: unicode bug at font.c

font.c at current cvs tree has a simple but serious bug on font_size() and font_render() functions.
With current version, we can't render or size unicode properly. I attatched the fix of this bug and I hope this will be fixed very soon.


--- font.c.orig Thu Nov 14 17:45:56 2002
+++ font.c      Thu Nov 14 17:46:18 2002
@@ -431,7 +431,7 @@
        if(PyUnicode_Check(text))
        {
                PyObject* strob = PyEval_CallMethod(text, "encode", "(s)", "utf-8");
-               char *string = PyString_AsString(text);
+               char *string = PyString_AsString(strob); // hcyun

                if(aa)
                {
@@ -501,11 +501,11 @@
        if(PyUnicode_Check(text))
        {
                PyObject* strob = PyEval_CallMethod(text, "encode", "(s)", "utf-8");
-               char *string = PyString_AsString(text);
+               char *string = PyString_AsString(strob);

                TTF_SizeUTF8(font, string, &w, &h);

-               Py_DECREF(text);
+               Py_DECREF(strob); // hcyun
        }
        else if(PyString_Check(text))
        {


-
HeeChul Yun,         
Embedded S/W Team at ETRI
e-mail: hcyun@etri.re.kr
phone: +82-42-860-1673