[dia] Bug 455651 - Right edge of text truncated



commit 2b9017af13db8b940b4318908ff75b89c2d48de7
Author: Hans Breuer <hans breuer org>
Date:   Fri Jun 24 00:16:01 2011 +0200

    Bug 455651 - Right edge of text truncated
    
    Using the ink-rect is not enough, Dia's code is also
    assuming width is measured from the left edge at 0.
    So an x-offset of the ink-rect actually resulted in
    a clipped right edge.

 lib/font.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/lib/font.c b/lib/font.c
index 5000f55..5115ceb 100644
--- a/lib/font.c
+++ b/lib/font.c
@@ -826,7 +826,9 @@ dia_font_get_sizes(const char* string, DiaFont *font, real height,
     *width = 0.0;
   } else {
     /* take the bigger rectangle to avoid cutting of any part of the string */
-    *width = pdu_to_dcm(logical_rect.width > ink_rect.width ? logical_rect.width : ink_rect.width) / global_zoom_factor;
+    /* also respect that Dia is assuming to start from zero */
+    int full_width = ink_rect.width + ink_rect.x;
+    *width = pdu_to_dcm(logical_rect.width > full_width ? logical_rect.width : full_width) / global_zoom_factor;
   }
   return offsets;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]