Blender  V3.3
Macros | Functions | Variables
blf_py_api.c File Reference
#include "blf_py_api.h"
#include <Python.h>
#include "../../blenfont/BLF_api.h"
#include "BLI_utildefines.h"
#include "python_utildefines.h"

Go to the source code of this file.

Macros

#define PY_SSIZE_T_CLEAN
 

Functions

 PyDoc_STRVAR (py_blf_position_doc, ".. function:: position(fontid, x, y, z)\n" "\n" " Set the position for drawing text.\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 x: X axis position to draw the text.\n" " :type x: float\n" " :arg y: Y axis position to draw the text.\n" " :type y: float\n" " :arg z: Z axis position to draw the text.\n" " :type z: float\n")
 
static PyObject * py_blf_position (PyObject *UNUSED(self), PyObject *args)
 
 PyDoc_STRVAR (py_blf_size_doc, ".. function:: size(fontid, size, dpi)\n" "\n" " Set the size and DPI for drawing text.\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 size: Point size of the font.\n" " :type size: float\n" " :arg dpi: dots per inch value to use for drawing.\n" " :type dpi: int\n")
 
static PyObject * py_blf_size (PyObject *UNUSED(self), PyObject *args)
 
 PyDoc_STRVAR (py_blf_aspect_doc, ".. function:: aspect(fontid, aspect)\n" "\n" " Set the aspect for drawing text.\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 aspect: The aspect ratio for text drawing to use.\n" " :type aspect: float\n")
 
static PyObject * py_blf_aspect (PyObject *UNUSED(self), PyObject *args)
 
 PyDoc_STRVAR (py_blf_color_doc, ".. function:: color(fontid, r, g, b, a)\n" "\n" " Set the color for drawing text.\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 r: red channel 0.0 - 1.0.\n" " :type r: float\n" " :arg g: green channel 0.0 - 1.0.\n" " :type g: float\n" " :arg b: blue channel 0.0 - 1.0.\n" " :type b: float\n" " :arg a: alpha channel 0.0 - 1.0.\n" " :type a: float\n")
 
static PyObject * py_blf_color (PyObject *UNUSED(self), PyObject *args)
 
 PyDoc_STRVAR (py_blf_draw_doc, ".. function:: draw(fontid, text)\n" "\n" " Draw text in the current context.\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 text: the text to draw.\n" " :type text: string\n")
 
static PyObject * py_blf_draw (PyObject *UNUSED(self), PyObject *args)
 
 PyDoc_STRVAR (py_blf_dimensions_doc, ".. function:: dimensions(fontid, text)\n" "\n" " Return the width and height of the text.\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 text: the text to draw.\n" " :type text: string\n" " :return: the width and height of the text.\n" " :rtype: tuple of 2 floats\n")
 
static PyObject * py_blf_dimensions (PyObject *UNUSED(self), PyObject *args)
 
 PyDoc_STRVAR (py_blf_clipping_doc, ".. function:: clipping(fontid, xmin, ymin, xmax, ymax)\n" "\n" " Set the clipping, enable/disable using CLIPPING.\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 xmin: Clip the drawing area by these bounds.\n" " :type xmin: float\n" " :arg ymin: Clip the drawing area by these bounds.\n" " :type ymin: float\n" " :arg xmax: Clip the drawing area by these bounds.\n" " :type xmax: float\n" " :arg ymax: Clip the drawing area by these bounds.\n" " :type ymax: float\n")
 
static PyObject * py_blf_clipping (PyObject *UNUSED(self), PyObject *args)
 
 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)
 
 PyDoc_STRVAR (py_blf_disable_doc, ".. function:: disable(fontid, option)\n" "\n" " Disable option.\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 option: One of ROTATION, CLIPPING, SHADOW or KERNING_DEFAULT.\n" " :type option: int\n")
 
static PyObject * py_blf_disable (PyObject *UNUSED(self), PyObject *args)
 
 PyDoc_STRVAR (py_blf_enable_doc, ".. function:: enable(fontid, option)\n" "\n" " Enable option.\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 option: One of ROTATION, CLIPPING, SHADOW or KERNING_DEFAULT.\n" " :type option: int\n")
 
static PyObject * py_blf_enable (PyObject *UNUSED(self), PyObject *args)
 
 PyDoc_STRVAR (py_blf_rotation_doc, ".. function:: rotation(fontid, angle)\n" "\n" " Set the text rotation angle, enable/disable using ROTATION.\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 angle: The angle for text drawing to use.\n" " :type angle: float\n")
 
static PyObject * py_blf_rotation (PyObject *UNUSED(self), PyObject *args)
 
 PyDoc_STRVAR (py_blf_shadow_doc, ".. function:: shadow(fontid, level, r, g, b, a)\n" "\n" " Shadow options, enable/disable using SHADOW .\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 level: The blur level, can be 3, 5 or 0.\n" " :type level: int\n" " :arg r: Shadow color (red channel 0.0 - 1.0).\n" " :type r: float\n" " :arg g: Shadow color (green channel 0.0 - 1.0).\n" " :type g: float\n" " :arg b: Shadow color (blue channel 0.0 - 1.0).\n" " :type b: float\n" " :arg a: Shadow color (alpha channel 0.0 - 1.0).\n" " :type a: float\n")
 
static PyObject * py_blf_shadow (PyObject *UNUSED(self), PyObject *args)
 
 PyDoc_STRVAR (py_blf_shadow_offset_doc, ".. function:: shadow_offset(fontid, x, y)\n" "\n" " Set the offset for shadow text.\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 x: Vertical shadow offset value in pixels.\n" " :type x: float\n" " :arg y: Horizontal shadow offset value in pixels.\n" " :type y: float\n")
 
static PyObject * py_blf_shadow_offset (PyObject *UNUSED(self), PyObject *args)
 
 PyDoc_STRVAR (py_blf_load_doc, ".. function:: load(filepath)\n" "\n" " Load a new font.\n" "\n" " :arg filepath: the filepath of the font.\n" " :type filepath: string\n" " :return: the new font's fontid or -1 if there was an error.\n" " :rtype: integer\n")
 
static PyObject * py_blf_load (PyObject *UNUSED(self), PyObject *args)
 
 PyDoc_STRVAR (py_blf_unload_doc, ".. function:: unload(filepath)\n" "\n" " Unload an existing font.\n" "\n" " :arg filepath: the filepath of the font.\n" " :type filepath: string\n")
 
static PyObject * py_blf_unload (PyObject *UNUSED(self), PyObject *args)
 
 PyDoc_STRVAR (BLF_doc, "This module provides access to Blender's text drawing functions.")
 
PyObject * BPyInit_blf (void)
 

Variables

static PyMethodDef BLF_methods []
 
static struct PyModuleDef BLF_module_def
 

Detailed Description

This file defines the 'bgl' module, used for drawing text in OpenGL.

Definition in file blf_py_api.c.

Macro Definition Documentation

◆ PY_SSIZE_T_CLEAN

#define PY_SSIZE_T_CLEAN

Definition at line 10 of file blf_py_api.c.

Function Documentation

◆ BPyInit_blf()

PyObject* BPyInit_blf ( void  )

◆ py_blf_aspect()

static PyObject* py_blf_aspect ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

Definition at line 86 of file blf_py_api.c.

References BLF_aspect(), and NULL.

◆ py_blf_clipping()

static PyObject* py_blf_clipping ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

Definition at line 227 of file blf_py_api.c.

References BLF_clipping(), and NULL.

◆ py_blf_color()

static PyObject* py_blf_color ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

Definition at line 116 of file blf_py_api.c.

References BLF_color4fv(), NULL, and usdtokens::rgba().

◆ py_blf_dimensions()

static PyObject* py_blf_dimensions ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

Definition at line 193 of file blf_py_api.c.

References BLF_width_and_height(), NULL, PyTuple_SET_ITEMS, and ret.

◆ py_blf_disable()

static PyObject* py_blf_disable ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

Definition at line 275 of file blf_py_api.c.

References BLF_disable(), and NULL.

◆ py_blf_draw()

static PyObject* py_blf_draw ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

Definition at line 166 of file blf_py_api.c.

References BLF_draw(), and NULL.

◆ py_blf_enable()

static PyObject* py_blf_enable ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

Definition at line 298 of file blf_py_api.c.

References BLF_enable(), and NULL.

◆ py_blf_load()

static PyObject* py_blf_load ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

Definition at line 407 of file blf_py_api.c.

References BLF_load(), and NULL.

◆ py_blf_position()

static PyObject* py_blf_position ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

Definition at line 36 of file blf_py_api.c.

References BLF_position(), NULL, x, y, and z.

◆ py_blf_rotation()

static PyObject* py_blf_rotation ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

Definition at line 321 of file blf_py_api.c.

References angle(), BLF_rotation(), and NULL.

◆ py_blf_shadow()

static PyObject* py_blf_shadow ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

Definition at line 353 of file blf_py_api.c.

References BLF_shadow(), ELEM, NULL, and usdtokens::rgba().

◆ py_blf_shadow_offset()

static PyObject* py_blf_shadow_offset ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

Definition at line 385 of file blf_py_api.c.

References BLF_shadow_offset(), NULL, x, and y.

◆ py_blf_size()

static PyObject* py_blf_size ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

Definition at line 62 of file blf_py_api.c.

References BLF_size(), NULL, and size().

◆ py_blf_unload()

static PyObject* py_blf_unload ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

Definition at line 425 of file blf_py_api.c.

References BLF_unload(), and NULL.

◆ py_blf_word_wrap()

static PyObject* py_blf_word_wrap ( PyObject *  UNUSEDself,
PyObject *  args 
)
static

Definition at line 251 of file blf_py_api.c.

References BLF_wordwrap(), NULL, and wrap_width().

◆ PyDoc_STRVAR() [1/16]

PyDoc_STRVAR ( BLF_doc  ,
"This module provides access to Blender's text drawing functions."   
)

◆ PyDoc_STRVAR() [2/16]

PyDoc_STRVAR ( py_blf_aspect_doc  ,
".. function:: aspect(fontid, aspect)\n" "\n" " Set the aspect for drawing text.\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 aspect:The aspect ratio for text drawing to use.\n" " :type aspect:float\n"   
)

◆ PyDoc_STRVAR() [3/16]

PyDoc_STRVAR ( py_blf_clipping_doc  ,
".. function:: clipping(fontid, xmin, ymin, xmax, ymax)\n" "\n" " Set the  clipping,
enable/disable using CLIPPING.\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 xmin:Clip the drawing area by these bounds.\n" " :type xmin:float\n" " :arg ymin:Clip the drawing area by these bounds.\n" " :type ymin:float\n" " :arg xmax:Clip the drawing area by these bounds.\n" " :type xmax:float\n" " :arg ymax:Clip the drawing area by these bounds.\n" " :type ymax:float\n"   
)

◆ PyDoc_STRVAR() [4/16]

PyDoc_STRVAR ( py_blf_color_doc  ,
".. function:: color(fontid, r, g, b, a)\n" "\n" " Set the color for drawing text.\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 r:red channel 0.0 - 1.0.\n" " :type r:float\n" " :arg g:green channel 0.0 - 1.0.\n" " :type g:float\n" " :arg b:blue channel 0.0 - 1.0.\n" " :type b:float\n" " :arg a:alpha channel 0.0 - 1.0.\n" " :type a:float\n"   
)

◆ PyDoc_STRVAR() [5/16]

PyDoc_STRVAR ( py_blf_dimensions_doc  ,
".. function:: dimensions(fontid, text)\n" "\n" " Return the width and height of the text.\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 text:the text to draw.\n" " :type text:string\n" " :return:the width and height of the text.\n" " :rtype:tuple of 2 floats\n"   
)

◆ PyDoc_STRVAR() [6/16]

PyDoc_STRVAR ( py_blf_disable_doc  ,
".. function:: disable(fontid, option)\n" "\n" " Disable option.\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 option:One of  ROTATION,
CLIPPING  ,
SHADOW or KERNING_DEFAULT.\n" " :type option:int\n"   
)

◆ PyDoc_STRVAR() [7/16]

PyDoc_STRVAR ( py_blf_draw_doc  ,
".. function:: draw(fontid, text)\n" "\n" " Draw text in the current context.\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 text:the text to draw.\n" " :type text:string\n"   
)

◆ PyDoc_STRVAR() [8/16]

PyDoc_STRVAR ( py_blf_enable_doc  ,
".. function:: enable(fontid, option)\n" "\n" " Enable option.\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 option:One of  ROTATION,
CLIPPING  ,
SHADOW or KERNING_DEFAULT.\n" " :type option:int\n"   
)

◆ PyDoc_STRVAR() [9/16]

PyDoc_STRVAR ( py_blf_load_doc  ,
".. function:: load(filepath)\n" "\n" " Load a new font.\n" "\n" " :arg filepath: the filepath of the font.\n" " :type filepath: string\n" " :return: the new font's fontid or -1 if there was an error.\n" " :rtype: integer\n"   
)

◆ PyDoc_STRVAR() [10/16]

PyDoc_STRVAR ( py_blf_position_doc  ,
".. function:: position(fontid, x, y, z)\n" "\n" " Set the position for drawing text.\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 x:X axis position to draw the text.\n" " :type x:float\n" " :arg y:Y axis position to draw the text.\n" " :type y:float\n" " :arg z:Z axis position to draw the text.\n" " :type z:float\n"   
)

◆ PyDoc_STRVAR() [11/16]

PyDoc_STRVAR ( py_blf_rotation_doc  ,
".. function:: rotation(fontid, angle)\n" "\n" " Set the text rotation  angle,
enable/disable using ROTATION.\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 angle:The angle for text drawing to use.\n" " :type angle:float\n"   
)

◆ PyDoc_STRVAR() [12/16]

PyDoc_STRVAR ( py_blf_shadow_doc  ,
".. function:: shadow(fontid, level, r, g, b, a)\n" "\n" " Shadow  options,
enable/disable using SHADOW .\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 level:The blur  level,
can be  3,
5 or 0.\n" " :type level:int\n" " :arg r:Shadow color(red channel 0.0 - 1.0).\n" " :type r:float\n" " :arg g:Shadow color(green channel 0.0 - 1.0).\n" " :type g:float\n" " :arg b:Shadow color(blue channel 0.0 - 1.0).\n" " :type b:float\n" " :arg a:Shadow color(alpha channel 0.0 - 1.0).\n" " :type a:float\n"   
)

◆ PyDoc_STRVAR() [13/16]

PyDoc_STRVAR ( py_blf_shadow_offset_doc  ,
".. function:: shadow_offset(fontid, x, y)\n" "\n" " Set the offset for shadow text.\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 x:Vertical shadow offset value in pixels.\n" " :type x:float\n" " :arg y:Horizontal shadow offset value in pixels.\n" " :type y:float\n"   
)

◆ PyDoc_STRVAR() [14/16]

PyDoc_STRVAR ( py_blf_size_doc  ,
".. function:: size(fontid, size, dpi)\n" "\n" " Set the size and DPI for drawing text.\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 size:Point size of the font.\n" " :type size:float\n" " :arg dpi:dots per inch value to use for drawing.\n" " :type dpi:int\n"   
)

◆ PyDoc_STRVAR() [15/16]

PyDoc_STRVAR ( py_blf_unload_doc  ,
".. function:: unload(filepath)\n" "\n" " Unload an existing font.\n" "\n" " :arg filepath: the filepath of the font.\n" " :type filepath: string\n"   
)

◆ PyDoc_STRVAR() [16/16]

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"   
)

Variable Documentation

◆ BLF_methods

PyMethodDef BLF_methods[]
static
Initial value:
= {
{"aspect", (PyCFunction)py_blf_aspect, METH_VARARGS, py_blf_aspect_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},
{"enable", (PyCFunction)py_blf_enable, METH_VARARGS, py_blf_enable_doc},
{"position", (PyCFunction)py_blf_position, METH_VARARGS, py_blf_position_doc},
{"rotation", (PyCFunction)py_blf_rotation, METH_VARARGS, py_blf_rotation_doc},
{"shadow", (PyCFunction)py_blf_shadow, METH_VARARGS, py_blf_shadow_doc},
{"shadow_offset", (PyCFunction)py_blf_shadow_offset, METH_VARARGS, py_blf_shadow_offset_doc},
{"size", (PyCFunction)py_blf_size, METH_VARARGS, py_blf_size_doc},
{"color", (PyCFunction)py_blf_color, METH_VARARGS, py_blf_color_doc},
{"load", (PyCFunction)py_blf_load, METH_VARARGS, py_blf_load_doc},
{"unload", (PyCFunction)py_blf_unload, METH_VARARGS, py_blf_unload_doc},
{NULL, NULL, 0, NULL},
}
static PyObject * py_blf_word_wrap(PyObject *UNUSED(self), PyObject *args)
Definition: blf_py_api.c:251
static PyObject * py_blf_load(PyObject *UNUSED(self), PyObject *args)
Definition: blf_py_api.c:407
static PyObject * py_blf_dimensions(PyObject *UNUSED(self), PyObject *args)
Definition: blf_py_api.c:193
static PyObject * py_blf_draw(PyObject *UNUSED(self), PyObject *args)
Definition: blf_py_api.c:166
static PyObject * py_blf_clipping(PyObject *UNUSED(self), PyObject *args)
Definition: blf_py_api.c:227
static PyObject * py_blf_aspect(PyObject *UNUSED(self), PyObject *args)
Definition: blf_py_api.c:86
static PyObject * py_blf_position(PyObject *UNUSED(self), PyObject *args)
Definition: blf_py_api.c:36
static PyObject * py_blf_shadow_offset(PyObject *UNUSED(self), PyObject *args)
Definition: blf_py_api.c:385
static PyObject * py_blf_enable(PyObject *UNUSED(self), PyObject *args)
Definition: blf_py_api.c:298
static PyObject * py_blf_rotation(PyObject *UNUSED(self), PyObject *args)
Definition: blf_py_api.c:321
static PyObject * py_blf_unload(PyObject *UNUSED(self), PyObject *args)
Definition: blf_py_api.c:425
static PyObject * py_blf_shadow(PyObject *UNUSED(self), PyObject *args)
Definition: blf_py_api.c:353
static PyObject * py_blf_disable(PyObject *UNUSED(self), PyObject *args)
Definition: blf_py_api.c:275
static PyObject * py_blf_size(PyObject *UNUSED(self), PyObject *args)
Definition: blf_py_api.c:62
static PyObject * py_blf_color(PyObject *UNUSED(self), PyObject *args)
Definition: blf_py_api.c:116

Definition at line 439 of file blf_py_api.c.

◆ BLF_module_def

struct PyModuleDef BLF_module_def
static
Initial value:
= {
PyModuleDef_HEAD_INIT,
"blf",
BLF_doc,
0,
NULL,
NULL,
NULL,
NULL,
}
static PyMethodDef BLF_methods[]
Definition: blf_py_api.c:439

Definition at line 461 of file blf_py_api.c.

Referenced by BPyInit_blf().