]> git.lyx.org Git - features.git/commitdiff
RenderGraphic::metrics(): return early.
authorAbdelrazak Younes <younes@lyx.org>
Fri, 6 Jun 2008 12:34:27 +0000 (12:34 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Fri, 6 Jun 2008 12:34:27 +0000 (12:34 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25164 a592a061-630c-0410-9148-cb99ea01b6c8

src/insets/RenderGraphic.cpp

index 07185ccdfedf55e6ee549d6993cf82271c2fe7e7..392ac1f1220fb715bc922561a1c92ad2f1c73520 100644 (file)
@@ -135,34 +135,37 @@ void RenderGraphic::metrics(MetricsInfo & mi, Dimension & dim) const
 {
        bool image_ready = displayGraphic(params_) && readyToDisplay(loader_);
 
-       dim.asc = image_ready ? loader_.image()->height() : 50;
-       dim.des = 0;
-
        if (image_ready) {
                dim.wid = loader_.image()->width() + 2 * Inset::TEXT_TO_INSET_OFFSET;
-       } else {
-               int font_width = 0;
+               dim.asc = loader_.image()->height();
+               dim_ = dim;
+               return;
+       }
 
-               FontInfo msgFont(mi.base.font);
-               msgFont.setFamily(SANS_FAMILY);
+       dim.asc = image_ready ? loader_.image()->height() : 50;
+       dim.des = 0;
 
-               // FIXME UNICODE
-               docstring const justname = from_utf8(params_.filename.onlyFileName());
-               if (!justname.empty()) {
-                       msgFont.setSize(FONT_SIZE_FOOTNOTE);
-                       font_width = theFontMetrics(msgFont).width(justname);
-               }
+       int font_width = 0;
 
-               docstring const msg = statusMessage(params_, loader_.status());
-               if (!msg.empty()) {
-                       msgFont.setSize(FONT_SIZE_TINY);
-                       font_width = max(font_width,
-                               theFontMetrics(msgFont).width(msg));
-               }
+       FontInfo msgFont(mi.base.font);
+       msgFont.setFamily(SANS_FAMILY);
+
+       // FIXME UNICODE
+       docstring const justname = from_utf8(params_.filename.onlyFileName());
+       if (!justname.empty()) {
+               msgFont.setSize(FONT_SIZE_FOOTNOTE);
+               font_width = theFontMetrics(msgFont).width(justname);
+       }
 
-               dim.wid = max(50, font_width + 15);
+       docstring const msg = statusMessage(params_, loader_.status());
+       if (!msg.empty()) {
+               msgFont.setSize(FONT_SIZE_TINY);
+               font_width = max(font_width,
+                       theFontMetrics(msgFont).width(msg));
        }
 
+       dim.wid = max(50, font_width + 15);
+
        dim_ = dim;
 }