From 67cd01fc2198e9f87567316a9a2aee55a52b2355 Mon Sep 17 00:00:00 2001 From: cristy Date: Wed, 2 Jan 2013 13:49:56 +0000 Subject: [PATCH] --- coders/pango.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/coders/pango.c b/coders/pango.c index 5351b441f..c61eac392 100644 --- a/coders/pango.c +++ b/coders/pango.c @@ -193,7 +193,7 @@ static Image *ReadPANGOImage(const ImageInfo *image_info, */ fontmap=pango_cairo_font_map_new(); pango_cairo_font_map_set_resolution(PANGO_CAIRO_FONT_MAP(fontmap), - image->resolution.x); + image->resolution.x == 0.0 ? 72.0 : image->resolution.x); font_options=cairo_font_options_create(); option=GetImageOption(image_info,"pango:hinting"); if (option != (const char *) NULL) @@ -293,7 +293,8 @@ static Image *ReadPANGOImage(const ImageInfo *image_info, option=GetImageOption(image_info,"pango:indent"); if (option != (const char *) NULL) pango_layout_set_indent(layout,(int) ((StringToLong(option)* - image->resolution.x*PANGO_SCALE+36)/72.0+0.5)); + (image->resolution.x == 0.0 ? 72.0 : image->resolution.x)*PANGO_SCALE+36)/ + 72.0+0.5)); switch (draw_info->align) { case CenterAlign: align=PANGO_ALIGN_CENTER; break; @@ -350,24 +351,26 @@ static Image *ReadPANGOImage(const ImageInfo *image_info, if (image->columns == 0) { pango_layout_get_pixel_extents(layout,NULL,&extent); - image->columns=extent.x+extent.width+2*page.x; + image->columns=(extent.x+extent.width)/PANGO_SCALE+2*page.x; } else { image->columns-=2*page.x; pango_layout_set_width(layout,(int) ((PANGO_SCALE*image->columns* - image->resolution.x+36.0)/72.0+0.5)); + (image->resolution.x == 0.0 : 72.0 : image->resolution.x)+36.0)/72.0+ + 0.5)); } if (image->rows == 0) { pango_layout_get_pixel_extents(layout,NULL,&extent); - image->rows=extent.y+extent.height+2*page.y; + image->rows=(extent.y+extent.height)/PANGO_SCALE+2*page.y; } else { image->rows-=2*page.y; pango_layout_set_height(layout,(int) ((PANGO_SCALE*image->rows* - image->resolution.y+36.0)/72.0+0.5)); + (image->resolution.y == 0.0 : 72.0 : image->resolution.y)+36.0)/72.0+ + 0.5)); } /* Render markup. -- 2.40.0