dia r3999 - in trunk: . lib plug-ins/wmf



Author: hans
Date: Sat May 10 12:11:20 2008
New Revision: 3999
URL: http://svn.gnome.org/viewvc/dia?rev=3999&view=rev

Log:
2008-05-10  Hans Breuer  <hans breuer org>

	* lib/diagramdata.c(layer_update_extents) : don't consider empty 
	objects for the overall extents. Fixes bug #531687 and lowers
	priority of bug #99375.
	
	* plug-ins/wmf/wmf.cpp : don't assume pango_context_load_font() can not
	fail. It does for font descriptions pointing to fonts not available
	on the particular system.


Modified:
   trunk/ChangeLog
   trunk/lib/diagramdata.c
   trunk/plug-ins/wmf/wmf.cpp

Modified: trunk/lib/diagramdata.c
==============================================================================
--- trunk/lib/diagramdata.c	(original)
+++ trunk/lib/diagramdata.c	Sat May 10 12:11:20 2008
@@ -1073,8 +1073,12 @@
     l = g_list_next(l);
   
     while(l!=NULL) {
+      const Rectangle *bbox;
       obj = (DiaObject *) l->data;
-      rectangle_union(&new_extents, &obj->bounding_box);
+      /* don't consider empty (or broken) objects in the overall extents */
+      bbox = &obj->bounding_box;
+      if (bbox->right > bbox->left && bbox->bottom > bbox->top)
+        rectangle_union(&new_extents, &obj->bounding_box);
       l = g_list_next(l);
     }
   } else {

Modified: trunk/plug-ins/wmf/wmf.cpp
==============================================================================
--- trunk/plug-ins/wmf/wmf.cpp	(original)
+++ trunk/plug-ins/wmf/wmf.cpp	Sat May 10 12:11:20 2008
@@ -467,7 +467,8 @@
     W32::LPCTSTR sFace;
     W32::DWORD dwItalic = 0;
     W32::DWORD dwWeight = FW_DONTCARE;
-    DiaFontStyle style;
+    DiaFontStyle style = dia_font_get_style(font);
+
 
     DIAG_NOTE(renderer, "set_font %s %f\n", 
               dia_font_get_family (font), height);
@@ -484,19 +485,28 @@
 #ifdef __PANGOWIN32_H__ /* with the pangowin32 backend there is a better way */
 	if (!renderer->pango_context)
 	    renderer->pango_context = pango_win32_get_context ();
+
 	PangoFont* pf = pango_context_load_font (renderer->pango_context, dia_font_get_description (font));
-	W32::LOGFONT* lf = pango_win32_font_logfont (pf);
-	/* .93 : sligthly smaller looks much better */
-	lf->lfHeight = -SC(height*.93);
-	renderer->hFont = (W32::HFONT)W32::CreateFontIndirect (lf);
-	g_free (lf);
-	g_object_unref (pf);
+	if (pf)
+	{
+	    W32::LOGFONT* lf = pango_win32_font_logfont (pf);
+	    /* .93 : sligthly smaller looks much better */
+	    lf->lfHeight = -SC(height*.93);
+	    renderer->hFont = (W32::HFONT)W32::CreateFontIndirect (lf);
+	    g_free (lf);
+	    g_object_unref (pf);
+	}
+	else
+	{
+	    gchar *desc = pango_font_description_to_string (dia_font_get_description (font));
+	    message_warning (_("Can not render unknown font:\n%s"), desc);
+	    g_free (desc);
+	}
 #else
 	g_assert_not_reached();
 #endif
     } else {
 	sFace = dia_font_get_family (font);
-	style = dia_font_get_style(font);
 	dwItalic = DIA_FONT_STYLE_GET_SLANT(style) != DIA_FONT_NORMAL;
 
 	/* although there is a known algorithm avoid it for cleanness */



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