diff options
Diffstat (limited to 'rotord')
| -rw-r--r-- | rotord/src/nodes_drawing.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/rotord/src/nodes_drawing.h b/rotord/src/nodes_drawing.h index d5f3578..14a0dce 100644 --- a/rotord/src/nodes_drawing.h +++ b/rotord/src/nodes_drawing.h @@ -52,7 +52,9 @@ namespace Rotor { description="Draws text"; create_attribute("text","Text to draw","Text","hello, world!"); create_attribute("colour","Colour to fill","Colour","FFFFFF"); + create_attribute("font","font to use","Font","Sans",{"Sans","Sans Mono","Serif"}); create_parameter("number","number","Number to draw","Number",-99999999.0f); + create_parameter("size","number","Point size of font","size",50.0f); UID="7da93b94-2d0b-11e3-8940-77bce0f9d3e8"; }; Text(map<string,string> &settings):Text() { @@ -69,9 +71,9 @@ namespace Rotor { else text=attributes["text"]->value; cairo_text_extents_t te; cairo_set_source_rgb(cr, colour.Rfloat(),colour.Gfloat(),colour.Bfloat()); - cairo_select_font_face (cr, "DejaVu", + cairo_select_font_face (cr, ("DejaVu "+attributes["font"]->value).c_str(), CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); - cairo_set_font_size (cr, 120); + cairo_set_font_size (cr, parameters["size"]->value*(((float)frame.w)/360.0f)); cairo_text_extents(cr, text.c_str(), &te); cairo_move_to (cr,(frame.w-te.width)/2,frame.h*0.6); cairo_show_text (cr, text.c_str()); |
