From 5eb823abb8ba91dbab098d7195094d0f76e4f332 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Thu, 21 Nov 2013 12:36:36 +0000 Subject: UI text node outline --- rotord/src/nodes_drawing.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'rotord/src/nodes_drawing.h') diff --git a/rotord/src/nodes_drawing.h b/rotord/src/nodes_drawing.h index 77a74cb..288514c 100644 --- a/rotord/src/nodes_drawing.h +++ b/rotord/src/nodes_drawing.h @@ -111,6 +111,25 @@ namespace Rotor { } private: }; + class UI_text: public Text_base { + public: + UI_text(){ + title="UI_text"; + description="Draws text entered by the user"; + create_attribute("text","Text to draw","Text","hello, world!"); + NODEID="22b47bea-52a9-11e3-b2b3-74d02b29f6a6"; + UItype="text"; + }; + UI_text(map &settings):UI_text() { + base_settings(settings); + }; + ~UI_text(){}; + UI_text* clone(map &_settings) { return new UI_text(_settings);}; + string select_text(const Frame_spec &frame){ + return attributes["text"]->value; + } + private: + }; class Lyrics: public Text_base { public: Lyrics(){ -- cgit v1.2.3 From 5d8f8a40b50aa9e7237d972fe6fbf30279acf518 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Fri, 22 Nov 2013 15:48:58 +0000 Subject: adding new font --- fonts/Akzidenz Grotesk (R) Condensed Medium.ttf | Bin 0 -> 45700 bytes rotord/src/nodes_drawing.h | 15 +++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 fonts/Akzidenz Grotesk (R) Condensed Medium.ttf (limited to 'rotord/src/nodes_drawing.h') diff --git a/fonts/Akzidenz Grotesk (R) Condensed Medium.ttf b/fonts/Akzidenz Grotesk (R) Condensed Medium.ttf new file mode 100644 index 0000000..8c8189a Binary files /dev/null and b/fonts/Akzidenz Grotesk (R) Condensed Medium.ttf differ diff --git a/rotord/src/nodes_drawing.h b/rotord/src/nodes_drawing.h index 288514c..8fe5d71 100644 --- a/rotord/src/nodes_drawing.h +++ b/rotord/src/nodes_drawing.h @@ -62,7 +62,7 @@ namespace Rotor { public: Text_base(){ create_attribute("colour","Colour to fill","Colour","FFFFFF"); - create_attribute("font","font to use","Font","Sans",{"Sans","Sans Mono","Serif"}); + create_attribute("font","font to use","Font","Akzidenz",{"Sans","Sans Mono","Serif","Akzidenz"}); create_parameter("size","number","Point size of font","size",50.0f); NODEID="7da93b94-2d0b-11e3-8940-77bce0f9d3e8"; }; @@ -76,7 +76,18 @@ namespace Rotor { string text=select_text(frame); cairo_text_extents_t te; cairo_set_source_rgb(cr, colour.Rfloat(),colour.Gfloat(),colour.Bfloat()); - cairo_select_font_face (cr, ("DejaVu "+attributes["font"]->value).c_str(), + string fontname; + switch (attributes["font"]->intVal){ + case 1: + case 2: + case 3: + fontname="DejaVu "+attributes["font"]->value; + break; + case 4: + fontname="Akzidenz-Grotesk Condensed BQ"; + break; + } + cairo_select_font_face (cr,fontname.c_str(), CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); cairo_set_font_size (cr, parameters["size"]->value*(((float)frame.w)/360.0f)); cairo_text_extents(cr, text.c_str(), &te); -- cgit v1.2.3