Bug fix.
authorCarl Hetherington <carl@carlh.net>
Mon, 22 Jun 2009 00:01:56 +0000 (00:01 +0000)
committerCarl Hetherington <carl@carlh.net>
Mon, 22 Jun 2009 00:01:56 +0000 (00:01 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@5238 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/utils.cc

index dc410136d7f2d78a67d5f9cf35f3aa46e1ffe69d..85bb46c6c81ffa6db8e13a2e12957781c8d656af 100644 (file)
@@ -122,17 +122,14 @@ fit_to_pixels (cairo_t* cr, std::string name, double avail)
        uint32_t width = 0;
                
        while (1) {
-               if (name.length() <= 4) {
-                       break;
-               }
-                       
                cairo_text_extents_t ext;
                cairo_text_extents (cr, name.c_str(), &ext);
-               if (ext.width < avail) {
+
+               if (ext.width < avail || name.length() <= 4) {
                        width = ext.width;
                        break;
                }
-                       
+
                if (abbreviated) {
                        name = name.substr (0, name.length() - 4) + "...";
                } else {