- small fix in Sys.c to compile on Windows:

Thanks Florian Eggenberger for telling us about it. And Greg McBride for
   pointing a possible fix.
- Draw.Text and Draw.GetStringWidth updated:
   Now they accept an optional second parameter to set font size and Draw.Text
   returns the drawn string width.
- Partially fixed the update() and PutRaw() bugs in NMesh:
   A total fix will require bigger changes, but what was done (unless buggy)
   takes care of the common cases.
This commit is contained in:
2003-07-01 05:19:14 +00:00
parent 14b4ed4e8d
commit fad2aeb3fb
7 changed files with 138 additions and 112 deletions

View File

@@ -623,7 +623,7 @@ static PyObject *Method_String (PyObject *self, PyObject *args)
static PyObject *Method_GetStringWidth (PyObject *self, PyObject *args)
{
char *text;
char *font_str = NULL;
char *font_str = "normal";
struct BMF_Font *font;
PyObject *width;
@@ -631,13 +631,12 @@ static PyObject *Method_GetStringWidth (PyObject *self, PyObject *args)
return EXPP_ReturnPyObjError (PyExc_TypeError,
"expected one or two string arguments");
if (!font_str) font = (&G)->font;
else if (!strcmp (font_str, "normal")) font = (&G)->font;
if (!strcmp (font_str, "normal")) font = (&G)->font;
else if (!strcmp (font_str, "small" )) font = (&G)->fonts;
else if (!strcmp (font_str, "tiny" )) font = (&G)->fontss;
else
return EXPP_ReturnPyObjError (PyExc_AttributeError,
"\"font\" must be: 'normal' (same as None), 'small' or 'tiny'.");
"\"font\" must be: 'normal' (default), 'small' or 'tiny'.");
width = PyInt_FromLong(BMF_GetStringWidth (font, text));
@@ -664,11 +663,11 @@ static PyObject *Method_Text (PyObject *self, PyObject *args)
else if (!strcmp (font_str, "tiny" )) font = (&G)->fontss;
else
return EXPP_ReturnPyObjError (PyExc_AttributeError,
"\"font\" must be: 'normal' (same as None), 'small' or 'tiny'.");
"\"font\" must be: 'normal' (default), 'small' or 'tiny'.");
BMF_DrawString(font, text);
return EXPP_incr_ret(Py_None);
return PyInt_FromLong (BMF_GetStringWidth (font, text));
}
PyObject *Draw_Init (void)