Commit: 36bdf248b628407e79ba0445e6556369c8c48f9c
Author: Campbell Barton
Date:   Mon Aug 31 11:41:18 2015 +1000
Branches: temp-blf-wordwrap
https://developer.blender.org/rB36bdf248b628407e79ba0445e6556369c8c48f9c

Add Python API calls into wordwrap

===================================================================

M       source/blender/python/generic/blf_py_api.c

===================================================================

diff --git a/source/blender/python/generic/blf_py_api.c 
b/source/blender/python/generic/blf_py_api.c
index 5364c3b..aebfcfa 100644
--- a/source/blender/python/generic/blf_py_api.c
+++ b/source/blender/python/generic/blf_py_api.c
@@ -221,6 +221,29 @@ static PyObject *py_blf_clipping(PyObject *UNUSED(self), 
PyObject *args)
        Py_RETURN_NONE;
 }
 
+PyDoc_STRVAR(py_blf_word_wrap_doc,
+".. function:: word_wrap(fontid, wrap_width)\n"
+"\n"
+"   Set the wrap width, enable/disable using WORD_WRAP.\n"
+"\n"
+"   :arg fontid: The id of the typeface as returned by :func:`blf.load`, for 
default font use 0.\n"
+"   :type fontid: int\n"
+"   :arg wrap_width: The width (in pixels) to wrap words at.\n"
+"   :type wrap_width: int\n"
+);
+static PyObject *py_blf_word_wrap(PyObject *UNUSED(self), PyObject *args)
+{
+       int wrap_width;
+       int fontid;
+
+       if (!PyArg_ParseTuple(args, "ii:blf.word_wrap", &fontid, &wrap_width))
+               return NULL;
+
+       BLF_wordwrap(fontid, wrap_width);
+
+       Py_RETURN_NONE;
+}
+
 PyDoc_STRVAR(py_blf_disable_doc,
 ".. function:: disable(fontid, option)\n"
 "\n"
@@ -393,6 +416,7 @@ static PyMethodDef BLF_methods[] = {
        {"aspect", (PyCFunction) py_blf_aspect, METH_VARARGS, 
py_blf_aspect_doc},
        {"blur", (PyCFunction) py_blf_blur, METH_VARARGS, py_blf_blur_doc},
        {"clipping", (PyCFunction) py_blf_clipping, METH_VARARGS, 
py_blf_clipping_doc},
+       {"word_wrap", (PyCFunction) py_blf_word_wrap, METH_VARARGS, 
py_blf_word_wrap_doc},
        {"disable", (PyCFunction) py_blf_disable, METH_VARARGS, 
py_blf_disable_doc},
        {"dimensions", (PyCFunction) py_blf_dimensions, METH_VARARGS, 
py_blf_dimensions_doc},
        {"draw", (PyCFunction) py_blf_draw, METH_VARARGS, py_blf_draw_doc},
@@ -432,6 +456,7 @@ PyObject *BPyInit_blf(void)
        PyModule_AddIntConstant(submodule, "CLIPPING", BLF_CLIPPING);
        PyModule_AddIntConstant(submodule, "SHADOW", BLF_SHADOW);
        PyModule_AddIntConstant(submodule, "KERNING_DEFAULT", 
BLF_KERNING_DEFAULT);
+       PyModule_AddIntConstant(submodule, "WORD_WRAP", BLF_WORDWRAP);
 
        return submodule;
 }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to