[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13762] trunk/blender/source/blender/ python/api2_2x: python API: added support for screen font 12(fix-width) as "normalfix"
Remigiusz Fiedler
migius at 4d-vectors.de
Tue Feb 19 11:47:29 CET 2008
Revision: 13762
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13762
Author: migius
Date: 2008-02-19 11:47:29 +0100 (Tue, 19 Feb 2008)
Log Message:
-----------
python API: added support for screen font 12(fix-width) as "normalfix"
Modified Paths:
--------------
trunk/blender/source/blender/python/api2_2x/Draw.c
trunk/blender/source/blender/python/api2_2x/doc/Draw.py
Modified: trunk/blender/source/blender/python/api2_2x/Draw.c
===================================================================
--- trunk/blender/source/blender/python/api2_2x/Draw.c 2008-02-19 10:43:41 UTC (rev 13761)
+++ trunk/blender/source/blender/python/api2_2x/Draw.c 2008-02-19 10:47:29 UTC (rev 13762)
@@ -284,12 +284,12 @@
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 @@
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 @@
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 @@
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 @@
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 );
Modified: trunk/blender/source/blender/python/api2_2x/doc/Draw.py
===================================================================
--- trunk/blender/source/blender/python/api2_2x/doc/Draw.py 2008-02-19 10:43:41 UTC (rev 13761)
+++ trunk/blender/source/blender/python/api2_2x/doc/Draw.py 2008-02-19 10:47:29 UTC (rev 13762)
@@ -786,7 +786,7 @@
@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 @@
@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}
More information about the Bf-blender-cvs
mailing list