[vte/vte-0-34] drawing: Guard against pathological fonts



commit c8b374c41f2df26d8eb5bd79517017f9f0d9f2d0
Author: Christian Persch <chpe gnome org>
Date:   Thu Sep 12 19:14:35 2013 +0200

    drawing: Guard against pathological fonts

 src/vtedraw.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/src/vtedraw.c b/src/vtedraw.c
index 039342c..18784c7 100644
--- a/src/vtedraw.c
+++ b/src/vtedraw.c
@@ -368,6 +368,9 @@ font_info_measure_font (struct font_info *info)
        /* We don't do CEIL for width since we are averaging;
         * rounding is more accurate */
        info->width  = PANGO_PIXELS (howmany (logical.width, strlen(VTE_DRAW_SINGLE_WIDE_CHARACTERS)));
+        /* Guard against pathological font since width=0 causes a FPE later on */
+       info->width = MAX (info->width, 1);
+
        info->height = PANGO_PIXELS_CEIL (logical.height);
        info->ascent = PANGO_PIXELS_CEIL (pango_layout_get_baseline (info->layout));
 


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