Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRemigiusz Fiedler <migius@gmx.net>2008-02-19 13:47:29 +0300
committerRemigiusz Fiedler <migius@gmx.net>2008-02-19 13:47:29 +0300
commit0d80e08e8a24e43f3225d3c3a458ed8555cbe8e2 (patch)
tree3ea5b988fd9dd9e3900521db2a27b29d54bb4244 /source/blender/python
parent92300016e0873ce68ae7b4a9c08b581d8e9f58a3 (diff)
python API: added support for screen font 12(fix-width) as "normalfix"
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/api2_2x/Draw.c12
-rw-r--r--source/blender/python/api2_2x/doc/Draw.py4
2 files changed, 10 insertions, 6 deletions
diff --git a/source/blender/python/api2_2x/Draw.c b/source/blender/python/api2_2x/Draw.c
index 8f79d63ddb6..fc84c9a1445 100644
--- a/source/blender/python/api2_2x/Draw.c
+++ b/source/blender/python/api2_2x/Draw.c
@@ -284,12 +284,12 @@ new String button\n\n\
static char Method_GetStringWidth_doc[] =
"(text, font = 'normal') - Return the width in pixels of the given string\n\
-(font) The font size: 'normal' (default), 'small' or 'tiny'.";
+(font) The font size: 'large','normal' (default), 'normalfix', 'small' or 'tiny'.";
static char Method_Text_doc[] =
"(text, font = 'normal') - Draw text onscreen\n\n\
(text) The text to draw\n\
-(font) The font size: 'normal' (default), 'small' or 'tiny'.\n\n\
+(font) The font size: 'large','normal' (default), 'normalfix', 'small' or 'tiny'.\n\n\
This function returns the width of the drawn string.";
static char Method_Label_doc[] =
@@ -1641,6 +1641,8 @@ static PyObject *Method_GetStringWidth( PyObject * self, PyObject * args )
if( !strcmp( font_str, "normal" ) )
font = ( &G )->font;
+ else if( !strcmp( font_str, "normalfix" ) )
+ font = BMF_GetFont(BMF_kScreen12);
else if( !strcmp( font_str, "large" ) )
font = BMF_GetFont(BMF_kScreen15);
else if( !strcmp( font_str, "small" ) )
@@ -1649,7 +1651,7 @@ static PyObject *Method_GetStringWidth( PyObject * self, PyObject * args )
font = ( &G )->fontss;
else
return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "\"font\" must be: 'large', 'normal' (default), 'small' or 'tiny'." );
+ "\"font\" must be: 'large','normal' (default), 'normalfix', 'small' or 'tiny'." );
width = PyInt_FromLong( BMF_GetStringWidth( font, text ) );
@@ -1674,6 +1676,8 @@ static PyObject *Method_Text( PyObject * self, PyObject * args )
font = ( &G )->font;
else if( !strcmp( font_str, "large" ) )
font = BMF_GetFont(BMF_kScreen15);
+ else if( !strcmp( font_str, "normalfix" ) )
+ font = BMF_GetFont(BMF_kScreen12);
else if( !strcmp( font_str, "normal" ) )
font = ( &G )->font;
else if( !strcmp( font_str, "small" ) )
@@ -1682,7 +1686,7 @@ static PyObject *Method_Text( PyObject * self, PyObject * args )
font = ( &G )->fontss;
else
return EXPP_ReturnPyObjError( PyExc_AttributeError,
- "\"font\" must be: 'normal' (default), 'large', 'small' or 'tiny'." );
+ "\"font\" must be: 'large','normal' (default), 'normalfix', 'small' or 'tiny'." );
BMF_DrawString( font, text );
diff --git a/source/blender/python/api2_2x/doc/Draw.py b/source/blender/python/api2_2x/doc/Draw.py
index 9d4f2372462..18234754315 100644
--- a/source/blender/python/api2_2x/doc/Draw.py
+++ b/source/blender/python/api2_2x/doc/Draw.py
@@ -786,7 +786,7 @@ def GetStringWidth(string, fontsize = 'normal'):
@type string: string
@param string: A string.
@type fontsize: string
- @param fontsize: The size of the font: 'large', 'normal', 'small' or 'tiny'.
+ @param fontsize: The size of the font: 'large', 'normal', 'normalfix', 'small' or 'tiny'.
@rtype: int
@return: The width of I{string} with the chosen I{fontsize}.
"""
@@ -803,7 +803,7 @@ def Text(string, fontsize = 'normal'):
@type string: string
@param string: The text string to draw.
@type fontsize: string
- @param fontsize: The size of the font: 'large', 'normal', 'small' or 'tiny'.
+ @param fontsize: The size of the font: 'large', 'normal', 'normalfix', 'small' or 'tiny'.
@rtype: int
@return: The width of I{string} drawn with the chosen I{fontsize}.
@note: For drawing text in the 3d view see the workaround in L{BGL.glRasterPos}