provide ArdourCanvas::Text::{width,height}()
authorPaul Davis <paul@linuxaudiosystems.com>
Tue, 27 Sep 2016 18:46:02 +0000 (13:46 -0500)
committerPaul Davis <paul@linuxaudiosystems.com>
Tue, 27 Sep 2016 19:59:32 +0000 (14:59 -0500)
libs/canvas/canvas/text.h
libs/canvas/text.cc

index 24251c215b90114d57bbc57053d61f305ebe0c4c..bd6c0496064e7b85d0bd8e4ef009d399138ec536 100644 (file)
@@ -47,6 +47,9 @@ public:
 
         void clamp_width (double);
 
+        double width() const;
+        double height() const;
+
         void set_size_chars (int nchars);
         void dump (std::ostream&) const;
 
index 3b309e51df68827367f7832a620b22139b3ceae5..fb38423dec22887ac82fa8a70111c08e58272aba 100644 (file)
@@ -84,6 +84,24 @@ Text::set (string const & text)
        end_change ();
 }
 
+double
+Text::width () const
+{
+       if (_need_redraw) {
+               _redraw  ();
+       }
+       return _width;
+}
+
+double
+Text::height () const
+{
+       if (_need_redraw) {
+               _redraw  ();
+       }
+       return _height;
+}
+
 void
 Text::_redraw () const
 {